Add plugin security guidance for escaping and AJAX#63
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates WordPress plugin security reference guidance with concrete output-escaping context rules and AJAX handler review checks.
Changes:
- Added a quick-reference section mapping common output contexts to appropriate escaping functions.
- Added an AJAX handlers checklist covering nonce/capability checks and safe JSON responses.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR expands the plugin security guidance in
wp-plugin-developmentby adding practical review criteria for output escaping and AJAX handlers.The goal is to help AI coding assistants generate and review WordPress plugins using safer patterns and more consistent security practices.
Key Changes
Output Escaping Guidance
Added a dedicated section covering context-specific escaping functions:
esc_html()esc_attr()esc_url()esc_textarea()wp_json_encode()wp_kses_post()andwp_kses()This reinforces the existing "sanitize on input, escape on output" guidance with concrete implementation recommendations.
AJAX Security Guidance
Added a new section covering secure AJAX handler development:
wp_ajax_*actionswp_ajax_nopriv_*requests as attacker-controlled inputwp_send_json_success()andwp_send_json_error()for responsesImproved Review Coverage
The additional guidance helps AI assistants identify and prevent common plugin security issues including:
These additions complement the existing nonce, capability, sanitization, and SQL safety recommendations already present in the security reference.