Skip to content

fix(browser): stop auto-approving Browser2 media/display-capture#512

Open
shaun0927 wants to merge 1 commit intorowboatlabs:devfrom
shaun0927:fix/browser2-media-permissions
Open

fix(browser): stop auto-approving Browser2 media/display-capture#512
shaun0927 wants to merge 1 commit intorowboatlabs:devfrom
shaun0927:fix/browser2-media-permissions

Conversation

@shaun0927
Copy link
Copy Markdown

@shaun0927 shaun0927 commented Apr 17, 2026

Summary

This is a narrow follow-up to #507.

Browser2 tabs currently inherit the app-wide media / display-capture auto-approval path. That means embedded pages can receive automatic capture approval instead of going through an explicit consent boundary.

This patch keeps the existing app session behavior intact, but narrows the Browser2 session to clipboard-only permissions and returns an empty display-media response there.

Related issues

Changes

  • apps/x/apps/main/src/main.ts
    • split the previous shared permission allowlist into APP_SESSION_PERMISSIONS and BROWSER_SESSION_PERMISSIONS
    • parameterize configureSessionPermissions() so different sessions can have different permission policies
    • keep app-level capture behavior unchanged
    • stop auto-approving media / display-capture for session.fromPartition(BROWSER_PARTITION)
    • return {} from the display-media handler when the session does not explicitly allow display-capture

Why this scope

I kept the patch intentionally small so it only restores an explicit consent boundary for Browser2. If Browser2 later needs capture features, a separate user-facing approval flow can be layered on top without widening the shared allowlist again.

Testing

  1. cd apps/x && pnpm install && pnpm run deps
  2. cd apps/main && npm run build
  3. Re-ran the source-backed permission validation against the patched branch:
{
  "browserAllowed": ["clipboard-read", "clipboard-sanitized-write"],
  "browserMediaCheckAllowed": false,
  "browserDisplayCheckAllowed": false,
  "browserMediaRequestAllowed": false,
  "browserDisplayRequestAllowed": false,
  "browserDisplayResponse": {}
}

…missions

Browser2 tabs should not inherit the app-wide media/display-capture auto-approval path. This change keeps the default session behavior intact while narrowing the embedded browser session to clipboard-only permissions and denying automatic display-source selection there.

Constraint: Browser2 work is currently flowing through the dev branch and needs a minimal, low-risk patch
Rejected: Remove session permission handling entirely | could break existing app-level capture flows outside Browser2
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If Browser2 later needs media or display capture, add an explicit per-origin/user approval flow instead of widening the shared allowlist
Tested: pnpm install; pnpm run deps; apps/main npm run build; source-backed permission validation JSON
Not-tested: Manual interactive Electron permission prompt UX
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