Automattic / Automattic/VIP-Coding-Standards
WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders wrong & incomplete
- Lenguaje dominante
- PHP
- Estrellas
- 261
- Forks
- 44
- Merge medio
- 19 min
- PR fusionados (30 d)
- 1
Descripción
1) I get 1) WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders even when it's perfectly fine sanitized:
`$user_ip = filter_var( $_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP );`
or with wp only functions (though I'm not sure if it really is properly sanitized then)
`sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )`
What is the correct way of validating this this sniff expects?
2) this error doesn't make much sense, as it's limited to 3 headers. But there is an arbitrary number of HTTP headers the client could send which would not trigger this error but may be used.
E.g. when using cloudflare there's also the CF_IPCOUNTRY,... headers which would also need to be added to the check.
Guía de contribución
Línea de trabajo
Comienza localizando el sniff WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders y reproduciendo su comportamiento con los dos ejemplos de PHP del informe. Investiga cómo reconoce la validación y qué encabezados del cliente comprueba; después, identifica las pruebas o fixtures que definen el comportamiento esperado. Se considera terminado cuando las indicaciones sobre la validación y la cobertura de encabezados se hayan hecho explícitas y verificado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- php, wordpress
- Área
- security, tooling
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 35/100