Skip to content

Allow sandboxed panels to read their plugin's own storage (storage.get/storage.keys) - #13220

Open
Cams626 wants to merge 2 commits into
stablyai:mainfrom
Cams626:feat/panel-readonly-storage-actions
Open

Cams626 wants to merge 2 commits into
stablyai:mainfrom
Cams626:feat/panel-readonly-storage-actions

Conversation

@Cams626

@Cams626 Cams626 commented Aug 8, 2026

Copy link
Copy Markdown

Allow sandboxed panels to read their plugin's own storage

User-visible change

Plugin panels can now call storage.get and storage.keys over the panel
bridge (previously worker-only). This gives panels their first data path:
a plugin worker can prepare display data in its own storage and the panel can
read it live, instead of the only current workaround — regenerating the panel
entry HTML on disk, which defeats content hashing for installed plugins and
only refreshes on remount.

No visual change. No new UI; existing panels behave identically unless
their plugin starts using the new actions.

Why this shape

  • The panel shell CSP is connect-src 'none' by design, and workers cannot
    push to panels — so today a panel literally cannot display live data
    through any supported channel.
  • storage.get/storage.keys are the two non-mutating, plugin-private
    scoped methods of the already-consented storage capability. Reading your
    own plugin's storage from your own plugin's panel crosses no trust
    boundary that the worker hasn't already crossed.
  • The panel action surface, capability gate, bridge schema, and relay all
    derive from the spec table, so the change is two panel: flags; every
    enforcement point picks it up consistently (covered by the conformance
    suite on both desktop-main and relay transports).

What stays locked down

  • storage.set / storage.delete remain worker-only (a new conformance
    case uses storage.set via panel as the canonical panel_forbidden
    example).
  • All secrets.* methods remain worker-only — a new invariant test asserts
    no secrets method and no mutating plugin-private method is ever
    panel-callable, so this can't regress silently.
  • Capability gating is unchanged: a panel without consented storage gets
    capability_denied.
  • Panel bridge byte/rate budgets apply to these actions like any other.

Motivating use case

A read-only Hermes Kanban board panel (AVAS): a trusted worker polls a local
read-only API and maintains a snapshot; the sidebar panel needs to render it
live. Today this requires rewriting panel/index.html every poll cycle —
works only for dev plugins (hash-exempt) and refreshes only on remount. With
this change the worker writes to storage and the panel polls storage.get
within the existing budgets.

Tests

  • Conformance: panel-path success for storage.get/storage.keys on both
    transports; storage.set and secrets.get via panel remain
    panel_forbidden; exact panel action surface asserted.
  • pnpm lint, pnpm typecheck, and the plugin suites
    (src/shared/plugins/, src/main/plugins/, renderer panel bridge host)
    pass.

AI code review summary

Reviewed by the authoring agent for: cross-platform impact (none — shared,
Electron-free spec table; no platform-conditional code), SSH/remote/local
compatibility (relay conformance path exercises the same gate; results are
plain JSON over the existing panel action reply channel; no new wire opcode,
additive within the existing method call shape), agent/integration
compatibility (no agent-facing surface touched), performance (no hot-path
work added; panel calls remain budgeted), UI (no visual change), security
(read-only, plugin-private, capability-gated expansion; secrets and
mutations remain worker-only and are now invariant-tested). One note for
maintainers: storage values can be up to 256KB while panel → host request
budgets are 64KB; results flow on the reply channel like existing action
results, but if you prefer a result-size clamp for panel-path reads we're
happy to add one.

Platform/remote notes

Behavior is identical across macOS/Linux/Windows and desktop/serve/relay —
enforced by the shared spec table and the conformance suite.

Sandboxed panels have no data path: the panel shell CSP blocks fetch,
and workers cannot push to panels — so a worker that prepares display
data cannot hand it to its own panel without rewriting the panel entry
on disk, which defeats content hashing for installed plugins. Mark the
two non-mutating plugin-private storage reads (storage.get,
storage.keys) panel-callable. The panel action surface derives from the
spec table, so the bridge, gate, and relay pick this up unchanged.
Mutating storage methods and all secrets methods stay worker-only, now
locked by a conformance test.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 62cb0aa8-1958-4732-a74c-d712ac6c1ed1

📥 Commits

Reviewing files that changed from the base of the PR and between 2372704 and c215eb2.

📒 Files selected for processing (1)
  • src/main/plugins/plugin-host-conformance.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/plugins/plugin-host-conformance.test.ts

📝 Walkthrough

Walkthrough

The plugin host now allows panels to call the read-only storage.get and storage.keys methods. Storage mutations and secrets access remain restricted to workers. Conformance tests verify the approved panel API surface, read access through desktop and relay transports, and denial of storage.set and secrets.get.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling sandboxed panels to read plugin storage.
Description check ✅ Passed The description covers the change, testing, visual impact, AI review, security considerations, and platform notes with only minor template-heading differences.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c5a5242a-c6b8-4738-9b2f-1ef618ac9016

📥 Commits

Reviewing files that changed from the base of the PR and between 6da7b8e and 2372704.

📒 Files selected for processing (2)
  • src/main/plugins/plugin-host-conformance.test.ts
  • src/shared/plugins/plugin-host-api.ts

Per review: fresh service mocks for each transport so desktop-main and
relay are each verified to hit storage.get/storage.keys exactly once
with the bound plugin key, instead of one aggregate assertion.

Co-Authored-By: Claude Fable 5 <[email protected]>

This branch has not been deployed

No deployments
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.

4 participants