By NHI Mgmt Group Editorial TeamDomain: Agentic AI & NHIsSource: StraikeraiPublished March 31, 2026

TL;DR: Anthropic’s accidental release of about 512,000 lines of Claude Code source gives attackers a clearer view of context compaction, sandbox checks, and supply chain attack paths, according to Straiker. The deeper issue is that agentic controls assume cooperative behaviour and stable review windows, both of which break when prompts, tools, and timing are attackable at runtime.


At a glance

What this is: Anthropic’s accidental Claude Code source leak exposed how agentic coding agents manage context, permissions, and tool use, and it sharpens the threat model for AI agents running inside developer environments.

Why it matters: IAM, NHI, and PAM teams need to understand how agentic systems convert readable internals into attack leverage, because the same access patterns and trust assumptions are now entering enterprise AI programmes.

👉 Read Straikerai’s analysis of the Claude Code source leak and agentic AI risk


Context

Claude Code is an agentic coding tool, which means it can read files, call tools, and act inside a developer session with permissions that go beyond a normal chat interface. The source leak matters because agentic AI security depends on hidden implementation details such as context handling, tool boundaries, and approval logic, not just model quality.

For identity teams, the issue is not simply source exposure. It is that autonomous or semi-autonomous tool use creates a larger attack surface for prompt poisoning, tool misuse, and supply chain abuse, especially where secrets, terminals, and repositories are already in scope. That is a familiar non-human identity problem, but with faster execution and harder-to-audit behaviour.

The starting position here is typical for modern agentic deployments: broad environment access, layered guardrails, and a belief that model outputs can be screened after the fact. The article shows why that assumption is too weak once attackers can study the internals.


Key questions

Q: How should security teams reduce the risk of AI tool poisoning?

A: Security teams should treat tool metadata as part of the trust boundary. Validate descriptions, examples, and schemas before onboarding, restrict tools to least privilege, and enforce runtime policy checks on sensitive actions. That combination reduces the chance that hidden instructions can redirect an agent into exposing secrets or performing unauthorized work.

Q: Why do AI coding tools create a larger identity risk than ordinary software downloads?

A: AI coding tools often sit near terminals, browsers, cloud tokens, and shared content, so a single installation can expose both local and remote identities. That makes the trust path itself part of the identity problem. If users can be steered into a fake install page, the attacker can reach credentials without breaking the product.

Q: What do teams get wrong about approving agent-generated shell commands?

A: They often assume the command text alone reveals the risk. In reality, the danger may sit in parser gaps, short-circuit validation, or context that primed the model to produce a plausible but unsafe command. Effective review must test how the command was formed, not just whether the final string looks familiar.

Q: Who is accountable when an AI agent takes an unsafe action?

A: Accountability should sit with the business owner of the agent, the team that provisioned the access, and the control owners responsible for monitoring and revocation. If no one can answer who approved the identity, the scope, and the oversight model, the governance framework is not complete enough for production.


Technical breakdown

Context compaction creates a persistence path for poisoned instructions

Claude Code uses a multi-stage context management pipeline to control token pressure. The article describes tool result budgeting, microcompact, context collapse, and autocompact, each with different retention rules. That matters because instruction-like content embedded in files or tool outputs can survive summarisation and be reinterpreted as user intent. In agentic systems, the risk is not only prompt injection at ingress, but instruction laundering through context compression and replay.

Practical implication: Review where agent sessions preserve or summarise untrusted content, especially files, tool outputs, and repo-scoped instructions.

Bash permission checks can fail through parser gaps and short-circuits

The leak reveals a permission chain that relies on regexes, shell-quote parsing, and AST analysis to classify commands. The article highlights early-allow short circuits, parser differentials, and cases where dangerous redirection checks can be bypassed if another validator returns allow first. This is a classic control-composition problem: individually sensible checks can still leave exploitable gaps when their order and parsing assumptions do not match shell behaviour.

Practical implication: Treat shell approval logic as a composed control surface and test for parser differentials, not just blocked command patterns.

Readable source lowers the cost of agent supply chain abuse

A source leak does not automatically create a new class of weakness, but it dramatically lowers attacker effort. With the interface contract, security comments, and internal tool assumptions exposed, malicious forks and lookalike MCP servers become easier to build and harder to spot. For agentic AI, supply chain security is not limited to package integrity. It also includes repo prompts, config files, server extensions, and any tool that inherits the agent’s privileges.

Practical implication: Extend software supply chain review to agent-specific artefacts such as MCP servers, repo instructions, and local configuration files.


Threat narrative

Attacker objective: The attacker wants to turn knowledge of the agent’s internals into practical leverage for prompt injection, tool abuse, and supply chain compromise.

  1. Entry occurs through a packaging mistake that exposed Claude Code source in an npm release and quickly widened public access to the implementation details.
  2. Escalation happens when attackers study the readable source to identify context compaction behaviour, parser differences, and approval short-circuits that can be turned into reliable exploit paths.
  3. Impact follows when those insights are used to craft prompt poisoning, sandbox bypass attempts, and malicious forks that abuse agent privileges inside developer environments.

Read our 52 NHI Breaches Analysis report for a comprehensive view of breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Context poisoning is now a governance problem, not just a prompt-security problem: The article shows that readable internals let attackers study which content survives compaction and how it is reinterpreted later in the session. That shifts the risk from a single malicious prompt to a durable identity-control failure across the whole interaction. Practitioners should treat session context as a governed asset, not a disposable by-product.

Agentic AI breaks the assumption that security reviewers can reliably judge intent after the model speaks: The bash approval path assumes outputs are inspectable and that a human can meaningfully catch bad intent before execution. When the model has been guided by poisoned context, the output may look reasonable while the actual decision path is compromised. That breaks the premise behind human-paced approval gates and demands a different control model.

Supply chain security for AI agents must include behavioural contracts, not only package integrity: The leak makes it easier to clone the interface, mimic trusted tool behaviour, and hide malicious logic inside agent extensions. In other words, the attack surface is no longer just code provenance. The governance gap is failing to treat agent tool contracts, repo instructions, and local configs as part of the identity perimeter.

Runtime trust in agentic systems is fragile because the actor can combine read, reason, and act in one session: That combination creates a broader identity blast radius than conventional software because one compromised context can influence multiple later actions. Traditional IAM and PAM assumptions still matter, but they are insufficient when the decision path itself is being shaped mid-session. Practitioners need to re-evaluate where approval, audit, and containment actually occur.

Source visibility accelerates attacker research far more than it improves defender assurance: The article is a reminder that security through obscurity is not a control, but visibility alone is not enough either. Once attackers understand the control boundaries, they can target the seams between them. That is the practical lesson for agentic AI governance: if controls only work when implementation details stay hidden, they are already too brittle.

From our research:

  • 80% of organisations report their AI agents have already performed actions beyond their intended scope, including accessing unauthorised systems (39%), inappropriately sharing sensitive data (31%), and revealing access credentials (23%), according to AI Agents: The New Attack Surface report.
  • Only 52% of companies can track and audit the data their AI agents access, leaving 48% with a complete blind spot for compliance and breach investigation.
  • That gap should be read alongside OWASP Agentic Applications Top 10, which is a practical next step for teams formalising controls around agent behaviour and tool use.

What this signals

Context persistence is becoming the new boundary to govern: once an agent can carry poisoned instructions forward through compaction, the question is no longer whether a single prompt is safe. The operational issue is whether your review process can see what survived, what was discarded, and what the model later treated as intent. For teams building agent controls, context is now part of the attack surface.

With 80% of organisations already reporting agent behaviour beyond intended scope, per the AI Agents: The New Attack Surface report, the programme signal is clear: governance lag is structural, not anecdotal. Security teams should expect more agent deployments before control maturity catches up.

Enterprises should also watch the interface between internal instructions and external tooling. A readable source base, local config files, and plugin-like extensions all create places where identity assumptions can be rewritten outside the main approval workflow. That is why the next control conversation needs to join IAM, secure development, and AI runtime governance.


For practitioners

  • Audit agent-side instruction sources Review CLAUDE.md files, repo-level instructions, and other context inputs that can survive summarisation or be treated as user feedback. Focus on cloned repositories, pull requests, and forked code where poisoned instructions can enter the session through trusted paths.
  • Test parser differentials in command approval flows Build negative tests for shell quoting, redirection, and command substitution across the exact parsers your agent uses, then compare those results with actual shell behaviour. Pay special attention to early-allow paths and command shapes that bypass later validators.
  • Pin and verify agent supply chain dependencies Treat MCP servers, local agent extensions, and installer artefacts like production dependencies. Pin versions, verify hashes, and monitor for unexpected configuration changes in ~/.claude/ and similar local state directories.
  • Limit session duration for high-risk tasks Shorten agent sessions when the tool has access to terminals, repositories, or secrets, because longer sessions increase the chance that poisoned context survives compaction and drives later actions.

Key takeaways

  • The leak exposes a deeper governance issue: agentic controls depend on hidden implementation details that attackers can now study directly.
  • The most important risk is not only source exposure but the combination of context poisoning, parser gaps, and supply chain reuse.
  • Practitioners should treat agent context, command approval, and tool extensions as identity control surfaces that need explicit testing and review.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST AI RMF, NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10NHI-01The article focuses on agent context poisoning and tool misuse.
MITRE ATT&CKTA0006 , Credential Access; TA0008 , Lateral MovementThe leak discusses credential abuse and movement through agent-enabled environments.
NIST AI RMFGOVERNThe article centres on governance gaps in agentic decision paths.
NIST CSF 2.0PR.AC-4Access control scope and enforcement are central to the risk analysis.
NIST SP 800-53 Rev 5AC-6Least privilege is directly implicated by the agent's terminal and repository access.

Map agent prompt and tool boundaries to NHI-01-style abuse paths and test them with malicious inputs.


Key terms

  • Agentic AI: Autonomous AI systems capable of planning, deciding, and taking actions — including calling APIs, writing code, and orchestrating other agents — with minimal human oversight. Agentic AI introduces new NHI risks as agents must authenticate to external services.
  • Context Poisoning: Context poisoning is the manipulation of information that an AI agent reads before acting. The malicious content does not need to be code. If it changes the agent’s instructions, tool choices, or assumptions, it can alter behaviour and expand the impact of a compromised delivery path.
  • Tool Misuse: Tool misuse occurs when an agent uses an allowed integration in a way that exceeds its intended task, scope, or risk tolerance. The problem is often not access alone but the combination of valid credentials, broad permissions, and unbounded action sequencing.
  • Identity Blast Radius: The amount of damage a compromised identity can cause across systems, data, and infrastructure. In NHI environments, it is shaped by permissions, network reach, and administrative capability rather than by the credential alone. Reducing blast radius is a containment strategy that limits lateral movement and data exposure.

What's in the full article

Straiker's full blog post covers the operational detail this post intentionally leaves for the source:

  • Line-by-line discussion of the compaction pipeline and the exact retention rules that affect agent context.
  • Validator-specific examples showing where bash command approvals can short-circuit or misparse unsafe input.
  • Practical defender steps for local config review, hash verification, and handling MCP servers as dependencies.
  • Source snapshots and references to the broader agentic threat landscape discussed in the original post.

👉 Straikerai’s full post covers the compaction chain, bash validator gaps, and supply chain implications in more detail.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an identity security programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 2, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org