Skip to content

feat(auth): separate filesystem read and write permissions - #9788

Open
juliusmarminge wants to merge 14 commits into
t3code/auth-source-control-scopefrom
t3code/auth-filesystem-scopes
Open

feat(auth): separate filesystem read and write permissions#9788
juliusmarminge wants to merge 14 commits into
t3code/auth-source-control-scopefrom
t3code/auth-filesystem-scopes

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 4, 2026

Copy link
Copy Markdown
Member

Direct workspace reads and edits currently share task permissions, while viewing local diffs requires review:write. Add filesystem:read for browsing, searching, file previews, and local diffs, and filesystem:write for file edits and saving plans. Both scopes remain in the Standard preset so narrower credentials can opt out of direct filesystem access.

Host workspace/media asset URLs require filesystem read permission when minted; attachments and project artwork retain their existing authorization. Web, desktop, and mobile controls follow each environment's grant. Losing write access stops pending autosaves and preserves unsaved drafts across closing and reopening the preview; an older editor's completed write cannot clear a newer draft's pending marker. Draft retention is released after confirmation or explicit clearing.

Retire review:write from new grants and the permission picker while keeping old credentials decodable. Existing connections must be paired again to receive filesystem scopes. These scopes govern direct client actions; they do not sandbox provider processes or terminal commands.

Validation: 17 filesystem access/browse tests, draft-retention regressions, and web/mobile typechecks pass. Offline file views distinguish connection failure from a pending permission check.

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

Before After
Before: pairing permissions After: filesystem permissions

Model: GPT-6. Harness: Codex.


Note

High Risk
Changes authentication and authorization for filesystem and asset access across server and all clients; misconfiguration or incomplete client updates could block file features or leave unexpected access until re-pairing.

Overview
Introduces filesystem:read and filesystem:write OAuth scopes and moves host file operations off broad orchestration/review grants. The server now requires filesystem read for listing, reading, searching, browsing, review diffs, and workspace/media asset URLs; filesystem write for projectsWriteFile. review:write is removed from new grants and pairing (AuthGrantScope) but still decodes on old sessions.

Web, mobile, and shared client runtime gate browse/search/preview, local git review sections, composer path search, and asset URL minting on filesystem:read; plan save and file edits need filesystem:write. Mobile and web file UIs use resolveFilesystemReadAccess for loading vs clear “cannot read host files” states. Read-only connections skip autosave, show read-only banners, and retain unsaved drafts until write access returns (with coordinator/query-state fixes so stale writes don’t clear newer edits).

Pairing settings and docs describe the new scopes; standard client defaults include both filesystem scopes. Server tests cover scope enforcement for RPC and assets.

Reviewed by Cursor Bugbot for commit 4b73b2d. 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
@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.6 KiB 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.6 KiB 7.8 KiB
Codex Live turn WebSocket decoded 57.1 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.5 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: 4b73b2d · 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/mobile/src/features/review/useReviewSections.ts
@juliusmarminge juliusmarminge changed the title t3code/auth filesystem scopes feat(auth): separate filesystem read and write permissions Sep 4, 2026
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-filesystem-scopes branch from c80d93e to 3b96a67 Compare September 4, 2026 21:18
@juliusmarminge
juliusmarminge marked this pull request as ready for review September 4, 2026 21:20
Comment thread apps/web/src/assets/assetUrls.ts
Comment thread apps/mobile/src/features/threads/new-task-flow-provider.tsx
@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 model and default grants for filesystem reads and writes, then propagates those permissions through server RPCs and numerous web/mobile file-access paths. The security-sensitive scope migration and changed defaults warrant human review despite the accompanying tests and documentation.

No code changes detected at 4b73b2d. Prior analysis still applies.

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

@juliusmarminge
juliusmarminge force-pushed the t3code/auth-filesystem-scopes branch from 3b96a67 to fb4489d Compare September 4, 2026 21:36
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-filesystem-scopes branch from fb4489d to d7df773 Compare September 4, 2026 21:38
Comment thread apps/web/src/components/DiffPanel.tsx
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-filesystem-scopes branch from bfb151c to eec5dfb Compare September 4, 2026 21:48
Comment thread apps/web/src/components/files/FilePreviewPanel.tsx
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Sep 4, 2026
Comment thread apps/web/src/components/files/FilePreviewPanel.tsx

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

Stale Bugbot comment from a previous run.

Comment thread packages/client-runtime/src/state/filesystem.ts
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-filesystem-scopes branch from 38e8814 to 4b73b2d Compare September 4, 2026 22:59

@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 2 potential issues.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 4b73b2d. Configure here.

return (
<>
<SectionTitle>Browse folders</SectionTitle>
{!canReadFiles ? <ErrorBanner message="This connection cannot browse host folders." /> : null}

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.

Pending grant shown as file denial

Medium Severity

useEnvironmentScope is false while the session is still unresolved, and these surfaces treat that as a confirmed missing filesystem:read grant. The add-project folder picker shows This connection cannot browse host folders before the grant is known, and composer path search returns the same kind of denial instead of staying pending.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b73b2d. Configure here.

explicitMode: selectedProjectDraft.workspaceSelection?.mode,
projectSetting: selectedProject?.defaultThreadEnvMode,
projectFilePending: t3ProjectFileQuery.isPending,
projectFilePermissionPending: fileAccessPending,

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.

Offline new-task permission never settles

Medium Severity

fileAccessPending stays true whenever session data and error are both empty. On an offline or unavailable environment that never completes /api/auth/session, default workspace mode never settles, so the auto-branch effect cannot write a default branch.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b73b2d. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 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