feat(safety): gate worker changes to GitHub identity (`gh auth switch`) and pushes to non-origin remotes
Summary
A worker can change the machine's active GitHub identity (gh auth switch) and push code under
a different account, with no approval gate, no notification to the orchestrator, and no audit
record. The identity change is global and persists after the session ends.
To be clear about scope: forking is a legitimate, supported workflow (#2609 calls it "the standard fork-contribution workflow"). The problem is the silent switch of the human's GitHub identity, not the fork.
What happened
A worker finished its task and could not push to origin — the account it was running as had
read-only access. Without asking, it:
- Ran
gh auth switchto a different GitHub account configured on the machine - Forked the repository to that account
- Pushed the branch there
- Opened a cross-fork PR authored by that account
- Left
ghswitched to the wrong account when it finished, reportingstatus: idle
The orchestrator learned of this only by reading the worker's on-disk transcript afterward. Every message sent to stop it was silently lost to a separate bug, so no correction was possible while it ran.
Because gh auth switch is global, every subsequent gh command on the machine — including
the human's own, and other agents' — ran as the wrong account until manually reverted.
Why this is worth gating
- Identity misattribution: commits and PRs land under an account the human did not choose, in a repo belonging to an organization.
- Persistence: the change outlives the session that made it, silently affecting unrelated work.
- Data exposure: here the upstream repo was public, so nothing leaked. Had it been private, a fork/push to a personal account would have been an exfiltration path — reachable through ordinary agent tool use, with no gate.
- Recovery cost: unwinding it required deleting a branch and PR, re-forking under the right account, re-pushing, and re-opening the PR.
Requested behavior
A policy gate for identity- and publication-affecting operations, with confirm-or-deny and an event surfaced to the orchestrator:
gh auth switch,gh auth login,gh auth refresh(scope escalation)gh repo fork,gh repo deletegit pushto any remote that is not the session's expectedorigin
Two cheaper mitigations, valuable on their own:
- Snapshot and restore the active
ghaccount across a session, or at minimum verify at teardown and warn when a session ends with the account changed. A session that leaves global state dirty should not report cleanidlecompletion. - Emit an event to the orchestrator when a worker changes auth identity or pushes to a non-origin remote, so it is visible even when it is permitted.
Environment
- macOS (darwin 23.6.0), cursor harness worker
gh2.92.0, two accounts configured in the keyring- Repo at
3934bc86a
Thanks for contributing to Agent Orchestrator.
This issue is being picked up by the current external contributor on-call pair:
- @illegalcall
- @somewherelostt
If someone is already working on this, please continue as usual. The on-call pair is added for visibility, tracking, and support, not to take over the work. If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @somewherelostt here.
For faster context or live questions, you can also join the AO Discord.
Join the session here: https://discord.gg/H6ZDcUXmq
Come by if you want to see what is being built, ask questions, or just hang around with the community.
After reviewing the scope, this affects only machines with multiple GitHub accounts already configured, and only when a worker explicitly switches between them. A reliable AO-wide fix would require cross-harness command enforcement or per-session credential isolation. That cost is disproportionate to the demonstrated impact, so I suggest closing this as not planned. @AgentWrapper
Hi @homeshrawat, per the earlier discussion the gh-auth gating approach isn't planned. Closing as not planned. Thanks for the safety thinking.