feat(auth): separate filesystem read and write permissions - #9788
feat(auth): separate filesystem read and write permissions#9788juliusmarminge wants to merge 18 commits into
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 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.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
c80d93e to
3b96a67
Compare
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR is a broad authorization redesign that changes server scope enforcement, default client permissions, and existing filesystem workflows across mobile and web. An unresolved high-severity finding also identifies a native folder-picker path that remains available without filesystem read authorization. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
3b96a67 to
fb4489d
Compare
fb4489d to
d7df773
Compare
bfb151c to
eec5dfb
Compare
38e8814 to
4b73b2d
Compare
4b73b2d to
bef54b1
Compare
bef54b1 to
c1d166f
Compare
c1d166f to
65d58c9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON, but a cloud agent failed to start.
Reviewed by Cursor Bugbot for commit 65d58c9. Configure here.
65d58c9 to
3a2bc88
Compare
There was a problem hiding this comment.
🟠 High
t3code/apps/web/src/components/CommandPalette.tsx
Line 2277 in 3a2bc88
Users without AuthFilesystemReadScope can still open the native folder picker and add a selected path, bypassing the canBrowseFiles gate. Include canBrowseFiles in canOpenProjectFromFileManager so the picker is unavailable without filesystem:read.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/CommandPalette.tsx around line 2277:
Users without `AuthFilesystemReadScope` can still open the native folder picker and add a selected path, bypassing the `canBrowseFiles` gate. Include `canBrowseFiles` in `canOpenProjectFromFileManager` so the picker is unavailable without `filesystem:read`.
3a2bc88 to
175e73b
Compare

Direct workspace reads and edits currently share task permissions, while viewing local diffs requires
review:write. Addfilesystem:readfor browsing, searching, file previews, and local diffs, andfilesystem:writefor 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:writefrom 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:
Model: GPT-6. Harness: Codex.
Note
High Risk
Changes authentication scopes and RPC authorization for filesystem and review diff paths; existing clients without new grants lose file and local-diff access until re-paired.
Overview
Introduces
filesystem:readandfilesystem:writeas distinct OAuth grants and wires clients and the server to honor them before touching host files, local diffs, or workspace assets.Server: Project list/read/search, filesystem browse, and review diff RPCs now require
filesystem:read;projects.writeFilerequiresfilesystem:write. Hostworkspace-file/media-fileasset URL minting requires read scope; attachments stay on orchestration read. Token exchange acceptsAuthGrantScope(dropsreview:writefrom new grants while still decoding legacy credentials). Pairing UI and docs describe read/write files instead of write reviews.Clients (web, mobile, shared runtime):
resolveFilesystemReadAccesscentralizes pending/denied/offline behavior. File trees, previews, path search, review git sections, composert3.jsonreads, and asset hooks skip RPCs without read scope and show explicit empty/loading states. Write scope gates plan saves, browse preload, and autosave; losing write keeps unsaved drafts across close/reopen viaFileSaveCoordinator/ optimistic query retention.Breaking: Connections with only
orchestration:readorreview:writeno longer get direct file or local-diff access until re-paired with filesystem scopes.Reviewed by Cursor Bugbot for commit 175e73b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
filesystem:readandfilesystem:writeas separate OAuth scopesfilesystem:readandfilesystem:writein auth.ts, removesreview:writefrom grant validation and standard client defaults while keeping it decodable for legacy credentialsfilesystem:readfor project file reads, entry searches, diff retrieval, and host-file asset URLs, andfilesystem:writefor project file writes; threaded worktree pull-request preparation additionally requiresorchestration:operateresolveFilesystemReadAccessresolver that waits for session and catalog readiness before granting accessFileSaveCoordinatorand project-file query state retain unsaved drafts while write access is unavailable and persist them once access returns, with confirmation logic that prevents stale writes from overwriting newer draftsorchestration:readandfilesystem:readreview:writeis removed fromAuthGrantScopesandAuthStandardClientScopes— existing pairing credentials or clients relying on that scope for file access will no longer validate; theAuthEnvironmentScopesdecoder still accepts it for backward compatibilityMacroscope summarized 175e73b.