Automattic / Automattic/VIP-Coding-Standards

ProperEscapingFunctionSniff doesn't catch misuse of wp_json_encode

Đang mở
#876 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ả

## Bug Description

[ProperEscapingFunctionSniff](https://github.com/Automattic/VIP-Coding-Standards/blob/54ff2f355aa6bdf5d987636a8e4b817d91e32d5d/WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSniff.php#L20) is a great addition to WPCS. It isn't comprehensive, though.

One specific example that I ran into is that it won't catch improper use of `wp_json_encode()` like it does with other functions.

## Minimal Code Snippet

```html


```

## Error Code

`WordPressVIPMinimum.Security.ProperEscapingFunction`

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 đọc WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSniff.php và tái hiện các ví dụ onerror tối thiểu từ issue. So sánh cách wp_json_encode được xử lý với esc_html; hoàn tất khi việc sử dụng sai tạo ra lỗi WordPressVIPMinimum.Security.ProperEscapingFunction trong ngữ cảnh đó.

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
Lĩnh vực
security, tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
48/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.