Skip to content

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

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

feat(auth): separate browser preview control permissions#9789
juliusmarminge wants to merge 6 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
Changes authorization for preview RPCs and standard client grants; existing paired clients lack the new scope until they re-pair, and misconfigured grants could block preview while leaving orchestration working.

Overview
Introduces preview:operate so browser preview mutations and automation hosting are no longer tied to orchestration:operate. Preview read paths (previewList, preview event subscriptions, discovered local servers) stay on orchestration:read.

Server RPC scope mapping and a WebSocket integration test enforce the split: tokens with only orchestration scopes can list previews but get EnvironmentAuthorizationError on refresh and automation connect; adding preview:operate allows those calls.

The scope is registered in contracts, included in AuthStandardClientScopes for newly issued grants, and exposed in Connections pairing UI. The desktop/web client gates preview surfaces (Electron webviews, automation hosts, markdown/file links, sidebar port shortcuts, keyboard shortcuts, right panel) via useEnvironmentScope / readEnvironmentScope so read-only orchestration clients do not mount or invoke preview control.

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

@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.8 KiB 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.7 KiB 7.8 KiB
Codex Live turn WebSocket decoded 58.5 KiB 66.4 KiB
Codex Live turn messages 10 21
Claude Total thread wire 13.6 KiB 15.1 KiB
Claude Thread snapshot wire 7.0 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 7.8 KiB
Claude Live turn WebSocket decoded 57.9 KiB 66.4 KiB
Claude Live turn messages 10 21

Baseline: unavailable · PR result: 4d49a52 · Source CI: success

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 4d49a52. 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 from 0986fc3 to 4d49a52 Compare September 4, 2026 22:59
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