Skip to content

fix(security): builder preview, language switch and element requests require an admin and the admin nonce - #264

Merged
RensTillmann merged 3 commits into
lts/6.3.xfrom
fix/lts-builder-ajax-auth
Oct 20, 2026
Merged

RensTillmann merged 3 commits into
lts/6.3.xfrom
fix/lts-builder-ajax-auth

Conversation

@RensTillmann

@RensTillmann RensTillmann commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Security fix for #139 on 6.3 LTS. Five form-builder AJAX handlers had no nonce and no capability check, so any logged-in user (e.g. a subscriber) could render any form or its settings: super_load_preview (form markup incl. drafts/private/backups), super_switch_language (full form settings HTML), super_undo_redo, and the AJAX entry of super_load_element_settings / super_get_element_builder_html.

They now use the existing authorize_admin_ajax_request() guard (manage_options + super_admin_ajax nonce); preview also rejects backups/non-forms via require_admin_form(). The last two are only guarded on their AJAX path (doing_action), so internal PHP calls keep working. All six builder JS callers send the admin nonce (already localized).

No more silent failures: a rejected save/preview request (non-200, -1/0) restores the button and shows a translatable alert ("The request was rejected (HTTP %s). Your session may have expired or a security plugin blocked it. Please reload the page and try again.") instead of hanging on "Saving...". Saving itself was already protected since 6.3.317.

Base branch

lts/6.3.x: security fix for the stable channel. 6.4 counterpart: #260.

Tests

new tests/test-security-builder-ajax.php (forked AJAX requests; needs pcntl):
  without the fix: 23 of 30 fail (20 rejection cases, backup preview, JS nonce check, localization)
  with the fix:    OK (30 tests, 221 assertions)
full LTS PHPUnit suite (g16-phpunit + MariaDB): OK, 694 tests (baseline lts/6.3.x: OK, 664 tests)
php -l, node --check create-form.js: OK

Not run: a real-browser builder session.

Merge

Draft: for QA and the next LTS release session.

@RensTillmann
RensTillmann marked this pull request as ready for review October 20, 2026 15:57
@RensTillmann
RensTillmann merged commit 4c16337 into lts/6.3.x Oct 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant