Skip to content

feat(auth): separate browser preview control permissions - #9789

Open
juliusmarminge wants to merge 7 commits into
t3code/auth-filesystem-scopesfrom
t3code/auth-preview-scope
Open

feat(auth): separate browser preview control permissions#9789
juliusmarminge wants to merge 7 commits into
t3code/auth-filesystem-scopesfrom
t3code/auth-preview-scope

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 4, 2026

Copy link
Copy Markdown
Member

Browser preview control and desktop automation hosting currently share orchestration:operate, so clients cannot receive orchestration access without those permissions.

Add preview:operate for preview mutations and automation hosting, with matching pairing controls and desktop UI guards. Preview lists, events, and discovered-server reads retain orchestration:read. The new scope is included in newly issued standard grants; existing clients must pair again to receive it. Provider MCP preview permissions remain independent.

Tests added cover the RPC scope mapping and real WebSocket requests: the old orchestration grant cannot refresh a preview or connect an automation stream, the rejected refresh never reaches its handler, and the explicit preview grant allows both operations.

Pairing controls, captured from this layer’s base and head with the same viewport and default selection:

Before After
Before: pairing permissions After: preview permissions

The existing Markdown and workspace-image suites pass with explicit scope fixtures.

Model: GPT-6. Harness: Codex.


Note

Medium Risk
Authorization and pairing changes affect a broad set of preview RPCs and UI entry points; misconfiguration or stale grants could block preview control for existing clients until re-pairing.

Overview
Introduces preview:operate so browser preview control and automation no longer ride on orchestration:operate. Preview mutations and automation RPCs (previewOpen, refresh/close, automation connect/respond, etc.) now require the new scope; listing previews, preview event subscriptions, and discovered local servers stay on orchestration:read. The scope is part of AuthStandardClientScopes for newly issued grants and appears as a “Control previews” pairing option in connections settings.

Server and client behavior enforce the split: integration tests assert tokens with only legacy orchestration scopes cannot refresh previews or open automation streams (handlers are not invoked), while tokens that include preview:operate succeed. The web/desktop UI gates preview webviews, automation hosts, panel toggles, markdown/file “open in browser”, terminal link handling, sidebar localhost shortcuts, and global preview keybindings on useEnvironmentScope / readEnvironmentScope, with clearer copy when preview control is missing.

Breaking change for existing pairings: clients that were granted orchestration operate but not re-paired will lose preview control until they receive preview:operate (they can still observe preview state where reads remain allowed).

Reviewed by Cursor Bugbot for commit 3010281. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Separate browser preview control into dedicated preview:operate scope

  • Introduces preview:operate as a new authentication scope in auth.ts and adds it to AuthStandardClientScopes
  • Moves preview open, navigation, resize, refresh, close, status, and automation RPCs from orchestration:operate to preview:operate in RpcAuthorization.ts; preview listing and subscriptions remain on orchestration:read
  • Gates all client preview surfaces on the new scope: ChatView preview panel, ElectronBrowserHost webviews, PreviewAutomationHosts, PreviewPanel, sidebar discovered-port buttons, file preview browser action, terminal link opening, and chat shortcuts
  • Adds a selectable "Control previews" pairing grant in ConnectionsSettings.tsx
  • Fixes command palette to display browse-access errors separately from browse query errors in CommandPalette.tsx
  • Behavioral Change: existing clients without preview:operate lose access to preview controls, automation, and in-app preview opening; they can still list previews and close an already open preview panel

Macroscope summarized 3010281.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 4, 2026
@juliusmarminge juliusmarminge changed the title t3code/auth preview scope feat(auth): separate browser preview control permissions Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 7.8 KiB
Codex Live turn WebSocket decoded 57.0 KiB 66.4 KiB
Codex Live turn messages 8 21
Claude Total thread wire 13.8 KiB 15.1 KiB
Claude Thread snapshot wire 7.0 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.7 KiB 7.8 KiB
Claude Live turn WebSocket decoded 59.3 KiB 66.4 KiB
Claude Live turn messages 10 21

Baseline: unavailable · PR result: 3010281 · Source CI: failure

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.8 KiB
  • Claude decoded thread snapshot: 114.5 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Comment thread apps/web/src/components/ChatView.tsx
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch from d160889 to 42df7cc Compare September 4, 2026 21:18
@juliusmarminge
juliusmarminge marked this pull request as ready for review September 4, 2026 21:20
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR changes the authorization boundary for browser preview control and automation across server RPCs, default pairing grants, and many production UI entry points. Newly issued standard credentials gain a new permission while existing clients may lose control until re-pairing, making human review appropriate.

No code changes detected at 3010281. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch from 42df7cc to a0f863c Compare September 4, 2026 21:36
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch 2 times, most recently from c9eadea to de4245a Compare September 4, 2026 21:40
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch 3 times, most recently from dd9548a to ccf9440 Compare September 4, 2026 22:00

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but a cloud agent failed to start.

Reviewed by Cursor Bugbot for commit ccf9440. Configure here.

Comment thread apps/web/src/components/settings/ConnectionsSettings.tsx
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch 2 times, most recently from b92e97b to 0986fc3 Compare September 4, 2026 22:15
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch 2 times, most recently from 4d49a52 to 6fed38f Compare September 4, 2026 23:52
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch from 6fed38f to 9dffc86 Compare September 5, 2026 00:08
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch from 9dffc86 to 40ee856 Compare September 5, 2026 00:10
Comment thread apps/web/src/routes/_chat.tsx Outdated
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch 2 times, most recently from 4f4d4b8 to afe8634 Compare September 5, 2026 00:38
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch 2 times, most recently from a7ccb0a to 1486119 Compare September 5, 2026 01:39
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch from 1486119 to 80eaa36 Compare September 5, 2026 02:52
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-preview-scope branch from 80eaa36 to 3010281 Compare September 5, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant