How to Secure AI Coding Agents in Enterprise Environments
Anthropic’s public enterprise guide explains why coding agents need bounded autonomy. This article is the implementation companion: how a platform or security team actually wires identity, repository access, Claude Code managed settings, sandboxing, egress controls, audit fields, and a go-live checklist. Treat Claude Code as one concrete control plane; the same layering applies to other agents such as GitHub Copilot when you map product features to your own IAM and CI gates. Official product references: Managed settings, Permissions, and Sandboxing (verified November 24, 2026).
What securing coding agents means in practice
Enterprise coding-agent security is a control objective, not a chatbot setting. Agents that edit code must inherit identity, least privilege, data-handling, and evidence requirements you already apply to CI runners and privileged developer laptops.
Use Anthropic’s enterprise guide to securing coding agents for the risk framing and defense-in-depth narrative. Use this page for deployable templates: which layer enforces which control, what a managed-settings.json can lock, and how to prove the controls before go-live.

Enterprise security architecture for coding agents
Separate the planes so no single token becomes the whole security story. Identity decides who the agent is; the git host decides which repos and branches change; the runtime decides which tools and paths are allowed; the sandbox decides where commands execute; SIEM proves what happened.
<pre>flowchart LR IdP[IdP / Agent Identity] –> Runtime[Agent Runtime\nClaude Code + Managed Settings] Runtime –> Repo[Git Host\nApp install + Rulesets] Runtime –> Sandbox[OS Sandbox\nFS + Egress] Runtime –> SIEM[Audit / SIEM\nPrompt · Tools · Diffs] Repo –> PR[PR Reviews + Scanners] PR –> Merge[Protected Branch Merge] </pre>
| Security control | Enforced by | Not sufficient alone |
|---|---|---|
| Which repositories can be accessed | GitHub App / repository ACL (installation scope) | Branch rules or sandbox FS policy |
| Which branches can be pushed | Branch protection / repository rulesets + required reviews | A short-lived token by itself |
| Which files the agent may read or edit | Claude Code permission rules + OS sandbox filesystem policy | Repository ACL alone |
| Which network destinations are reachable | Sandbox egress allowlist / enterprise proxy | Prompt instructions only |
| Who can approve merges | PR review rules / CODEOWNERS / rulesets | Agent self-attestation |

How to issue repository credentials without fake branch-scoped tokens
Prefer a GitHub App installation token (or equivalent machine identity) limited to the approved repository and the minimum required permissions. Fine-grained PATs can limit repos and permission sets and expiry (GitHub PAT docs), but they are not a native “write only to branch X” credential.
Enforce branch-level restrictions with repository rulesets, protected branches, and required pull-request reviews (GitHub rulesets). Pattern for a safe pilot: short-lived installation token → feature branch only → mandatory PR → SAST/secret scan → human merge to protected default branch.
How to Enforce Claude Code Enterprise Security Policies
Claude Code can enforce deny / ask / allow rules in settings, with managed settings taking precedence over user and project files (Deploy managed settings). The JSON below is an illustrative baseline for discussion—validate every key against the current settings schema and your OS delivery path (managed-settings.json, MDM, or server-managed settings) before calling it production policy.
<pre>{ “permissions”: { “deny”: [ “Read(./.env)”, “Read(./.env.*)”, “Read(./secrets/**)”, “Bash(curl *)” ], “ask”: [ “Bash(git push *)”, “Bash(npm publish *)” ], “disableBypassPermissionsMode”: “disable” }, “allowManagedPermissionRulesOnly”: true, “sandbox”: { “enabled”: true, “failIfUnavailable”: true, “allowUnsandboxedCommands”: false } }</pre>
Administrators should lock permission rules with <code>allowManagedPermissionRulesOnly</code> when developers must not widen allowlists locally. Keep sandbox enabled for defense in depth (sandbox docs): permissions decide which tools fire; the sandbox constrains filesystem and network even if a prompt injection bypasses model judgment. Note platform limits—for example native Windows sandbox availability—and decide whether <code>failIfUnavailable</code> is acceptable for your fleet.
Org rollout steps are documented in admin setup: decide which keys are managed-only, place the file or server policy, then confirm with <code>/status</code> that enterprise managed settings are active.
Access control, audit logging, and incident fields
Logs that omit tool arguments or file paths may be insufficient for incident reconstruction. Security teams should also document how to revoke permissions and investigate unexpected changes after a failed or unauthorized merge.
Minimum event fields to join in SIEM: human requester id, agent service identity, session id, tool name, command or path arguments, deny/ask/allow decision, repo + commit SHA, PR number, and approver. If any join key is missing, treat go-live as blocked.

How to monitor coding-agent risk at enterprise scale
At enterprise scale, coding-agent risk assessments should continuously monitor three areas: repository activity, sensitive data access, and agent behavior.
| Plane | Signals to alert on | Owner |
|---|---|---|
| Repository activity | Force-push, protected-branch bypass, unexpected repo installs | Platform / SCM admin |
| Sensitive data access | Secret path reads, large blob downloads, unusual path fan-out | SecOps + AppSec |
| Agent behavior | Tool-call spikes, repeated denials, egress to unknown hosts | Platform + SOC |
Enterprise go-live acceptance checklist
Expand the pilot only when every row can show evidence—not a verbal assurance that “sandbox is on.”
| Check item | Acceptance criteria |
|---|---|
| Agent Identity | Each automation path has a unique non-shared identity in IdP |
| Repository Access | Installation/token limited to approved repositories only |
| Branch Protection | Default branch requires reviews; agent cannot push directly |
| Filesystem Sandbox | Negative test: agent cannot read .env / secrets paths |
| Network Egress | Only approved destinations reachable from agent runtime |
| Secret Management | No long-lived human admin tokens mounted into the agent |
| Code Review | High-risk diffs require human approval before merge |
| Audit Logging | SIEM can reconstruct one full change event end-to-end |
| Kill Switch | Operators can revoke identity/install and stop new sessions fast |
When autonomous coding agents are a poor fit
Keep autonomy low when the agent would need production credentials, unrestricted egress, or write access to payment / identity systems; when audit join keys are incomplete; or when the team cannot staff reviewers for agent-authored PRs. In those cases, prefer explain-only or PR-draft modes until the checklist is green.
Research Methodology
This article synthesizes Claude Code managed settings, permissions, sandboxing, and admin-setup documentation together with GitHub token and ruleset guidance (verified November 24, 2026). It is an implementation handbook, not a substitute for Anthropic’s narrative enterprise guide or a penetration-test report.
Configuration samples are illustrative. Confirm keys, paths, and OS delivery mechanisms against current vendor docs before fleet enforcement.
Enterprise deployment recommendation
Ship a bounded coding-agent program when the go-live checklist is green and SIEM join keys work on real PRs. Treat Anthropic’s enterprise guide as the why; treat managed settings, git rulesets, and monitoring as the how.
Keep commercial seating and usage decisions on a separate procurement track. Do not pad a security architecture article with consumer Free-tier list prices—they do not prove enterprise control readiness.



