Skip to content

Isolated plugin frames, off by default - #36813

Merged
nwparker merged 1 commit into
mainfrom
nwparker/plugin-isolated-frames
Nov 1, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/plugin-isolated-frames

Conversation

@nwparker

@nwparker nwparker commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3550 $\color{#cf222e}{\Huge{\mathbf{−}}}$​321 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3229
Prod 77 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3392 $\color{#cf222e}{\Huge{\mathbf{−}}}$​346 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3046

ELI5

Today a plugin's panel or custom editor runs as a page inside Orca's own window. It shares Orca's browser session, and the only thing stopping it from reaching the internet is a content-security header. This PR adds a second way to run plugin pages: each plugin gets its own sealed-off browser view, with its own process and storage, where network access is blocked by the session itself. Plugins also get real files (scripts, workers, WebAssembly, images) instead of one giant inlined HTML page.

It ships switched off. With the switch off, nothing changes for anyone. A later one-line PR turns it on.

What Changed

With the switch off (the default after this PR): plugin frames stay the srcdoc iframe they are today. The new APIs below are not offered (orca.shell and orca.files are undefined, and orca.host.has() returns false for them).

With the switch on (ORCA_PLUGIN_ISOLATED_FRAMES=1, or the experimentalPluginIsolatedFrames setting), on the desktop app:

  • Sealed-off view per plugin. Each plugin's panels and custom editors run in an Electron <webview> on partition persist:orca-plugin-<key>, where <key> is a hash of the plugin id. That gives each plugin its own renderer process, cookies, localStorage and IndexedDB.
  • Real files. Pages load from a new privileged scheme, orca-plugin-frame://<key>/…. It serves files from the plugin folder only, with the same path containment and content-integrity checks Orca already uses for entries.
    • Scripts, styles, documents, JSON, SVG and WASM are served only if their bytes still match the hash recorded when the plugin tree was checked.
    • Images, fonts and media stream from disk, including single Range requests.
  • Network blocked at the session, not just by CSP:
    • a webRequest allowlist (only the plugin's own origin, data:, blob:);
    • a proxy that refuses every connection, including loopback;
    • WebRTC limited to proxied UDP;
    • every permission and device chooser denied;
    • downloads, popups and off-origin navigation cancelled;
    • native alert/confirm dialogs disabled.
  • Same plugin API. The page gets the same window.orca script the iframe gets; only the transport differs (ipcRenderer.sendToHost from a sandboxed preload). Message validation, budgets, sessions and capability checks are unchanged.
  • Orca still feels like Orca inside a plugin:
    • Orca's window shortcuts work while a plugin has focus (reusing the browser tab's shortcut forwarding);
    • right-click gives Cut/Copy/Paste;
    • the theme is baked into the first paint, so there is no white flash;
    • a plugin update or a dev edit reloads the view.
  • Two new APIs, guest only, each needing a fresh real click in the plugin (one click allows one call):
    • orca.shell.openExternal(url) opens http, https and mailto links only, and resolves { opened }. Before opening a web host this plugin hasn't been allowed, Orca asks: " wants to open ", with Open / Cancel and "Always allow this host".
    • orca.files.saveAs({ suggestedName, mimeType, data }) shows Orca's save dialog and resolves { status: 'saved' | 'cancelled' }. The plugin never sees the path. Dangerous file types (executables, scripts, shortcuts, disk images) are refused, and saved files get the OS "downloaded" mark (Mark of the Web on Windows, quarantine on macOS).
    • orca.locale exposes Orca's UI language.
  • Uninstall, disable and the kill list close the plugin's live views. Uninstall and the kill list also wipe the plugin's storage.
  • Clients without <webview> keep the iframe: the browser and serve clients, plus mobile, which has no panels.

Why

  • The iframe can't be fixed in place. Plugins report that real editors (Excalidraw is the example in this stack) need workers, WebAssembly, storage and multiple files. The opaque-origin iframe forces authors to inline and shim all of that, which is why plugin code looks the way it does. Its only network barrier is CSP, so a nested frame's RTCPeerConnection or DNS prefetch can still get out.
  • Why a <webview> per plugin rather than a sandboxed iframe on a custom origin: only a separate session gives a separate network stack (proxy, webRequest), separate storage and a separate process. An iframe shares the main window's session.
  • Why session-level blocking rather than more CSP: CSP doesn't cover WebRTC or prefetch, and plugins control their own documents.
  • DNS prefetch is closed too. Electron resolves <link rel="dns-prefetch"> hostnames outside both the proxy and webRequest, so each guest also runs with DNS prefetching disabled. The egress test asserts no resolver lookups. The only way data leaves is a URL the person agrees to open.
  • Why off by default: this replaces how every plugin frame runs. Shipping it dark lets us run it in dev and e2e, then flip one constant; rolling back is reverting that one line. With isolation on, a view that cannot be set up fails closed. It never silently falls back to the weaker iframe.

Linked Issue

N/A (maintainer change).

Visual Proof

Nothing changes by default (switch off). With the switch on, panels and editors look the same as today. The screenshots below are with ORCA_PLUGIN_ISOLATED_FRAMES=1: Excalidraw 2.0 running as a multi-file app in an isolated view, with export through Orca's save dialog.

Isolation off (default): unchanged, 1.x single-file editor in the iframe Isolation on: multi-file editor with Save to… / Export image… / Library
(screenshot removed: contained real product data) (screenshot removed: contained real product data)

(screenshot removed: contained real product data)

Testing

  • Unit:

    • protocol: containment, the __orca reservation, trailing dot/space refusal, Range, streaming, the in-flight cap and per-file digests;
    • session policies, admission (will-attach-webview) and the guest preload transport and send caps;
    • frame host lanes and gestures, desktop services (saveAs extensions, rate limits, per-window parent), the switch, and shortcut forwarding for guests.
  • Electron: plugin-frame-guest-egress.electron.test.ts counts TCP connections to a local listener from fetch, WebSocket, sendBeacon, a Worker, a SharedWorker and WebRTC TURN, and asserts 0. It also pins the DNS-prefetch residual.

  • e2e:

    • the six guest-path plugin specs run with ORCA_PLUGIN_ISOLATED_FRAMES=1 (demo, custom editor, new file, try-it, containment, isolated frame);
    • a new spec proves the default path still uses the srcdoc iframe with no gesture APIs;
    • the plugin specs passed 11/11, twice, on a fresh build (macOS).
  • Quality gates: pnpm tc and check:code-quality:changed pass.

  • Platforms: macOS only. Linux/Windows run in CI. The containment spec stays experimental until CI has soaked it on every desktop platform.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Stack (merge in order):

  1. Refuse plugin-frame permission requests.
  2. This PR: isolated plugin frames, off by default.
  3. Components (TSX) plugin panels #36814 Components (TSX) panels.
  4. Build-less TS/TSX plugins, typings and authoring tools #36918 Build-less TS/TSX, typings and authoring tools.
  5. Turn isolated plugin frames on by default #36821 Turn isolation on by default (one line; depends only on Isolated plugin frames, off by default #36813).

Reviewed adversarially before opening: security, regressions, and an independent second model. Fixed as a result:

  • Shortcuts and input: shortcuts in focused guests, the context menu, theme flash, and reload on update.
  • Resource and integrity hardening: protocol memory use (streaming plus an in-flight cap), the integrity time-of-check gap (per-file digests), the preload send caps, and the session map cleanup.
  • New-API limits: executable saveAs types, and no clipboard writes (same as the iframe today).
  • Remaining: native dialogs, device choosers, extensionless HTML entries, the __orca alias on Windows, and per-window dialog parenting.

Second, holistic review before merge (whole plugin system, plus a reference comparison and an independent model). Fixed in this PR:

  • Calls and gestures:
    • One real click now allows exactly one gesture call; the preload counts trusted input in the isolated world.
    • A custom editor's save shortcut is only honoured from trusted key presses, so a plugin can't fake Cmd/Ctrl+S.
    • Disabling, uninstalling or kill-listing a plugin now stops calls already in flight, right before their side effect: no write after an open save dialog, no link opened.
    • Calls that are too big or rate-limited fail right away instead of hanging, and every call has a deadline.
    • Dialogs and rate limits belong to the window that made the call.
  • Panel lifecycle:
    • A plugin refresh no longer closes every open plugin view, and a view that main closes remounts.
    • Dev plugins reload on every file change. A watcher-driven counter replaces a whole-folder hash, which failed on folders with node_modules.
  • Settings and isolation hardening:
    • Guest settings are built from an allowlist.
    • The kill list also wipes storage from earlier runs.
    • Clipboard behaviour is pinned by an Electron test: the async Clipboard API is refused, and execCommand('copy') works only inside a click.
  • Fixes to code already on main:
    • Uninstall clears consent before deleting files, and lockfile recovery drops entries with no folder.
    • Plugin secrets refuse to store on Linux without a real keyring. New secrets.protection().
    • Retiring a bundled plugin clears its settings.

The design contract is docs/reference/plugin-isolated-frames.md.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: with the switch on, plugins lose network, shared storage and the main window's session, and gain two click-gated APIs with no new capability. No known way out: no connections, requests or DNS lookups; openExternal asks before opening a new host.
  • Cross-platform:
    • paths go through the existing containment code; segments ending in a dot or space are refused for Windows;
    • shortcut labels and chords reuse the browser tab path, so Cmd and Ctrl are both handled.
  • SSH: plugin frames always render on the local desktop; nothing runs on the remote host.
  • Mobile: no panels there.
  • Mixed versions:
    • new PluginFrameEntry fields are optional;
    • paired and web clients calling the new methods get not_permitted;
    • hello reports API minor 0 to iframe clients, so feature detection is honest.
  • Performance:
    • with the switch on, each open plugin costs a renderer process;
    • the guest path skips the srcdoc read, hash and IPC transfer, so each open runs one integrity check, not two;
    • the switch off costs nothing beyond registering one scheme.

Checklist

  • This PR is small and focused (large but inert by default; split from declarative panels and the default flip)
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@nwparker
nwparker force-pushed the nwparker/plugin-isolated-frames branch from 68f260f to ec98578 Compare November 1, 2026 07:32
@nwparker
nwparker changed the base branch from nwparker/plugin-frame-permission-policy to main November 1, 2026 07:32
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0c8bb46-77a1-468c-ae21-07d78d692946
Commits

Reviewing files that changed from the base of the PR and between 25a8418 and ec98578.

Files selected for processing: 121
  • config/build-plugins/main-build-entry-points.ts
  • config/knip.json
  • config/scripts/pr-plugin-e2e-source-routes.mjs
  • docs/reference/plugin-authoring.md
  • docs/reference/plugin-host-api.md
  • docs/reference/plugin-isolated-frames.md
  • examples/plugins/hostile-panel/panel.html
  • src/main/browser/browser-guest-shortcut-dispatch.ts
  • src/main/browser/browser-guest-shortcut-forwarding.ts
  • src/main/browser/browser-guest-shortcut-plugin-frame.test.ts
  • src/main/host/electron-secret-store.ts
  • src/main/ipc/plugin-frame-entry-ipc.ts
  • src/main/ipc/plugins-panel-document-lifetime.test.ts
  • src/main/ipc/plugins.ts
  • src/main/ipc/settings.ts
  • src/main/plugins/installation/plugin-install-provenance.ts
  • src/main/plugins/installation/plugin-install.test.ts
  • src/main/plugins/installation/plugin-removal.ts
  • src/main/plugins/panels/plugin-external-open-consent.test.ts
  • src/main/plugins/panels/plugin-external-open-consent.ts
  • src/main/plugins/panels/plugin-frame-desktop-services.test.ts
  • src/main/plugins/panels/plugin-frame-desktop-services.ts
  • src/main/plugins/panels/plugin-frame-guest-clipboard.electron.test.ts
  • src/main/plugins/panels/plugin-frame-guest-egress.electron.test.ts
  • src/main/plugins/panels/plugin-frame-guest-policies.test.ts
  • src/main/plugins/panels/plugin-frame-guest-policies.ts
  • src/main/plugins/panels/plugin-frame-guest-registry.ts
  • src/main/plugins/panels/plugin-frame-guest-sessions.test.ts
  • src/main/plugins/panels/plugin-frame-guest-sessions.ts
  • src/main/plugins/panels/plugin-frame-integrity.test.ts
  • src/main/plugins/panels/plugin-frame-integrity.ts
  • src/main/plugins/panels/plugin-frame-isolation.test.ts
  • src/main/plugins/panels/plugin-frame-isolation.ts
  • src/main/plugins/panels/plugin-frame-protocol.test.ts
  • src/main/plugins/panels/plugin-frame-protocol.ts
  • src/main/plugins/panels/plugin-frame-request-policy.test.ts
  • src/main/plugins/panels/plugin-frame-request-policy.ts
  • src/main/plugins/panels/plugin-frame-responses.ts
  • src/main/plugins/panels/plugin-frame-scheme.ts
  • src/main/plugins/panels/plugin-frame-session-policies.test.ts
  • src/main/plugins/panels/plugin-frame-session-policies.ts
  • src/main/plugins/panels/plugin-frame-theme-snapshot.ts
  • src/main/plugins/panels/plugin-panel-controller.test.ts
  • src/main/plugins/panels/plugin-panel-controller.ts
  • src/main/plugins/panels/plugin-panel-sessions.ts
  • src/main/plugins/panels/plugin-panel-webrtc.electron.test.ts
  • src/main/plugins/panels/plugin-save-as-download-mark.test.ts
  • src/main/plugins/panels/plugin-save-as-download-mark.ts
  • src/main/plugins/plugin-bundled-bootstrap-coordinator.test.ts
  • src/main/plugins/plugin-bundled-bootstrap-coordinator.ts
  • src/main/plugins/plugin-bundled-bootstrap.test.ts
  • src/main/plugins/plugin-bundled-bootstrap.ts
  • src/main/plugins/plugin-content-hash.ts
  • src/main/plugins/plugin-dev-revision.test.ts
  • src/main/plugins/plugin-dev-revision.ts
  • src/main/plugins/plugin-dev-watcher.ts
  • src/main/plugins/plugin-host-call-revocation.test.ts
  • src/main/plugins/plugin-removal-settings.test.ts
  • src/main/plugins/plugin-removal-settings.ts
  • src/main/plugins/plugin-secrets-store.test.ts
  • src/main/plugins/plugin-secrets-store.ts
  • src/main/plugins/plugin-service-host-call.ts
  • src/main/plugins/plugin-service-options.ts
  • src/main/plugins/plugin-service.ts
  • src/main/plugins/plugin-uninstall-lifecycle.test.ts
  • src/main/plugins/plugin-uninstall-log-retention.test.ts
  • src/main/plugins/workers/plugin-host-call-adapter.ts
  • src/main/plugins/workers/plugin-host-call-scope.ts
  • src/main/plugins/workers/plugin-host-method-bindings.ts
  • src/main/plugins/workers/plugin-host-methods.test.ts
  • src/main/plugins/workers/plugin-host-methods.ts
  • src/main/plugins/workers/plugin-host-service-bindings.ts
  • src/main/startup/main-process-plugins.ts
  • src/main/startup/privileged-custom-schemes.ts
  • src/main/window/attach-main-window-services.ts
  • src/main/window/main-window-webview-security.test.ts
  • src/main/window/main-window-webview-security.ts
  • src/preload/api/plugin-host-api.ts
  • src/preload/api/plugins-bridge.ts
  • src/preload/plugin-frame-guest-send-budget.ts
  • src/preload/plugin-frame-guest-transport.ts
  • src/preload/plugin-frame-guest.test.ts
  • src/preload/plugin-frame-guest.ts
  • src/renderer/src/components/editor/PluginBytesCustomEditorSurface.test.tsx
  • src/renderer/src/components/editor/PluginCustomEditorFrame.test.tsx
  • src/renderer/src/components/editor/PluginCustomEditorFrame.tsx
  • src/renderer/src/components/editor/plugin-custom-editor-host.test.ts
  • src/renderer/src/components/editor/plugin-custom-editor-host.ts
  • src/renderer/src/components/right-sidebar/PluginPanel.test.tsx
  • src/renderer/src/components/right-sidebar/PluginPanel.tsx
  • src/renderer/src/components/right-sidebar/plugin-frame-element.tsx
  • src/renderer/src/components/right-sidebar/plugin-frame-host-lanes.ts
  • src/renderer/src/components/right-sidebar/plugin-frame-host.test.ts
  • src/renderer/src/components/right-sidebar/plugin-frame-host.ts
  • src/renderer/src/components/right-sidebar/plugin-panel-design-token-css.ts
  • src/renderer/src/components/right-sidebar/use-plugin-frame-entry.ts
  • src/renderer/src/components/right-sidebar/use-plugin-frame-host.ts
  • src/renderer/src/components/right-sidebar/use-plugin-panel-theme-revision.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/global-settings-types.ts
  • src/shared/plugins/capabilities/plugin-capability-gate.ts
  • src/shared/plugins/frames/plugin-frame-api.test.ts
  • src/shared/plugins/frames/plugin-frame-bridge.ts
  • src/shared/plugins/frames/plugin-frame-guest.test.ts
  • src/shared/plugins/frames/plugin-frame-guest.ts
  • src/shared/plugins/frames/plugin-panel-shell.test.ts
  • src/shared/plugins/frames/plugin-panel-shell.ts
  • src/shared/plugins/frames/plugin-save-as-extensions.test.ts
  • src/shared/plugins/frames/plugin-save-as-extensions.ts
  • src/shared/plugins/languages/protected-copy-keys.json
  • src/shared/plugins/plugin-system-settings.ts
  • src/shared/plugins/workers/plugin-host-api-reference-doc.ts
  • src/shared/plugins/workers/plugin-host-api-storage-schemas.ts
  • src/shared/plugins/workers/plugin-host-api.ts
  • tests/e2e/helpers/plugin-frame-guest.ts
  • tests/e2e/plugin-custom-editor.spec.ts
  • tests/e2e/plugin-demo.spec.ts
  • tests/e2e/plugin-isolated-frame.spec.ts
  • tests/e2e/plugin-new-file.spec.ts
  • tests/e2e/plugin-panel-containment.spec.ts
  • tests/e2e/plugin-try-it.spec.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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.

1 participant