PHPCS - WordPress.Security.NonceVerification#113
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the PHPCS exclusion for WordPress.Security.NonceVerification by adding/adjusting nonce verification across AJAX/admin flows, refactors the pagebuilder-request detection to avoid direct access to mutable superglobals, and updates the admin JS notice-refresh call to include a nonce while modernizing parts of the implementation.
Changes:
- Added/standardized nonce verification for several AJAX endpoints and added a nonce to the media bulk-action redirect URL.
- Moved “pagebuilder request” detection from
Tiny_HelpersintoTiny_Picture, usingfilter_has_var()(with a test override hook). - Updated
admin.jsto include a nonce on thetiny_image_sizes_noticerequest and replaced a jQuery.load()withfetch().
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/unit/TinyPictureTest.php |
Adds a Tiny_Picture test override to allow unit tests to simulate GET vars. |
test/unit/TinyHelpersTest.php |
Removes tests for pagebuilder detection after moving the logic out of Tiny_Helpers. |
src/views/compress-details.php |
Stops parsing ids in the view; now relies on a variable passed from the plugin layer. |
src/js/admin.js |
Adds nonce to the image-sizes notice request and modernizes the request logic to fetch(). |
src/class-tiny-wp-base.php |
Removes the base wrapper method for AJAX referer checks. |
src/class-tiny-settings.php |
Adds nonce verification for image_sizes_notice and switches settings AJAX to core check_ajax_referer. |
src/class-tiny-plugin.php |
Uses core check_ajax_referer, adds _tiny_nonce to bulk redirect, and verifies it when consuming ids. |
src/class-tiny-picture.php |
Introduces is_pagebuilder_request() using filter_has_var() with an override point for tests. |
src/class-tiny-notices.php |
Updates dismiss handler to use core check_ajax_referer. |
src/class-tiny-helpers.php |
Removes the old is_pagebuilder_request() helper implementation. |
phpcs.xml |
Removes the exclusion that disabled WordPress.Security.NonceVerification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rkoopmans
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solved every violation of WordPress.Security.NonceVerification
Changes
filter_has_varonly reads from the initial input parameter so our unit tests cannot set $_GET. This forced me to override the variable check in the test.