Repository navigation
Added authorization to Gutenberg toggle AJAX handler - #599
Merged
Merged
Conversation
Contributor
pirate-bot
approved these changes
Nov 5, 2026
Contributor
There was a problem hiding this comment.
🟢 Approved
The Gutenberg toggle now checks the settings capability before any write, and both real notice buttons still pass the new source allowlist.
Validation details
- Files reviewed: 2/2 changed files.
- The toggle tests pass at HEAD on WordPress 7.1.4 and PHP 8.3.36:
cd /repo; set -o pipefail; timeout 300 vendor/bin/phpunit --do-not-cache-result --filter 'Test_Ajax_Api::test_toggle_gut…printedOK (2 tests, 6 assertions)(run R2) - Against the pr-base admin class, the new subscriber test fails with
Failed asserting that true is false.So it detects the change. - An administrator post with the
rollbacksource succeedscd /workspace/checks/C6 && mv Rollback_Probe_test.php Rollback_Probe.php && cd /repo; set -o pipefail; timeout 300 vendo…(run R4, exit 0). - An administrator post with a source outside the allowlist stops at the source check, and the option stays unchanged
cd /workspace/checks/C6 && python3 - <<'EOF' p='/workspace/checks/C6/Rollback_Probe.php' s=open(p).read() s=s.replace(""…(run R5, exit 0). - The script and the notice markup send only the
migrationandrollbacksources. - Other nonce-only handlers use nonces that only the settings screen prints. So they do not share this cause.
Untested areas
- No suite test covers the allowlist rejection. That path ends in a plain
die(), which the suite cannot catch. - PHP CodeSniffer was not run. CI owns it.
- The body of issue themeisle#2100 was not collected.
🤖 Automated review · run code-review-agent_6aec24369094c6.33758508.
🤖 Review agent — review posted ✅ on bed8acd9 · approved · 0 findings · 16 min
Run code-review-agent_6aec24369094c6.33758508 · trail
Contributor
|
🎉 This PR is included in version 2.6.26 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
Strengthened security for the
toggle_gutenbergaction by enforcing capability checks independently of nonce validation, ensuring that only authorized users can enable or disable the Gutenberg feature. Updated tests to verify permission enforcement and prevent unauthorized access.Check before Pull Request is ready:
Closes https://github.com/Codeinwp/themeisle/issues/2100