Automattic / Automattic/VIP-Coding-Standards

WordPressVIPMinimum.Security.PHPFilterFunctions.MissingThirdParameter shouldn't report for SCRIPT_FILENAME,...

オープン
#832 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
261
フォーク
44
平均マージ
19分
マージ済み PR(30日)
1

説明

## Bug Description

Since filter_input always acts on the original data, which can also not be modified in userland, all values that are specified by the SAPI itself are safe and do not need sanitizing.
These are:
https://github.com/php/php-src/blob/master/sapi/cli/php_cli.c#L330-L347
PHP_SELF
SCRIPT_NAME
SCRIPT_FILENAME
PATH_TRANSLATED
DOCUMENT_ROOT

For fpm these are provided by apache/nginx and no further validation is required, since PHP would not even process the request if any of those were invalid

## Minimal Code Snippet

```php
echo filter_input( INPUT_SERVER, 'DOCUMENT_ROOT' );
```

## Error Code

WordPressVIPMinimum.Security.PHPFilterFunctions.MissingThirdParameter

## Environment

VIPCS version | 3.0.1

## Tested Against `main` branch?

- [ ] I have verified the issue still exists in the `main` branch of VIPCS.
- [ ] I have verified the issue still exists in the `develop` branch of VIPCS.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the WordPressVIPMinimum.Security.PHPFilterFunctions.MissingThirdParameter rule and the filter_input(INPUT_SERVER, ...) entry point shown in the snippet. Review the listed SAPI-provided variables in php-src/sapi/cli/php_cli.c, lines 330-347, and confirm the rule no longer reports those cases while retaining its existing report for other inputs.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
security, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。