Repository navigation
Refuse main-window permission requests from plugin frames - #36812
Conversation
Plugin srcdoc frames share the main window's session, so a plugin could ask for camera, microphone, fullscreen or pointer lock with the app's trust. Requests from a frame registered as a plugin frame at creation, or nested in one, are now refused. Chat visuals and other host frames keep their permissions.
Findings
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Major · Apply the plugin policy to permission checks. · attach-main-window-services.ts:160
src/main/window/attach-main-window-services.ts:160
Major · Security & Privacy · Heavy lift Apply the plugin policy to permission checks.
The check handler still grants
fullscreenandpointerLockto every frame, and can grantmediawhen system media access is available. Electron 43.8.4 requires both permission handlers for complete handling. A plugin frame can therefore pass this check without reaching the request handler.The existing
isPluginFramePermissionRequesthelper cannot be reused directly here. Electron providesrequestingUrlandisMainFrame, but not the frame object or its parent chain. Add a frame-attribution mechanism that preserves the registered-plugin and nested-frame policy before returning the allowed-permission result. Do not identify the plugin frame from the top-levelWebContentsalone.

Review info
-
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:
f5f46a29-d498-4a41-b014-3f2940c7586a
Files selected for processing: 4-
src/main/window/attach-main-window-services.tssrc/main/window/host-frame-navigation-guard.tssrc/main/window/host-frame-permission-policy.test.tssrc/main/window/host-frame-permission-policy.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
|
|
||
| type MainWindowPermissionRequest = { | ||
| isMainFrame?: boolean | ||
| requestingFrame?: PermissionFrame | null |
There was a problem hiding this comment.
Use a frame identity that Electron supplies.
Electron 43.8.4 does not put requestingFrame in permission-request details. Its request code supplies requestingUrl and isMainFrame instead. Consequently, this classifier starts with null for an ordinary plugin permission request and returns false. The new handler then follows its existing allow path for media, fullscreen, or pointerLock. Replace the invented field with a verified way to associate requests with registered frames. The tests must exercise Electron-shaped details. (raw.githubusercontent.com)
| } | ||
| let frame = details.requestingFrame ?? null | ||
| // Bounded walk: frame trees are shallow, and a detached frame throws on access. | ||
| for (let depth = 0; frame && depth < 32; depth += 1) { |
There was a problem hiding this comment.
Do not allow a depth limit to change a denial into an approval.
If a requesting frame has 32 unregistered ancestors before its registered plugin ancestor, this loop ends before it checks the plugin ancestor. The classifier returns false, so the permission handler can allow the request. The policy promises to cover nested plugin frames. Walk to the root, or deny when a safety limit prevents classification. Add a boundary test. (raw.githubusercontent.com)
ELI5
Plugin panels in Orca run inside the main window. Until now, a plugin panel could ask the browser engine for camera, microphone, fullscreen or pointer lock, and Orca answered as if Orca itself had asked. This PR makes Orca say no to any such request that comes from a plugin frame.
What Changed
srcdociframe in the main window) callinggetUserMedia,requestFullscreenorrequestPointerLockwent through the main window's permission handler. That handler allowsmedia,fullscreenandpointerLock, and formediait can even trigger the macOS camera/microphone prompt on Orca's behalf.HostFrameNavigationRegistryalready classifies host-createdsrcdocframes by name when they are created. It now also records that classification in a module-levelWeakMap, exposed ashostFrameKindOf(frame). The newisPluginFramePermissionRequestwalks the requesting frame's ancestors (bounded to 32 levels, safe against detached frames) and returns true for theplugin-panelkind. The main window's permission request handler checks it first.Why
window.nameafter load, so checking the current name would let a plugin opt out. The registry records the kind before plugin code runs.srcdoc/null-origin frame: I tried that first. It also breaks chat visuals (a sandboxedsrcdocframe that legitimately uses fullscreen), so the check is narrowed to plugin frames.Linked Issue
N/A (maintainer change; first PR of the plugin isolation stack).
Visual Proof
N/A: no UI change. A plugin's denied permission request looks the same as any other denied request (the plugin's promise rejects).
Testing
host-frame-permission-policy.test.ts: refuses plugin frames and frames nested in them, ignores the main frame and other host frame kinds, and survives a frame that throws on access.Existing
host-frame-navigation-guardtests pass.pnpm tc:nodepasses.Tested on macOS only. The change has no platform-specific logic.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Part of a stack (merge in order):
Agent skill upstream boundary
Notes
requestFullscreen); the worst case is that a fullscreen request does nothing.WeakMaplookup per permission request.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)