How does Claude Code protect git credentials from sandbox compromise?
Claude Code routes git operations through a proxy that holds real credentials outside the sandbox, authenticating agents with scoped tokens instead. The question is whether this architecture effectively prevents compromised sandbox code from misusing GitHub access.
Alongside the sandboxed bash tool, Anthropic describes a separate design choice for Claude Code on the web: "sensitive credentials (such as git credentials or signing keys) are never inside the sandbox with Claude Code." Rather than scoping what the sandbox can reach, this removes the secret from the sandbox's reach altogether, even though the agent otherwise "has full access to its server" inside that sandbox. Anthropic states the intended guarantee as "even if the code running in the sandbox is compromised, the user is kept safe from further harm" — harm from credential theft specifically.
The mechanism is a mediating proxy: "Claude Code on the web uses a custom proxy service that transparently handles all git interactions. Inside the sandbox, the git client authenticates to this service with a custom-built scoped credential. The proxy verifies this credential and the contents of the git interaction (e.g. ensuring it is only pushing to the configured branch), then attaches the right authentication token before sending the request to GitHub." The credential available inside the sandbox only authenticates to the proxy; the real GitHub-facing token lives outside the sandbox and is attached after the proxy inspects the content of the request, not merely its sender's identity.
This is a different control than the filesystem/network boundary covered in Can OS sandboxing reduce AI permission prompts without sacrificing safety?: that boundary limits where the agent can act, while this one ensures the agent never holds the credential that would let it act destructively through GitHub in the first place. It matches what Can agent safety rules stop destructive API calls in real time? names as the missing piece in that incident — authority over the credential's scope held outside the agent — but implemented here by checking "the contents of the git interaction" at request time rather than relying on the scope of a token the agent holds directly.
The excerpt does not say what the proxy does when its content check fails, whether the scoped credential or the proxy service itself has been tested against compromise, or how "configured branch" restrictions are set or audited. It is Anthropic's description of its own architecture, not a security evaluation of it. The implication it supports is narrow: a vendor describes a specific pattern — keep the real secret outside the sandbox, mediate every protected action through a service that checks content before attaching the credential — as its answer to the risk that a compromised in-sandbox agent could otherwise use git credentials directly; it does not establish how resistant that proxy is to misuse.
Inquiring lines that read this note 5
This note is a source for these research framings, grouped by the broader line of inquiry each explores. Scan the bold lines of inquiry; follow any specific question forward.
Which agent-created code should persist in infrastructure versus remain task-specific? Can formal safety constraints prevent AI agents from exceeding authorized boundaries?Related concepts in this collection 2
This note in its neighbourhood — explore the map, then jump to a related concept in the list below.
Click a node to walk · click center to open · click Open in graph to see this note in the full knowledge graph
-
Can OS sandboxing reduce AI permission prompts without sacrificing safety?
Does isolating filesystem and network access let AI agents operate more autonomously while staying secure? This matters because approval fatigue can undermine human oversight of critical actions.
the companion boundary from the same post, limiting where the agent can act rather than what it can authenticate as
-
Can agent safety rules stop destructive API calls in real time?
Explores whether an agent's own guardrails and project rules can reliably prevent irreversible damage once the agent decides to act, or whether external authorization boundaries are necessary.
names the same missing piece, a credential scope held outside the agent's own reasoning
Related papers in this collection 8
Papers most semantically related to this note, ranked by cosine similarity in the embedding space.
- Beyond permission prompts: making Claude Code more secure and autonomous
- Investigating three real-world incidents in our cybersecurity evaluations
- Agentic Misalignment: How LLMs Could Be Insider Threats
- Agentic coding and persistent returns to expertise
- Claude's new constitution
- Operating Multi-Client Influence Networks Across Platforms
- Research Update: Towards Reconciling Slowdown with Time Horizons (algorithmic vs holistic evaluation)
- A Practical Guide for Designing, Developing, and Deploying Production-Grade Agentic AI Workflows
Original note title
Anthropic's Claude Code on the web never puts git credentials inside the sandbox — a proxy verifies and attaches a scoped token before forwarding to GitHub