Automattic / Automattic/VIP-Coding-Standards
WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders wrong & incomplete
- Langage dominant
- PHP
- Étoiles
- 261
- Forks
- 44
- Merge moyen
- 19 min
- PR mergées (30 j)
- 1
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par localiser le sniff WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders et reproduire son comportement avec les deux exemples PHP du rapport. Étudiez comment il reconnaît la validation et quels en-têtes client il vérifie, puis identifiez les tests ou fixtures qui définissent le comportement attendu. Le travail est terminé lorsque les indications de validation et la couverture des en-têtes sont explicitées et vérifiées.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- php, wordpress
- Domaine
- security, tooling
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100