Skip to content

Make the Site Information panel an experimental opt-in#20

Merged
jakemgold merged 1 commit into
mainfrom
feat/site-info-experimental-opt-in
Jun 6, 2026
Merged

Make the Site Information panel an experimental opt-in#20
jakemgold merged 1 commit into
mainfrom
feat/site-info-experimental-opt-in

Conversation

@jakemgold

Copy link
Copy Markdown
Collaborator

Summary

The Site Information panel's plugin/theme detection relies on asset-path inference, which is inherently lossy. The same issue (#4) covers the symptom — duplicates from plugins that enqueue multiple asset paths, false positives from mu-plugins and drop-ins, slugs that don't match actual plugin folder names. None of those are bugs to fix; they're the nature of frontend-only inference.

For a 1.0 release, "show confidently-wrong data by default" is the wrong trade. Gate the panel behind an explicit opt-in on the options page, framed as experimental.

Changes

  • `src/popup/hooks/usePrefs.js` — adds `siteInfoEnabled: false` to `DEFAULT_PREFS`. Read through the existing global-namespace fallback.
  • `src/popup/components/DetectedView.js` — pulls `prefs` via `usePrefs` and gates the `` render on `prefs.siteInfoEnabled`.
  • `options/options.html`, `options/options.js` — new "Experimental" section with the toggle, wired to the same storage layer as the other global preferences.
  • `README.md` — describes the options page surface and notes the experimental section.

The panel's existing source code is untouched. Users who turn it on get exactly what shipped before.

Test plan

  • `npm run build` — clean
  • `node test/smoke.js` — passes
  • Reload Chrome → open the popup on a WP site → Site Information panel should be absent.
  • Open options page → "Experimental" section visible → toggle "Show site information panel" on.
  • Reopen the popup → Site Information panel renders as before, with all detection behavior identical to the pre-PR version.
  • Toggle off → panel hidden again.
  • Same flow in Safari after container rebuild.

Closes #4.

The panel's plugin/theme detection relies on asset-path inference,
which is inherently lossy — sites with multiple asset paths per
plugin show duplicates, mu-plugins and drop-ins leak through as
false positives, and the result confidently presents data that is
sometimes wrong. Better to gate this behind explicit opt-in than to
present it as a first-class feature on a 1.0 release.

The toggle lives in a new Experimental section on the options page,
off by default. The popup reads the new `siteInfoEnabled` global pref
through the existing `usePrefs` hook and gates the `<SiteInfoPanel>`
render on it. README updated to describe the options page surface
and the experimental section.

Closes #4 by reframing the panel's accuracy gap as an explicit
expectation rather than a bug to chase.
@jakemgold jakemgold requested a review from fabiankaegy as a code owner June 6, 2026 23:43
@jakemgold jakemgold merged commit 8144593 into main Jun 6, 2026
@jakemgold jakemgold deleted the feat/site-info-experimental-opt-in branch June 6, 2026 23:43
jakemgold added a commit that referenced this pull request Jun 7, 2026
…ale comment (#23)

## Summary

Three small follow-ups from a read-only sweep against #18 / #20.

### 1. Safari Resources `options/` was left untracked (P1)

The Xcode project file (\`project.pbxproj\`) added in #18 references
\`Resources/options/\`, but the three files inside that folder were
never staged. A fresh clone hits the same "Unable to find
options/options.html" error we saw before #18 fixed the Xcode side —
just from the other direction. Stage them.

### 2. Plugin URI scheme validation (P2)

\`lib/site-info.js\` was happily forwarding whatever \`plugin_uri\` the
REST response carried. That value comes from a plugin's own "Plugin URI"
header — site-authored, and attacker-controllable when a site runs
untrusted plugins. \`SiteInfoPanel\` then opened those URIs in new tabs.

Add \`safePluginUri()\` that rejects anything outside \`http:\` /
\`https:\`. The existing \`wordpress.org/plugins/{slug}/\` fallback in
\`SiteInfoPanel\` covers the rejected cases. A new \`[23]\` smoke
scenario covers javascript:, data:, malformed, and empty.

### 3. Stale comment in \`lib/early.js\` (P3)

The header doc still said the admin bar default was hidden. The
per-origin default flipped to shown in #17 and the global override
landed in #18. Rewrite the paragraph so future maintainers don't follow
the wrong mental model.

## Test plan

- [x] \`npm run build:safari\` — clean
- [x] \`npm test --prefix test\` — all green (existing scenarios + new
[23])
- [ ] Fresh clone + \`npm install\` + open the Safari project in Xcode
without running \`build:safari\` first — should no longer error on
missing options page resources

Credit: findings from a Codex read-only sweep.
itzmekhokan pushed a commit to itzmekhokan/browser-extension that referenced this pull request Jun 7, 2026
…ale comment

Three small follow-ups from a read-only sweep of WordPress#18 + WordPress#20:

1. The Safari Resources mirror of `options/` was never staged in WordPress#18.
   Xcode's project file already references `Resources/options/` (added
   in WordPress#18), but the files themselves were left untracked, so a fresh
   clone hits "Unable to find options/options.html in the extension's
   resources" — the same error pattern we hit before the Xcode project
   was updated, just from the other direction. Stage the three files
   so Xcode resolves them out of the box.

2. The Site Information panel happily opened whatever `plugin_uri` the
   REST response carried. That value comes from a plugin's own
   "Plugin URI" header — site-authored, attacker-controllable when
   sites run untrusted plugins. Add `safePluginUri()` in `lib/site-info.js`
   that rejects anything other than `http:` / `https:`; SiteInfoPanel's
   existing fallback to `wordpress.org/plugins/{slug}/` covers the
   rejected cases. New `[23]` smoke scenario covers javascript:, data:,
   malformed, and empty inputs.

3. The header comment in `lib/early.js` still said the admin bar default
   was hidden. That was the original behavior, but the per-origin default
   flipped to shown in WordPress#17 and the global override added in WordPress#18. Rewrite
   the doc paragraph so future maintainers don't follow the wrong mental
   model.

Reported by Codex sweep against WordPress#18 / WordPress#20.
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.

Plugin detection lists duplicate and unrecognised plugins

1 participant