Blog

Claude Code security: an enterprise guide


Last updated: October 6, 2026

featured-claude-code-security

In July 2025, an AI coding agent deleted a production database during an explicit code freeze, then fabricated records to cover the action. That incident wasn’t Claude Code, but it illustrates a broader risk pattern for agentic coding tools, including Claude Code: agents can take consequential actions through the permissions and tools available to them.

Claude Code can edit files, run shell commands, commit to git, and call external tools through MCP servers whenever its permission state and user approvals allow. Each action happens under the identity of the engineer who launched the session, at machine speed, often before anyone reviews what changed.

That is what makes Claude Code security a different problem from securing a chat assistant. The engineer’s identity determines repository access and shell permissions, and any cloud tokens on the machine extend the blast radius. Repository-controlled configuration can do the same: the CVE-2026-21852 advisory shows a cloned repo could redirect Claude Code to an attacker endpoint and expose API keys before the trust prompt appeared.

Your enterprise may inherit this exposure even if Claude Code was never formally approved. This guide explains the enterprise controls to consider around Claude Code and how to govern agentic coding tools as part of the digital workforce.

Key takeaways

  • Treat Claude Code security as an enterprise risk management discipline because the tool can act on live codebases through an engineer’s identity, permissions, credentials, and approved integrations.
  • Account for risks beyond tool-level configuration, including unmanaged usage, personal accounts, repository-controlled configuration, MCP supply-chain exposure, and machine-speed agent actions.
  • Apply controls at the appropriate enforcement points: network-level discovery and approved-tool governance for agent and MCP activity, identity attribution and audit trails for accountability, and pre-execution and data-protection guardrails where supported by the deployment path.
  • Extend controls into production with visibility across supported network paths, approved MCP server and tool policies, and, for custom enterprise applications, bidirectional runtime protection for inputs and outputs.

What is Claude Code security?

Claude Code security is the set of controls an enterprise places around Anthropic’s agentic coding tool so that its autonomous actions stay within approved scope. Those controls also keep its data flows within policy and make its activity reconstructable afterward. It requires different controls from a chat assistant because Claude Code acts on live codebases; a chat assistant returns text for a human to paste.

Claude Code includes permissions and user approvals for tool actions. Claude Code sandboxing, generally available since October 20, 2025, limits writes to the working directory and network connections to approved domains.

That split means your team reviews proposed code and commands before approval. Your team also governs prompt content, repository access, MCP server vetting, device management, and deployment IAM.

Taken together, these responsibilities mean you need a Claude Code security risk management program that covers configuration, identity, supply chain, runtime monitoring, and audit evidence. The same risk-management principles apply to other agentic coding environments because the underlying concerns—identity inheritance, tool access, sensitive data, and runtime actions—are not unique to Claude Code.

WitnessAI Platform
PLATFORM OVERVIEW

You Can’t Secure What You Can’t See

WitnessAI gives you network-level visibility into every AI interaction across employees, models, apps, and agents. One platform. No blind spots.

Explore the Platform

Where Claude Code security gaps open at enterprise scale

Adoption moved faster than governance. If you’re leading security for an engineering org, you’ve likely felt this already: Claude Code and other AI coding agents may be used at work before an organization has policies to manage AI or detect Shadow AI use.

At enterprise scale, security teams need to account for risks that extend beyond the configuration of any individual coding tool. Two areas deserve particular attention. The sections below walk through each.

1. Enterprise governance extends beyond tool-level controls

Managed settings govern the machines an enterprise configures. Developer-owned laptops, personal Pro and Max plans, and cloud-platform deployments sit outside that boundary. Managed policy applies only to devices that load the enterprise’s settings. Unmanaged laptops and personal accounts therefore sit outside centrally enforced policy.

Local permission choices can broaden access over time, so you should centralize permission rules on managed devices. Separate identity controls are still needed for credentials and downstream services.

The tool’s own security boundary adds a third layer. The CVE-2026-21852 vulnerability advisory shows repository-controlled configuration could set ANTHROPIC_BASE_URL to an attacker endpoint and expose API keys before the trust prompt appeared. Several of Anthropic’s published advisories document the same pattern: a cloned repository supplies the configuration input.

2. MCP servers and machine-speed actions outrun keyword-based tools

MCP server securitymatters because agents can invoke the tools those servers expose using the permissions and credentials available to the agent workflow, while the servers themselves introduce a software supply-chain and trust risk. The OWASP MCP Security Cheat Sheet names typosquatted package names as a common supply-chain vector. It recommends monitoring tool descriptions for changes after installation.

A July 2025 internet scan found 1,862 MCP servers answering unauthenticated tool-listing requests. Claude Code’s managed settings govern which servers may connect; monitoring what an approved server exposes falls to the enterprise.

Machine-speed actions shorten the window for human review. An agent can chain file edits, shell commands, and MCP tool calls in seconds, well before a developer can read a diff or a reviewer can weigh in. Pre-execution controls provide a checkpoint for actions at that speed.

Traditional DLP and keyword-based controls were not designed to interpret the semantic context of agent activity. Tool arguments, conversational context, and the purpose behind an agent’s action can require AI-native controls that understand more than static patterns. A CSA agentic AI survey found 40% of organizations had agents in production while only 18% expressed high confidence in their identity systems’ ability to govern them.

WitnessAI Observe
OBSERVE

Knowing Which AI Tools Are in Use Is Just the Start

WitnessAI goes beyond app discovery. Observe classifies the intent behind every AI interaction across employees and agents, so you can build smarter policies based on real risk, not guesswork.

Explore Observe

Risk mitigation strategies for Claude Code security

Closing the gaps above takes a coordinated set of practices, not a single control. Treat each coding agent as a discoverable member of the workforce, governed by purpose and tied to a named human. The four practices below give you discovery, pre-execution enforcement, data protection, and the audit trail regulators will ask for.

1. Discover agentic sessions and MCP connections at the network level

Network-level discovery can provide centralized visibility into agentic activity without depending on endpoint clients or browser extensions. Coverage depends on the deployment path and whether the relevant agent traffic is visible through the enterprise control point.

An enterprise agent growth forecast projects that an average global Fortune 500 enterprise will have more than 150,000 agents in use by 2028, up from fewer than 15 in 2025. A continuous inventory should show which developers run agents, which MCP servers those agents reach, and which of those servers are exposed to the public internet.

2. Enforce intent-based policies before the agent acts

Source code leaving for a personal AI account rarely contains the keywords a regex rule looks for. Enforcement increasingly benefits from reading purpose from context. Intent-based classification can help determine the purpose and risk of AI interactions and inform policy actions such as allow, warn, block, or route. For agent tool access specifically, organizations can also enforce approved lists of MCP servers and tools.

For agents, the checkpoint works best before the tool call. Pre-execution guardrails can inspect user inputs before agent processing, while tool-access policies provide a separate control point for governing which MCP servers and tools an agent is permitted to invoke. The OWASP Top 10 for Agentic Applications ranks tool misuse second and identity and privilege abuse third among agentic application risks. Both arise at runtime, where pre-execution screening provides a control point.

3. Protect sensitive data before it reaches the model

Even sanctioned sessions can carry credentials, PII, or regulated data into a third-party model. Data-protection guardrails can tokenize or redact sensitive values before they reach an AI model or external tool, depending on the deployment path, while preserving the context needed for the workflow.

Pair data protection with clear rules for what code, tickets, and logs can be shared with which model tier. A developer on an approved plan should have a different data path than one on a personal account, and both should be observable.

4. Produce audit trails a regulator can read

The EU AI Act requires deployers of high-risk systems to retain automatically generated audit trails for at least six months; for Annex III high-risk stand-alone systems, those rules take effect on December 2, 2027.

DORA reporting rules give EU financial entities 4 hours for initial notification, 72 hours for an intermediate report, and one month for the final report. SEC registrants disclose material incidents on Form 8-K within four business days.

To meet those timelines, you need a trail that ties the agent’s activity to the human who started the session. The trail should capture prompts, tool calls, and policy decisions in a form Legal and Compliance can hand to a regulator, showing which named person initiated the session associated with a given agent action.

WitnessAI for Developers
FOR DEVELOPERS

Let Your Dev Teams Use AI Without Putting Your IP at Risk.

WitnessAI protects source code and credentials in real time, routes sensitive queries to secure internal models, and gives security teams full visibility — without slowing developers down.

Learn More About WitnessAI For Developers

Governing the agentic coding workforce with clear controls

Many agentic AI projects stall or get canceled not because the technology fails, but because teams never worked out risk controls, business value, and cost trade-offs. Claude Code sits in the middle of that pattern.

An unreviewed agent commit can affect engineering work and business functions such as legal and brand operations. If a commit reaches customers, Legal may need to assess disclosure obligations while customer-facing teams manage communications. Running Claude Code security as AI risk management gives those teams a shared process and clearer evidence.

The board gets evidence of control, and engineering keeps a sanctioned path to the tool.

WitnessAI provides a unified governance framework for the human and digital workforce, combining intent-based policy, agent and tool visibility, approved-tool enforcement, identity attribution, data-protection guardrails, and consolidated audit trails across supported deployment paths. Schedule a demo to see how WitnessAI governs agentic coding tools in your environment.

FAQs about Claude Code security