Automattic / Automattic/VIP-Coding-Standards

WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders wrong & incomplete

Đang mở
#477 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
261
Fork
44
Merge trung bình
19 phút
Pull request đã merge (30 ngày)
1

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tìm sniff WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders và tái hiện hành vi của nó bằng hai ví dụ PHP trong báo cáo. Điều tra cách nó nhận diện việc validation và những client header nào nó kiểm tra, sau đó xác định các test hoặc fixture định nghĩa hành vi mong đợi. Công việc được xem là hoàn tất khi hướng dẫn về validation và phạm vi bao phủ của header được làm rõ và xác minh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
php, wordpress
Lĩnh vực
security, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.