Skip to content

Fix protected options, sort direction and CI pinning (on #93) - #94

Merged
jdevalk merged 3 commits into
codex/hardening-fixesfrom
filip/pr93-option-actions-fixes
Nov 18, 2026
Merged

jdevalk merged 3 commits into
codex/hardening-fixesfrom
filip/pr93-option-actions-fixes

Conversation

@ilicfilip

@ilicfilip ilicfilip commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #93, targeting its branch. Fixes the option-action review findings. Touches different code from the tracking follow-up (#95), so both merge into #93 without conflicts. Checked with a local trial merge.

What changes

  • Protected list: theme_mods was not a real option name, so Customizer settings could still be deleted. Now the active theme's theme_mods_{stylesheet} is protected. Inactive themes' leftovers stay removable, since cleaning those up is a legitimate optimizer use.
  • Salts and keys (auth_key, auth_salt, secure_auth_*, logged_in_*, nonce_*) are protected. WordPress stores them in wp_options when wp-config.php doesn't define them, and deleting them logs every user out.
  • Speed: the lowercased name map is built once per request instead of once per row. Bulk delete and autoload resolve collation aliases with one IN query instead of one query per name.
  • Sort direction is case-insensitive again, as on develop (DESC was sorting ascending).
  • CI: the new javascript-regressions job pins its actions to commit SHAs, like deploy.yml.
  • Test fix: the list-response test fetched only the first 25 rows, so it failed on any site with more than 25 matching options. It failed on Harden option actions, tracking, and release workflows #93 as submitted.

Verification

  • tests/hardening.php passes on a disposable WP 7.1.4 / MySQL 8.0.33 site, as do PHPCS, PHPStan (no plugin errors), parallel-lint and the node tests.
  • Mutation check: each fix was reverted in turn (sort, theme mods, salts, alias query), and the suite failed every time.
  • Edge cases over REST: a 400-name bulk with a case alias last is refused and nothing is deleted. An accent alias (nóncé_sált) is refused. % and _ names don't widen the match. Theme switches mid-request move the protection. A 400-name preflight runs 1 query.
  • In the browser (planner.test): active theme mods, siteurl and wp_user_roles show no Delete or checkbox. An inactive theme's mods row could be deleted through the UI after confirmation. Direct REST calls to delete or change protected names return 403. Size sort works both ways from the header click. Console: only a core/browser View Transition InvalidStateError, which also appears on Settings › General.

🤖 Generated with Claude Code

- Protect the active theme's real theme_mods_{stylesheet} option instead of the
  non-existent "theme_mods"; inactive themes' leftovers stay removable.
- Protect salts and keys WordPress stores in the database when wp-config.php
  doesn't define them.
- Build the lowercased protected-name map once per request and resolve bulk
  collation aliases with a single IN query instead of one query per name.
- Compare the sort direction case-insensitively again, as develop did.
- Pin the new javascript-regressions job's actions to commit SHAs.
- Fetch a full page in the list-response test so fixtures aren't paginated
  away on sites with more than 25 matching options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Test on Playground
Test this pull request on the Playground
or download the zip

ilicfilip and others added 2 commits November 17, 2026 14:09
SQLite folds case but not accents, so 'sitéurl' is a distinct, unprotected
option there; the test now only expects 403 where the engine maps the name to
a protected row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jdevalk
jdevalk merged commit cfe382e into codex/hardening-fixes Nov 18, 2026
9 checks passed
@jdevalk
jdevalk deleted the filip/pr93-option-actions-fixes branch November 18, 2026 13:09
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.

2 participants