Skip to content

Added authorization to Gutenberg toggle AJAX handler - #599

Merged
pirate-bot merged 1 commit into
developmentfrom
bugfix/themeisle/2100
Nov 5, 2026
Merged

pirate-bot merged 1 commit into
developmentfrom
bugfix/themeisle/2100

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Summary

Strengthened security for the toggle_gutenberg action 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

@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for bed8acd is ready 🛎️!

@pirate-bot pirate-bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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… printed OK (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 rollback source succeeds cd /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 migration and rollback sources.
  • 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

@pirate-bot
pirate-bot merged commit 583bfbb into development Nov 5, 2026
7 checks passed
@pirate-bot
pirate-bot deleted the bugfix/themeisle/2100 branch November 5, 2026 12:04
@pirate-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.6.26 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants