Repository navigation
Harden option actions, tracking, and release workflows - #93
Conversation
|
Test on Playground |
- 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>
The tracking-limited flag paused unused-option recommendations site-wide and only a manual reset cleared it, yet it was set by routine events: a 1s lock timeout under concurrent traffic, any request reading over 1,000 options, or a transient SQL error. Legacy migrations over 10,000 names could never finish, and pruning deleted the oldest (core) rows. - Drop the GET_LOCK serialisation; the 10,000-name cap is now a soft limit checked without a lock. No MySQL-only lock functions or DELETE ... LIMIT. - Set the flag only when a new name is actually dropped for capacity, or one request reads more names than storage holds. Write failures don't set it. - Detect existing names with a SQL join, so case/accent variants of a stored row count as existing, matching the primary key's collation. - Migrate legacy data without the cap so migration always completes. - Never prune rows, and don't truncate reads at the limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wpdb parses the first FROM to check the table charset for non-ASCII queries; a leading subquery made every at-capacity write with a non-ASCII name fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Write failures no longer pause recommendations, so the notice now names the only remaining cause: a full tracking table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
SQLite's case folding is ASCII-only, so vary only the ASCII letters; the name stays non-ASCII to keep exercising wpdb's charset check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed this. The autoload, protection and input-validation fixes are solid and worth landing. The tracking-limit part caused regressions, though, so I've put the fixes in two follow-up PRs that target this branch. They change different code, so they merge cleanly in either order. A local trial merge of both passes every check. #94: option actions
#95: tracking limitsRoutine events set the
Also: migrations over 10,000 names could never finish, and pruning deleted the oldest (core) rows. #95 removes the lock and keeps the cap as a soft limit. The flag is now set only when a name is actually dropped for capacity. Migration always completes, and nothing is pruned. Reproduced on this branch:
Details and test evidence are in each PR description. Separately, #96 removes the empty |
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…endations Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tions The REST tests from #100 asserted the old behaviour. Adjust them to the hardened routes: schema validation rejects unknown autoload values, missing options are reported as update_failed instead of 404 or being skipped silently, and the in-handler nonce checks are gone (core REST authentication checks cookie nonces). The admin page only pauses tracking for an administrator in wp-admin, so cover both that and the front-end case. Add tests for what the hardening introduces: protected options can't be deleted or have their autoload flag changed, a protected name refuses a whole batch, and malformed option names are rejected. Make js/admin-script.js pass the JS lint job that develop now has: Prettier formatting, eslint-disable comments moved to the lines they apply to, and the DataTable lookup moved after the early return. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Plugin readme previewOpen preview · Commit 29 passed · 1 warning · 0 notes Warnings
Passed checks (29)
Readme and PHP-header checks only; this does not test plugin runtime compatibility. |
Autoload changes currently delete and recreate options, which can lose data or permanently save filtered values. This change updates only the autoload flag, protects essential WordPress options, and validates option identifiers without changing their contents.
wp_set_option_autoload_values()for single and bulk changes; preserve false-valued options and report failed writes.Option-value access remains available to users with
manage_options; the admin screen and README now explain that values may contain credentials, including on multisite.Validation: PHP syntax, WordPress coding standards, PHPStan, five JavaScript regression tests, plugin-map validation plus 12 malformed fixtures, and release-file inclusion/exclusion checks passed. Integration regressions passed against an isolated PHP 8.3 / WordPress 7.1-alpha / MariaDB 11.4 installation, covering exact names, raw-value preservation, protected options, actual lock contention, failed SQL writes, retries, partial migration, and synchronous reset. Browser verification and execution against the minimum WordPress version remain outstanding.
Related: #79, #92.