Automattic / Automattic/VIP-Coding-Standards
WordPressVIPMinimum.Security.PHPFilterFunctions.MissingThirdParameter shouldn't report for SCRIPT_FILENAME,...
- Ngôn ngữ chính
- PHP
- Star
- 261
- Fork
- 44
- Merge trung bình
- 19 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
## 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- security, tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100