TL;DR: Indirect prompt injection lets planted text in issues, pull requests, README files or web content steer coding agents into leaking secrets or changing code, according to Dam Secure's guide. Security reviews and least-privilege controls have to sit outside the agent because the model cannot reliably separate task context from attacker instructions.
At a glance
What this is: NHI Mgmt Group's analysis, drawing on Dam Secure's blog post: Indirect prompt injection can reach coding agents through repository content and web material, letting attacker-planted instructions drive secret leakage or code changes.
Why it matters: IAM, NHI and AI security teams need to govern what coding agents can read, write and trigger against, because untrusted context can become an execution path.
By the numbers:
- A 2026 study of 1.2 billion URLs found 15,300 validated injection attempts on public web pages.
Context
Indirect prompt injection is a governance problem, not just a model-safety problem. A coding agent that reads untrusted text can be steered by instructions embedded in issues, pull requests, repository files or fetched web content, even when the developer never typed anything malicious.
The core failure is trust boundary collapse: the agent cannot reliably distinguish operator intent from attacker-supplied context once both arrive through the same workflow. That makes code editing, command execution and secret access part of the same attack surface, especially in unattended CI flows.
The risk is highest where the agent has write permissions, can run commands or can see secrets, because the attacker inherits the agent's effective reach.
Key questions
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. Those signals usually mean the assistant is following untrusted input rather than the operator’s intent.
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. The failure mode is weak separation between instructions, retrieved content, and execution permissions. Limiting tool scope, using allowlisted actions, and keeping secrets out of the model context reduce the blast radius.
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. Use content classification, structured prompting, output encoding, sandboxed execution, and allowlisted tool interfaces so the model can read text without treating it as instructions. Human approval for high-risk actions adds a final control layer.
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.
Technical breakdown
How indirect prompt injection enters coding agent workflows
Indirect prompt injection occurs when attacker-controlled text becomes part of the model's working context after the operator has delegated a task. In coding environments that text can arrive through issue bodies, PR comments, repository docs, dependency notes, web pages, API responses or agent config files. The model then treats that content as if it were legitimate task input. The technical problem is not just malicious text, but context contamination across multiple ingestion paths. Once the agent is allowed to read files, fetch pages or inspect pull requests, the trust boundary is already crossed before the model decides what to do next. See the Prompt Injection Guide.
Practical implication: Treat every untrusted input source as a potential instruction channel and separate it from any agent that can act on production code or secrets.
Why coding agents turn prompt injection into real impact
Coding agents differ from chat assistants because they can execute side effects. They can edit files, run commands, open pull requests and query secrets, which means a planted instruction can move from text to action without a human in the loop. The impact depends on the agent's permissions, not on the sophistication of the attack itself. If the workflow grants write access, network access or environment variables, the injected instruction can steal keys, alter code, change workflow files or modify the agent's own setup. The dangerous step is the permissioned action, not the prompt. See the AI Coding Agents Security Guide.
Practical implication: Scope agent permissions to the smallest action set that still completes the task, and never assume a benign-looking prompt means a benign outcome.
Why unattended CI workflows amplify prompt injection risk
Unattended CI workflows create a high-trust execution path because they trigger automatically on issues, comments or pull requests. That automation means attacker-planted text can reach an agent before any person reviews the content, and common triggers such as pull_request_target can expose repository secrets even when the contribution comes from outside the organisation. The same workflow pattern can also hide the exfiltration step inside comments, commits or encoded output, making the attack look like ordinary automation. The mechanism is not model failure alone, but over-connected orchestration around the model. See the Agentic AI Security Guide.
Practical implication: Review every AI-triggered CI path for automatic secret exposure and remove secret access from workflows that can be triggered by untrusted contributors.
Threat narrative
Attacker objective: The attacker wants the victim's own coding agent to expose secrets or carry out repository changes under legitimate-looking automation.
- Entry occurs when attacker-controlled text lands in an issue, pull request, README, config file or fetched web page that the coding agent reads as task context.
- Credential access follows when the agent, acting on the planted instruction, reads environment variables, CI tokens or repository secrets available to its runtime.
- Impact occurs when the agent leaks those secrets, rewrites code, alters workflow files or encodes the exfiltration inside a commit or comment that looks routine.
Breaches seen in the wild
- Sentry MCP Agentjacking 2026: Researchers showed a fake Sentry error, posted with a public DSN, could make AI coding agents run attacker code with developers' credentials.
- Gemini CLI prompt injection flaw 2025: Tracebit showed a poisoned README could make Gemini CLI run hidden commands and exfiltrate developer secrets; Google fixed it in 0.1.14.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
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.
Least privilege remains necessary but is no longer sufficient when the agent can be steered by text it reads. A coding agent that can receive instructions from issues or README files has a larger effective trust boundary than a normal automation job, even when its token scope looks narrow. That means entitlement design has to consider both authority and context ingestion. AI coding agents need governance that assumes hostile task content, not just controlled tooling.
Secret exposure through agent context creates a new form of access-path coupling. The same repository content that helps an agent complete a task can also become the path an attacker uses to reach secrets, workflows and commits. This is the named concept: context-to-execution coupling, where text ingestion and privileged action collapse into one chain. Practitioners should treat any agent that can read untrusted text and reach secrets as a single governed security object.
Agent review has to shift from prompt inspection to change control. Once an injected instruction has passed through the model, the real governance question becomes what reached the diff, the commit or the workflow file. That makes code review, approval gates and secret segregation the decisive controls. The implication is that teams should measure not whether the model was fooled, but whether the resulting change was stopped before merge.
From our research library:
- 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.
- Read next: Prompt Injection Guide
What this signals
Context-to-execution coupling: Coding agents become materially harder to govern once attacker-controlled text can flow into the same context window that drives commands, commits and secret access. The control problem shifts from prompt filtering to trust-boundary design, because the dangerous decision is what the agent is allowed to touch after it reads the text.
The next governance decision is not whether to let an agent read more content, but whether that content can influence a privileged action. Workflows that combine untrusted input, secret access and automatic execution will keep producing the same failure pattern until teams separate those paths and force review before impact.
A single injected instruction can cross from chat-like context into repository change control in seconds, which means operational detection has to focus on the artefacts that follow, not only on the text that entered. That includes comment-driven jobs, encoded exfiltration in commits and workflow edits that quietly expand the agent's reach.
For practitioners
- 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.
- Require human approval for high-risk agent outputs Place a maintainer review gate on merges, releases, workflow edits and any change that touches credentials, access checks or repository automation.
Key takeaways
- 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.
- The practical risk is secret leakage or code change, especially when unattended workflows let the agent read secrets, run commands or write back to the repository.
- Teams need containment around triggers, permissions and review because model-level filtering alone does not stop a privileged agent from acting on hostile instructions.
Related NHI Mgmt Group resources: Prompt Injection Guide · AI Coding Agents Security Guide · Agentic AI Security Guide · Sentry MCP Agentjacking 2026
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and MITRE ATT&CK define the specific risk controls and attack patterns relevant to this term.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Injected agent workflows expose API keys and tokens through comments, commits and workflow output. |
| NHI-04 — Insecure Authentication | The attack depends on agents reaching secrets and authenticators through insecure workflow trust boundaries. | |
| Recommendation — Scan agent workflows for exposed secrets and revoke any credential that can be reached from untrusted context. Separate untrusted inputs from secret-bearing authentication paths and restrict token exposure to trusted jobs. | ||
| OWASP Agentic AI Top 10 | ASI02 — Tool Misuse | Prompt injection turns an agent's allowed tools and actions into attacker-controlled execution. |
| ASI09 — Human-Agent Trust Exploitation | The attack exploits the agent's tendency to trust content it reads as if it were operator intent. | |
| Recommendation — Constrain agent tools, commands and outputs so untrusted instructions cannot drive privileged actions. Treat all untrusted context as hostile and require human review before agent output can change code or workflow state. | ||
| MITRE ATT&CK | TA0006; TA0008 — Credential Access; Lateral Movement | The attacks harvest secrets first and then use the agent's reach to move into code and workflow changes. |
| Recommendation — Map injected-agent incidents to credential access and lateral movement to prioritise review of exposed execution paths. | ||
Key terms
- Indirect Prompt Injection: Indirect prompt injection is an attack where malicious instructions are hidden inside content that an AI system reads later. The model may treat that content as context rather than as hostile input, which can influence tool use, data access, or workflow actions if controls are weak.
- Coding Agent: A coding agent is a software system that can plan, generate, and modify code with limited human prompting. In governance terms, it is not just a tool but an actor whose permissions, tool access, and rollback path must be managed as part of the delivery process.
- pull_request_target: pull_request_target is a GitHub Actions trigger for pull requests that runs workflows in the context of the base repository, not the fork. That grants access to repository secrets and write permissions, so it must be used only with strict checks on untrusted code, labels, and workflow steps.
- Human-Agent Trust Exploitation (ASI09): An attack where an AI agent's fluency and apparent authority are weaponised to manipulate human users into approving harmful actions, exploiting the tendency to over-trust confident AI outputs.
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 IAM programme, it is worth exploring.
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org