Automattic / Automattic/VIP-Coding-Standards
WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders wrong & incomplete
- 主要言語
- PHP
- スター
- 261
- フォーク
- 44
- 平均マージ
- 19分
- マージ済み PR(30日)
- 1
説明
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.
コントリビューションガイド
調査の方向性
まず、sniff WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders の場所を特定し、レポート内の 2 つの PHP 例でその動作を再現します。どのようにバリデーションを認識するのか、またどのクライアントヘッダーをチェックするのかを調査し、その後、期待される動作を定義しているテストまたは fixture を特定します。バリデーションに関するガイダンスとヘッダーのカバレッジが明示され、検証されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php, wordpress
- 領域
- security, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100