Skip to content

feat(auth): separate source control write permissions - #9787

Open
juliusmarminge wants to merge 5 commits into
t3code/auth-environment-scopesfrom
t3code/auth-source-control-scope
Open

feat(auth): separate source control write permissions#9787
juliusmarminge wants to merge 5 commits into
t3code/auth-environment-scopesfrom
t3code/auth-source-control-scope

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 4, 2026

Copy link
Copy Markdown
Member

Task-operation access currently also permits cloning, pushing, changing branches, and mutating pull requests. Add source-control:write for these direct source-control actions, with matching controls in web, desktop, and mobile. Repository reads and PR resolution remain available with orchestration:read.

The new scope is included in default grants and can be selected independently when pairing. Existing grants are not widened; clients need to pair again to receive it.

WebSocket coverage checks denied clone, streamed push, and PR-comment requests for task-only grants, successful clone and push with the new scope, and readable PR resolution in both cases. Client guards preserve View PR, existing-worktree selection, and thread deletion without worktree removal.

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

Before After
Before: pairing permissions After: source-control permissions

Model: GPT-6. Harness: Codex.


Note

High Risk
This is an authorization breaking change: clients with only orchestration:operate lose git and PR mutation access until re-paired with source-control:write, across server RPC enforcement and all major UI entry points.

Overview
Introduces source-control:write as its own environment scope and moves clone, push/pull, branch/worktree mutations, stacked git actions, and pull-request writes off orchestration:operate on the server. gitResolvePullRequest stays readable under orchestration:read.

Web, mobile, and shared action hooks now use useEnvironmentScope to disable clone/add-project flows, git menus and sheets, PR editing/checkout handoffs, and branch pickers when the connection lacks the scope, with short “cannot change source control” messaging. Changing a thread’s branch or worktree still needs orchestration:operate in addition to source-control write; ordinary commits/pushes on the current branch can remain available with source-control write alone.

Pairing/OAuth and connections settings expose the new permission; default client scopes include it but existing paired tokens are not upgraded. Server and mobile tests cover denied vs allowed mutations.

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

Note

Add AuthSourceControlWriteScope and gate source-control writes across web, mobile, and server

  • Introduces AuthSourceControlWriteScope in auth.ts as a new environment authorization scope for standard clients and OAuth pairing.
  • Reassigns source-control and pull-request mutation RPCs in RpcAuthorization.ts from AuthOrchestrationOperateScope to AuthSourceControlWriteScope; gitResolvePullRequest moves to AuthOrchestrationReadScope.
  • Gates web UI git actions, branch selection, PR detail panel editing, clone flow, and thread deletion worktree cleanup behind the new scope, with disabled states and early returns in handlers.
  • Gates mobile git sheets (overview, branches, commit, confirmation) and branch picker behind the scope via use-selected-thread-git-actions.ts, which also rechecks permissions at action time.
  • Adds server integration tests in server.test.ts and a mobile permission test suite in use-selected-thread-git-actions.test.ts.
  • Risk: environments previously granted only AuthOrchestrationOperateScope will lose source-control write access; clients and existing tokens may need the new scope to perform clone, push, commit, branch, and pull-request mutation operations.

Macroscope summarized 9c21ca5.

@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 source control scope feat(auth): separate source control write permissions Sep 4, 2026
Comment thread packages/contracts/src/auth.ts
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 9c21ca5.

This comment will update automatically after the next completed run.

@juliusmarminge
juliusmarminge force-pushed the t3code/auth-source-control-scope branch from 7b1d2a9 to 29f2d0c 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/components/GitActionsControl.tsx Outdated
Comment thread apps/web/src/hooks/useThreadActions.ts Outdated
Comment thread apps/server/src/auth/RpcAuthorization.ts
@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 introduces a new source-control authorization boundary across server RPCs and web/mobile workflows, while also adding that permission to default client scopes. The security-sensitive auth changes and altered product defaults require human review.

No code changes detected at 9c21ca5. Prior analysis still applies.

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

@juliusmarminge
juliusmarminge force-pushed the t3code/auth-source-control-scope branch from 29f2d0c to cfd3827 Compare September 4, 2026 21:36
@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
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-source-control-scope branch from cfd3827 to 976c793 Compare September 4, 2026 21:38
Comment thread apps/web/src/hooks/useThreadActions.ts

@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 976c793. Configure here.

Comment thread apps/web/src/hooks/useThreadActions.ts
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-source-control-scope branch from 976c793 to 3a230f5 Compare September 4, 2026 21:48
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-source-control-scope branch from 3a230f5 to 74090e2 Compare September 4, 2026 22:59
@juliusmarminge
juliusmarminge force-pushed the t3code/auth-source-control-scope branch from 74090e2 to 9c21ca5 Compare September 4, 2026 23:52
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