Automattic / Automattic/VIP-Coding-Standards
WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders wrong & incomplete
- Lingua principale
- PHP
- Stelle
- 261
- Fork
- 44
- Merge medio
- 19m
- PR unite (30g)
- 1
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia individuando lo sniff WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders e riproducendone il comportamento con i due esempi PHP nel report. Analizza come riconosce la validazione e quali header del client controlla, quindi individua i test o le fixture che definiscono il comportamento previsto. Il lavoro è completato quando le indicazioni sulla validazione e la copertura degli header sono rese esplicite e verificate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php, wordpress
- Ambito
- security, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100