Automattic / Automattic/VIP-Coding-Standards

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

Abierto
#832 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
261
Forks
44
Merge medio
19 min
PR fusionados (30 d)
1

Descripción

## 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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
php
Área
security, tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.