Skip to content

feat(plugins): allow panels to read plugin storage (storage.get panel: true) - #14766

Closed
VuHoi wants to merge 13 commits into
stablyai:mainfrom
VuHoi:feat/panel-storage-get
Closed

VuHoi wants to merge 13 commits into
stablyai:mainfrom
VuHoi:feat/panel-storage-get

Conversation

@VuHoi

@VuHoi VuHoi commented Aug 15, 2026

Copy link
Copy Markdown

ELI5

Plugin panels (the little side-panel UIs plugins can ship) currently can't read any data — they can only send text to terminals and show notifications. This change lets a panel read data that its own plugin's worker process has saved, so panels can finally display dynamic content.

What Changed

One flag flip in the host API spec table: storage.get becomes callable from sandboxed panels (panel: false → panel: true).

That's the entire diff. Because PLUGIN_PANEL_ACTIONS (the panel-bridge allowlist) is derived from the spec table via .filter(entry => entry.panel), no other file changes: the existing zod validation, session-token verification, rate limiting, and capability consent all apply unchanged.

Why

The panel bridge is deliberately a closed transport — only workspace.readContext, terminal.sendText, notifications.show are panel-callable today. That's the right security posture, but it has a side effect: a panel can never display dynamic data, even data produced by its own worker. The only "output" channel a panel has is typing text into a terminal.

Workers, by contrast, have full Node access (they can shell out to CLIs, fetch, etc.) and can already write results to plugin-private storage. Opening read-only storage.get to the panel closes the loop:

worker (Node, no CSP) ──storage.set──► plugin-private KV ──storage.get──► panel iframe (render)

Threat-model analysis for why this specific method is safe to expose:

  • Read-only: mutation: false. storage.set/storage.delete stay worker-only.
  • Plugin-private scope: the storage binding keys by pluginId — a panel can only read values its own plugin wrote, never another plugin's.
  • No new capability surface: still gated behind the existing storage capability consent.
  • Same bridge protections as existing actions: session-token binding (32–128 chars, issued at panel load), 64 KB message cap, 30-msg/10s rate limit, zod-validated params.
  • Size-bounded: storage values are already capped at 256 KB per key by the store itself.

Concrete use case that motivated this: a plugin whose worker polls orca linear list-issues and renders the team's task list in its panel. Today that's impossible without workarounds (external HTTP server, patching the app). There is an existing feature request in this direction (examples/plugins/*/FEATURE-REQUEST-panel-filesystem.md bundled with the superpowers-launcher plugin asks for panel file reads — this is a strictly smaller ask that covers a large subset of the need).

Linked Issue

Fixes # (none open at time of writing — happy to link one if maintainers prefer an issue first)

Visual Proof

N/A — no UI change in the app itself; host API surface only. Verified via a probe plugin: worker writes a counter via storage.set, panel reads it back over the bridge (storage.get returns the seeded value; before the patch the same call returns unknown_method).

Testing

  • Manually tested locally: probe plugin on pnpm dev (macOS) — panel storage.get returns the worker-seeded value end-to-end
  • Verified PLUGIN_PANEL_ACTIONS picks up the change with no other edits (derived from the same spec table)
  • Automated tests: existing panel-bridge tests assert the action allowlist against the spec table (they cover the addition); no new test added since no new behavior branch exists beyond the flag — maintainers' call if a fixture asserting storage.get ∈ PLUGIN_PANEL_ACTIONS is wanted

Platforms: tested macOS (dev build). The change is platform-neutral (shared spec table, no platform-specific code paths). SSH/remote unaffected (plugin storage is local to the app host).

AI Disclosure

Claude (Anthropic) assisted with repo exploration, the security analysis above, and PR drafting; the change itself and verification were reviewed and validated by the contributor.

Review

  • Security: read-only method, plugin-private scope, existing consent + rate-limit + session-token protections apply — analyzed above.
  • Cross-platform: no platform-specific code touched.
  • Remote SSH: no interaction (plugin storage is host-local).
  • Backwards compatibility: purely additive — plugins that don't call storage.get from panels are unaffected; existing panel actions unchanged.
  • Performance: no hot-path changes; one extra entry in an allowlist filter at module load.

Checklist

  • This PR is small and focused (1 line)
  • I explained what changed and why (including ELI5)
  • No UI change — N/A visual proof with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered (N/A, reasoned above)
  • pnpm lint, pnpm typecheck, pnpm test, pnpm build — not run locally yet; CI will cover (single-flag change in a typed spec table)

Author

X / Twitter: @VuHoi

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The plugin host API now allows sandboxed panels to call storage.get over the postMessage bridge. The method metadata changes from disallowing panel callers to allowing them.

Merge Risk: 🔵 Low · up to 1d594

The change enables panels to read their plugin’s stored data, but a conformance test still expects that method to be denied; updating the test is a small, bounded follow-up needed for merge readiness.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: enabling panels to read plugin storage through storage.get.
Description check ✅ Passed The description mostly follows the template and clearly covers scope, rationale, security, testing, visual proof, AI disclosure, review, and checklist items.
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: a27a040a-4e77-49f2-be76-5034e3cc75d4

📥 Commits

Reviewing files that changed from the base of the PR and between 92fb276 and 1d59492a6d40e812bd9f3fbdcebe8ca941111ae1.

📒 Files selected for processing (1)
  • src/shared/plugins/plugin-host-api.ts

@@ -156,7 +156,7 @@ export const PLUGIN_HOST_API_V0: readonly PluginHostMethodSpec[] = [
scope: 'plugin-private',
capability: 'storage',
mutation: false,
panel: false,
panel: true,

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.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- changed file context ---'
sed -n '120,190p' src/shared/plugins/plugin-host-api.ts

printf '%s\n' '--- related symbols and tests ---'
rg -n --glob '*.{ts,tsx,js,jsx}' \
  'PLUGIN_PANEL_ACTIONS|panel:\s*(true|false)|storage\.get|panel.*capabil|capabil.*panel|plugin-host-api' \
  src test tests 2>/dev/null || true

printf '%s\n' '--- candidate test files ---'
git ls-files | rg '(^|/)(.*plugin.*(host|api|panel|language-pack).*|.*host.*api.*)\.(test|spec)\.(ts|tsx|js|jsx)$' || true

Repository: stablyai/orca

Length of output: 14993


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- host API definitions ---'
sed -n '1,90p' src/shared/plugins/plugin-host-api.ts
sed -n '245,280p' src/shared/plugins/plugin-host-api.ts

printf '%s\n' '--- capability gate ---'
cat -n src/shared/plugins/plugin-capability-gate.ts

printf '%s\n' '--- panel bridge ---'
cat -n src/shared/plugins/plugin-panel-bridge.ts

printf '%s\n' '--- conformance tests around storage and admission ---'
sed -n '1,130p' src/main/plugins/plugin-host-conformance.test.ts
sed -n '180,235p' src/main/plugins/plugin-host-conformance.test.ts
sed -n '300,370p' src/main/plugins/plugin-host-conformance.test.ts

printf '%s\n' '--- panel admission tests ---'
cat -n src/shared/plugins/plugin-panel-call-admission.test.ts

Repository: stablyai/orca

Length of output: 25237


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- all conformance cases ---'
sed -n '120,325p' src/main/plugins/plugin-host-conformance.test.ts

printf '%s\n' '--- host call adapter ---'
cat -n src/main/plugins/plugin-host-call-adapter.ts

printf '%s\n' '--- method bindings ---'
sed -n '1,145p' src/main/plugins/plugin-host-method-bindings.ts

printf '%s\n' '--- panel-related assertions ---'
rg -n -C 4 \
  "storage\.get|panel-forbidden|PLUGIN_PANEL_ACTIONS|isPluginPanelAction|gatePluginHostCall" \
  src/shared/plugins src/main/plugins tests/e2e

Repository: stablyai/orca

Length of output: 26618


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- working-tree summary ---'
git status --short
git diff --stat

printf '%s\n' '--- target diff ---'
git diff -- src/shared/plugins/plugin-host-api.ts src/main/plugins/plugin-host-conformance.test.ts

printf '%s\n' '--- panel session call path ---'
rg -n -C 5 \
  "panelAction|sessionToken|panelActionCallSchema|admitPluginPanelCall|executePluginHostCallRequest" \
  src/main src/shared src/renderer tests/e2e \
  | head -n 260

printf '%s\n' '--- deterministic metadata/test consistency probe ---'
python3 - <<'PY'
from pathlib import Path
import re

api = Path("src/shared/plugins/plugin-host-api.ts").read_text()
test = Path("src/main/plugins/plugin-host-conformance.test.ts").read_text()

def panel_flag(method):
    block = re.search(
        rf"name:\s*'{re.escape(method)}'.*?(?=\n\s*\}}\),)",
        api,
        re.S,
    )
    if not block:
        raise SystemExit(f"missing method: {method}")
    m = re.search(r"\bpanel:\s*(true|false)", block.group())
    if not m:
        raise SystemExit(f"missing panel flag: {method}")
    return m.group(1) == "true"

print("storage.get panel:", panel_flag("storage.get"))
print("storage.set panel:", panel_flag("storage.set"))
print("storage.delete panel:", panel_flag("storage.delete"))

old_expectation = bool(re.search(
    r"name:\s*'panel-forbidden method'.*?"
    r"method:\s*'storage\.get'.*?"
    r"viaPanel:\s*true.*?"
    r"code:\s*'panel_forbidden'",
    test,
    re.S,
))
print("test expects panel storage.get forbidden:", old_expectation)
if panel_flag("storage.get") and old_expectation:
    print("INCONSISTENCY: metadata admits panel storage.get, but conformance test expects rejection")
PY

Repository: stablyai/orca

Length of output: 21776


Update the panel conformance test. storage.get is now panel-enabled, but deniedCases still expects it to return panel_forbidden at src/main/plugins/plugin-host-conformance.test.ts:202. Use a panel: false method such as storage.set for that case; retain coverage for storage.get with the storage capability.

HoiVu and others added 13 commits August 27, 2026 19:15
Open storage.get to sandboxed panels (panel: true). Panels can now
render data their worker wrote to plugin-private storage — read-only,
still capability-gated and session-token verified like the existing
panel actions.

Co-Authored-By: Claude <[email protected]>
- all host methods panel: true (panel can storage.set/delete/keys,
  secrets, settings, events.subscribe)
- capability gate disabled at the host-call chokepoint
- panel CSP allows loopback HTTP (worker-run local servers)
- worker idle-reap disabled (persistent workers)

Fork-only convenience; NOT for upstream.

Co-Authored-By: Claude <[email protected]>
- icon.png / icon-dev.png (dock + window, 256px)
- build/icon.png (packaged app icon, 1024px)
- app-icons variants (classic/watercolor/blue slots → HoiVu colorways)
- logo.svg wordmark (Landing, sidebar menu, settings)
- productName: HoiVu

Co-Authored-By: Claude <[email protected]>
- titlebar/crash/mobile/onboarding/statusbar translate() fallbacks: Orca → wakii
- productName: wakii
- logo.svg wordmark + regenerated W-monogram icons

Co-Authored-By: Claude <[email protected]>
- locales/components/productName/logo: wakii → Wakii
- dev-instance-identity BASE_APP_NAME: Orca → Wakii
  (window title, app menu About/Hide/Quit, dock title, 'Wakii Dev')

Co-Authored-By: Claude <[email protected]>
- LinearMode += 'stories'; tab option added
- Issue GraphQL selection += children { nodes { state.type } } (both
  issue query paths); mappers derive subIssueCount/completedSubIssueCount
- Stories table: title/state/team/subtask progress bar (done/total)/updated;
  row click opens the story in Linear
- Also includes fork-local linear:createCustomView RPC (main+ipc+preload)

Note: Linear IssueConnection has no totalCount; children.nodes.length used.

Co-Authored-By: Claude <[email protected]>
openLinearDetailPage(story) — same path as Issues rows; detail renders
over the list via the selectedLinearIssue branch.

Co-Authored-By: Claude <[email protected]>
… brackets/contexts directly

- Scoped to docs/superpowers/{brackets,contexts} of active workspace trees
- Panel autocomplete + bracket load now fs-direct (no worker storage round-trip)
- Path-traversal guarded (no .. or /)
- Also: typed createCustomView rawRequest (2 legacy tsc errors resolved)

Co-Authored-By: Claude <[email protected]>
setInterval cũ (refreshStoryList + loadStory, 15s) đọc story.snapshot
cũ của worker (FI-151) và renderBracket ghi đè bracket user đang xem.
Xóa interval + 2 setTimeout cùng bản chất trong Create handler.
Refresh duy nhất: storyTasks 8s (re-render đúng dataset.file) +
storyList 60s (chỉ dropdown, không vẽ).
- linear.ts/projects.ts: upstream đã có createCustomView đầy đủ (độc lập)
  → dùng bản upstream, bỏ bản duplicate của fork
- TaskPage.tsx: upstream extract TaskPageLayout — Stories render branches
  merge sạch tự động, chỉ layout wrapper conflict (lấy upstream + giữ stories)
- ui-chrome-types + VALID_LINEAR_MODES: thêm 'stories' (upstream hẹp hơn)
- attachment label fns: thêm vào libs (fork feature, upstream không có)
- typecheck node+web: 0 errors

Co-Authored-By: Claude <[email protected]>
- projects.ts: acquire/release từ linear-request-concurrency, clearToken từ
  linear-token-store (upstream tách module)
- task-resume-state-schema.ts: z.enum + 'stories' (parity-check bắt được!)
- 0 errors node; app boot OK; plugin + panel sống trên base mới

Co-Authored-By: Claude <[email protected]>
@VuHoi
VuHoi force-pushed the feat/panel-storage-get branch from 1d59492 to 0cdbce9 Compare August 30, 2026 16:21
@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

The pull request is substantially broader than its stated one-line storage.get change: it changes plugin authorization and panel networking, adds panel filesystem APIs, expands the Linear/task implementation, rebrands the packaged application, and replaces visual assets.

  • Expands nearly every plugin host API method to sandboxed panels and disables capability-consent enforcement at the common host-call boundary.
  • Adds workspace document reads, plan-progress discovery, and unrestricted loopback connections for plugin panels.
  • Consolidates and extends Linear IPC, project, issue, custom-view, and task-page functionality.
  • Renames the packaged product to Wakii and replaces application branding assets.

Confidence Score: 1/5

This pull request is not safe to merge until plugin capability enforcement is restored and the unintended panel access to protected secrets is removed.

The common plugin host-call chokepoint now bypasses capability consent, while the derived panel allowlist admits plaintext secret reads and credential mutations from sandboxed panel code.

Files Needing Attention: src/main/plugins/plugin-host-methods.ts and src/shared/plugins/plugin-host-api.ts

Security Review

Two security-boundary regressions were identified. The common plugin host-call path no longer enforces capability consent, and sandboxed panels are newly allowed to read, overwrite, and delete plugin secrets; the former permits unconsented privileged operations, while the latter moves plaintext credentials into the panel execution context.

Important Files Changed

Filename Overview
src/main/plugins/plugin-host-methods.ts Disables the central capability-consent gate, allowing enabled plugins to execute host methods regardless of granted capabilities.
src/shared/plugins/plugin-host-api.ts Adds panel filesystem methods and makes storage, secrets, settings, and event APIs panel-callable, far beyond the described storage.get change.
src/main/plugins/plugin-host-method-bindings.ts Adds workspace-wide filesystem and plan-progress operations and binds newly panel-callable secret and state mutations.
src/shared/plugins/plugin-panel-shell.ts Broadens panel CSP from no network access to arbitrary HTTP connections on every loopback port.
src/main/ipc/linear.ts Replaces modular Linear handler registration with a large consolidated IPC implementation and adds custom-view creation.
src/main/linear/projects.ts Replaces re-exports with a large fork-local Linear project and custom-view implementation.
src/renderer/src/components/TaskPage.tsx Substantially rewrites the task experience with thousands of lines of new Linear and workflow behavior.
config/electron-builder.config.cjs Renames the packaged product from Orca to Wakii, an unrelated externally visible packaging change.

Sequence Diagram

sequenceDiagram
  participant Panel as Sandboxed plugin panel
  participant Bridge as Panel bridge
  participant Host as executePluginHostCall
  participant Binding as Host method binding
  participant SecretStore as Plugin secret store
  Panel->>Bridge: secrets.get / set / delete
  Bridge->>Host: Validated panel action
  Note over Host: Capability gate disabled
  Host->>Binding: Execute with plugin identity
  Binding->>SecretStore: Read or mutate credential
  SecretStore-->>Binding: Plaintext value / mutation result
  Binding-->>Panel: Host-call response
Loading

Comments Outside Diff (1)

  1. src/shared/plugins/plugin-host-api.ts, line 252-281 (link)

    P1 security Panels gain secret-store access

    When a plugin has stored credentials, these changed flags admit secrets.get, secrets.set, and secrets.delete through the derived panel allowlist, allowing sandboxed panel JavaScript to retrieve plaintext credentials or overwrite and delete credentials used by the worker.

    How this was verified: The panel allowlist includes every specification marked panel: true, and the corresponding bindings return or mutate the plugin secret value.

    Knowledge Base Used: Desktop application platform

Reviews (1): Last reviewed commit: "fix: post-rebase — stale linear imports ..." | Re-trigger Greptile

Comment on lines +37 to 49
// FORK-LOCAL: capability gate disabled for this fork — every host method is
// granted to any enabled plugin. Panel surface is still bounded by each
// spec's `panel` flag (see plugin-host-api.ts). Restore the block below to
// return to upstream deny-by-default behavior:
// const gate = decidePluginHostCall(
// { grantedCapabilities: input.grantedCapabilities, viaPanel: input.viaPanel },
// input.method
// )
// if (!gate.granted) return { ok: false, code: gate.code, error: gate.error }
if (input.grantedCapabilities === null && !input.services) {
// keep the import + input shape referenced; unreachable in practice
void decidePluginHostCall
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 security Capability enforcement is disabled

When an enabled plugin invokes a host method whose capability is unapproved, denied, or stale, this common execution path skips gatePluginHostCall and executes the method anyway, allowing unconsented access to files, storage, secrets, settings, terminals, and other host operations.

How this was verified: The shared panel, worker, and relay execution path comments out the capability decision and proceeds directly to the bound handler.

Suggested change
// FORK-LOCAL: capability gate disabled for this fork — every host method is
// granted to any enabled plugin. Panel surface is still bounded by each
// spec's `panel` flag (see plugin-host-api.ts). Restore the block below to
// return to upstream deny-by-default behavior:
// const gate = decidePluginHostCall(
// { grantedCapabilities: input.grantedCapabilities, viaPanel: input.viaPanel },
// input.method
// )
// if (!gate.granted) return { ok: false, code: gate.code, error: gate.error }
if (input.grantedCapabilities === null && !input.services) {
// keep the import + input shape referenced; unreachable in practice
void decidePluginHostCall
}
const gate = decidePluginHostCall(
{ grantedCapabilities: input.grantedCapabilities, viaPanel: input.viaPanel },
input.method
)
if (!gate.granted) {
return { ok: false, code: gate.code, error: gate.error }
}

Knowledge Base Used: Desktop application platform

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