Repository navigation
fix: small security cleanups (closes #121, #123, #128) - #201
Merged
Merged
Conversation
…r rationale (closes #121, #123, #128) Three Plugin Checker items that turned out to be small / partially-done. #121 — Escape output in functions-abilities.php The previous code passed sprintf() output directly to _doing_it_wrong() with a misleading phpcs:ignore claiming "output is escaped by _doing_it_wrong()". That's not true — _doing_it_wrong forwards the message to trigger_error(), which in WP_DEBUG mode can reach an admin notice / error log without HTML escaping. The ability ID is developer-controlled in practice, but Plugin Checker (rightly) wants defense in depth here. Fix: wrap the sprintf in esc_html() and drop the misleading ignore comment. No behavior change in the common path (the format string has no HTML), but the safety contract is now explicit. #123 — sw-loader.php direct access + readfile() This file is intentionally browser-accessible — it's the URL the browser fetches when registering the Service Worker, before WordPress is loaded. ABSPATH is never defined here and WP_Filesystem is unavailable. Fix: kept the existing structure (it's correct), added a docblock explaining why no ABSPATH guard is possible, and a single phpcs:ignore on the readfile() call with rationale (single asset, hard-coded __DIR__ path, no traversal vector). #128 — db-optimize.php uncached query Already resolved by the existing phpcs:ignore on line 81 (covers WordPress.DB.DirectDatabaseQuery.DirectQuery and .NoCaching). No changes needed — closing as already-fixed. Verification: composer lint — 0 errors, 0 warnings (was 1 warning on sw-loader.php) npm test — 96 passing, unchanged Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
6 tasks
ivdimova
approved these changes
May 12, 2026
ivdimova
left a comment
Collaborator
There was a problem hiding this comment.
Both fixes are correct. esc_html() wrapping is a genuine security fix — _doing_it_wrong() does not escape its input. readfile() swap is appropriate for streaming. sw-loader.php rationale comment correctly justifies the ABSPATH exception.
ivdimova
pushed a commit
that referenced
this pull request
May 12, 2026
Minimum WP.org-required rename ahead of plugin directory submission.
What WordPress.org's Plugin Checker actually rejects:
- Plugin Name containing "WP" (treats it as a WordPress lookalike)
- Function names beginning with wp_ (looks like core)
- Text Domain not matching the submission slug
What changed:
- Plugin Name header: "WP Agentic Admin" → "Agentic Admin for WordPress"
- Plugin URI: pluginslab.com/wp-agentic-admin → pluginslab.com/agentic-admin
- Text Domain header: wp-agentic-admin → agentic-admin
- readme.txt header: === Agentic Admin for WordPress ===
- README.md heading + body: same display-name updates
- i18n text-domain string in all __()/esc_html__()/etc. calls:
'wp-agentic-admin' → 'agentic-admin'
- PHP function prefix: wp_agentic_admin_* → agentic_admin_*
(touches register fns, helpers, the manifest entries that
reference function names by string, the abilities, REST callbacks)
- phpcs.xml.dist: updated text_domain + prefixes properties
accordingly. WP_AGENTIC_ADMIN_* constants and WPAgenticAdmin
namespace kept in the allowed prefix list (not WP.org-checked,
deliberately out of scope for this PR).
What stayed (out of scope, not WP.org-blocking):
- Local folder name (wp-agentic-admin/)
- PHP constants WP_AGENTIC_ADMIN_*
- PHP namespace WPAgenticAdmin
- JS global wpAgenticAdmin
- Ability ID prefix (wp-agentic-admin/*)
- REST namespace (wp-agentic-admin/v1)
- Option key prefix (wp_agentic_admin_*)
These can land in a v0.12 cosmetic-rename PR if/when we want full
consistency. Folder rename specifically should be its own deliberate
move with migration handling for any dev-install Option data.
Verification:
- Playground reload: plugin still active, shown as "Agentic Admin
for WordPress" in plugin list
- agentic_admin_resolve_enabled_abilities() returns 33 abilities,
every registrar function_exists() check passes
- composer lint: 0 errors (1 pre-existing readfile warning on
sw-loader.php, fixed by PR #201)
- npm test: 96 passing, unchanged
- npm run build: clean
Note: this PR also covers the README.md plugin-name update from
PR #202 (which renamed "WP-Agentic-Admin" → "WP Agentic Admin").
After this lands, #202 should be closed as superseded.
Net: 91 files changed, +1021 / -1015 (close to zero — mechanical renames,
no logic changes).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ivdimova
pushed a commit
that referenced
this pull request
May 12, 2026
* fix: rename to "Agentic Admin for WordPress" (closes #125, #124) Minimum WP.org-required rename ahead of plugin directory submission. What WordPress.org's Plugin Checker actually rejects: - Plugin Name containing "WP" (treats it as a WordPress lookalike) - Function names beginning with wp_ (looks like core) - Text Domain not matching the submission slug What changed: - Plugin Name header: "WP Agentic Admin" → "Agentic Admin for WordPress" - Plugin URI: pluginslab.com/wp-agentic-admin → pluginslab.com/agentic-admin - Text Domain header: wp-agentic-admin → agentic-admin - readme.txt header: === Agentic Admin for WordPress === - README.md heading + body: same display-name updates - i18n text-domain string in all __()/esc_html__()/etc. calls: 'wp-agentic-admin' → 'agentic-admin' - PHP function prefix: wp_agentic_admin_* → agentic_admin_* (touches register fns, helpers, the manifest entries that reference function names by string, the abilities, REST callbacks) - phpcs.xml.dist: updated text_domain + prefixes properties accordingly. WP_AGENTIC_ADMIN_* constants and WPAgenticAdmin namespace kept in the allowed prefix list (not WP.org-checked, deliberately out of scope for this PR). What stayed (out of scope, not WP.org-blocking): - Local folder name (wp-agentic-admin/) - PHP constants WP_AGENTIC_ADMIN_* - PHP namespace WPAgenticAdmin - JS global wpAgenticAdmin - Ability ID prefix (wp-agentic-admin/*) - REST namespace (wp-agentic-admin/v1) - Option key prefix (wp_agentic_admin_*) These can land in a v0.12 cosmetic-rename PR if/when we want full consistency. Folder rename specifically should be its own deliberate move with migration handling for any dev-install Option data. Verification: - Playground reload: plugin still active, shown as "Agentic Admin for WordPress" in plugin list - agentic_admin_resolve_enabled_abilities() returns 33 abilities, every registrar function_exists() check passes - composer lint: 0 errors (1 pre-existing readfile warning on sw-loader.php, fixed by PR #201) - npm test: 96 passing, unchanged - npm run build: clean Note: this PR also covers the README.md plugin-name update from PR #202 (which renamed "WP-Agentic-Admin" → "WP Agentic Admin"). After this lands, #202 should be closed as superseded. Net: 91 files changed, +1021 / -1015 (close to zero — mechanical renames, no logic changes). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix: prettier formatting after rename sed (string-length nudges) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
pluginslab
added a commit
that referenced
this pull request
May 14, 2026
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
Third of three security PRs. Three small Plugin Checker items — two real edits and one already-done close-out.
Net: +18 / -5 lines, 2 files touched.
Closes
#121 — Escape output in `functions-abilities.php`
Previous code passed `sprintf()` output directly to `_doing_it_wrong()` with a misleading phpcs:ignore claiming "output is escaped by _doing_it_wrong()". That's not actually true — `_doing_it_wrong` forwards the message to `trigger_error()`, which in WP_DEBUG mode can reach an admin notice / error log without HTML escaping.
In practice the ability ID is developer-controlled (third-party plugins choose their own namespace), but Plugin Checker (rightly) wants defense in depth here.
Fix: wrap the `sprintf` in `esc_html()` and drop the misleading ignore comment. No behavior change in the common path (the format string has no HTML), but the safety contract is now explicit.
#123 — `sw-loader.php` direct access + `readfile()`
This file is intentionally browser-accessible — it's the URL the browser fetches when registering the Service Worker, before WordPress is loaded. `ABSPATH` is never defined here, and `WP_Filesystem` is unavailable.
Fix: kept the existing structure (it's correct), added a docblock explaining why no ABSPATH guard is possible, and a single `phpcs:ignore` on the `readfile()` call with rationale (single asset, hard-coded `DIR` path, no traversal vector).
#128 — `db-optimize.php` uncached query
Already resolved by the existing `phpcs:ignore` on line 81 (covers both `DirectQuery` and `NoCaching`). No changes needed — closing as already-fixed.
Verification
Where this leaves v0.11
Test plan
🤖 Generated with Claude Code