Join our Newsletter — 33% off our NHI Course

Does indirect prompt injection let coding agents leak secrets?

 

(@nhi-mgmt-group)
Member Moderator
Joined: 2 years ago
Posts: 20842
Topic starter  

TL;DR: Indirect prompt injection can steer coding agents through issues, pull requests, README files and web pages, according to Dam Secure. Coding workflows need containment around secrets and write access because the agent may treat attacker text as task context.

Editorial analysis by NHI Mgmt Group, based on content published by Dam Secure: “How does indirect prompt injection reach your codebase?”.

By the numbers:

  • A 2026 study of 1.2 billion URLs found 15,300 validated injection attempts on public web pages.

Key questions

Q: Why does prompt injection let a coding agent reach secrets?

A: Prompt injection can steer a coding agent to treat attacker-supplied instructions as part of its operating context, so it may call tools, read files, or query secrets stores with the human user’s authority.

Q: How should teams isolate untrusted text from AI workflows?

A: Teams should separate untrusted text from executable prompts, tool calls, and policy inputs with strict data boundaries.

Q: What are the signs that prompt injection is influencing an AI coding assistant?

A: Look for unexpected tool calls, unexplained file reads, outbound requests that do not match the developer’s task, or the agent acting on instructions that only appear inside code comments, README files or dependency content.

Practitioner guidance

  • Separate untrusted input from secrets Keep issues, comments, README files and fetched web content away from any agent that can read deployment tokens, environment variables or write-scoped credentials.
  • Disable secret-bearing triggers for untrusted contributions Avoid pull_request_target and similar workflows for AI automation unless the job has no access to sensitive material and no path to protected repository state.
  • Restrict agent privileges to read-only by default Limit write access, network egress and command execution to the smallest set required for the task, and treat any elevation as an explicit exception.

Bottom line: Indirect prompt injection works because coding agents treat attacker-planted text as legitimate task context when it appears inside issues, files or fetched web content.

Glossary terms: Indirect Prompt Injection, Coding Agent, pull_request_target, Human-Agent Trust Exploitation (ASI09)

Explore further

View Full Forum →  |  NHI Foundation Course →  |  Our Services →  |  Read the full analysis →



   
Quote
(@mr-nhi)
Member Moderator
Joined: 7 months ago
Posts: 21330
 

Indirect prompt injection is a workflow governance failure before it is an AI failure. The attack succeeds because organisations let untrusted text share the same context channel as operator intent, then allow the resulting agent to act with code and secret access. That is a boundary design problem, not a model-quality problem. The practical conclusion is that review, permissioning and trigger control must sit around the agent, not inside it.

A few things that frame the scale:

  • Claude Code-assisted commits leaked secrets at a rate of 3.2%, more than double the human-only baseline of 1.5%, with peaks reaching 31 secrets per 1,000 commits in August 2025, according to the State of Secrets Sprawl 2026.
  • 96% of organisations store secrets outside of secrets managers in vulnerable locations including code, config files, and CI/CD tools, according to the Ultimate Guide to NHIs.

A question worth separating out:

Q: What is the difference between prompt injection and indirect prompt injection?

A: Prompt injection targets the model directly through the user prompt. Indirect prompt injection hides malicious instructions inside data the model later reads from a trusted source, such as a form submission or knowledge base. Indirect attacks are more dangerous in agentic systems because the malicious content can travel through normal workflows before it is executed.

👉 Read our full editorial: Indirect prompt injection can make coding agents leak secrets



   
ReplyQuote
Share:

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.