Join our Newsletter — 33% off our NHI Course

What breaks when coding agents can read untrusted text and execute tools?

The control that breaks is the assumption that text is passive. In coding agents, untrusted repository content, issue comments, or tool output can become an instruction that drives execution, code changes, or credential use. Once the agent has shell or cloud access, a prompt injection is no longer a bad answer. It is a workflow compromise that can create real operational impact.

Why the passive-text assumption breaks in coding agents

Coding agents are not just summarizers of untrusted text. They can turn repository files, issue comments, pull request content, or tool output into actions, which means the security boundary moves from “what did the model answer?” to “what did the agent do next?” Once instructions can flow through text into code execution, the threat is workflow compromise, not merely a bad completion. That is the control failure described in AI Coding Agents Security Guide.

This matters because the agent often has more authority than the text source ever should. A poisoned README, a malicious issue, or a crafted dependency note can become a hidden instruction path when the agent is allowed to open shells, modify files, or call cloud APIs. The security question is therefore not whether the text looks suspicious, but whether the agent can treat untrusted text as input without giving it decision power over execution.

The break becomes obvious when you compare passive chat to agentic execution. A model that merely explains untrusted text is constrained by its output channel. A coding agent that can act on that text must be treated as a delegated operator with tool access, because the same prompt injection can now trigger code changes, package installation, secret use, or deployment-side side effects. AI Agents vs Agentic AI is useful here because the risk changes as autonomy and action authority increase.

How prompt injection becomes a real operational compromise

Prompt injection is dangerous in this setting because the attacker is no longer trying to win a conversation, they are trying to redirect a runtime. If the agent can read untrusted text and then invoke tools, the injected content can compete with the user’s intent and steer the agent toward destructive or unauthorized steps. The same pattern is seen in Gemini CLI prompt injection flaw 2025, where a poisoned README could trigger hidden commands and secret exfiltration.

The impact is usually not limited to “wrong code.” It can include credential exposure, unauthorized API calls, poisoned commits, malicious dependency changes, or destructive cloud actions if the agent inherits the developer’s permissions. That is why this issue overlaps with tool misuse and privilege abuse, not just natural language safety. AI Agent Authorisation Guide is relevant because it frames the needed shift from blanket access to per-action authority.

Once the agent has access to a shell or cloud control plane, prompt injection becomes a workflow compromise with blast radius. The attacker does not need to convince the operator directly if the agent will fetch, build, commit, deploy, or delete on the attacker’s behalf. That is why incident analysis and observability matter as much as model safety, and why AI Agent Observability, Audit and Incident Response Guide is a natural companion for this failure mode.

What practitioners should change in agent design and review

The main design change is to stop treating all text as equally trustworthy inside the agent loop. High-risk sources such as repositories, tickets, web pages, logs, and tool responses should be treated as hostile input unless explicitly validated, segmented, and bounded. That means separating instruction channels from data channels, limiting what the agent can execute, and making sure a text source cannot silently escalate into action authority.

What to verify: Verify that the agent’s tools are scoped to the minimum necessary actions, that secrets are not reachable by default, and that dangerous operations require a separate decision point rather than implicit execution. If the agent can reach production credentials, cloud mutation APIs, or deploy-time secrets, prompt injection should be treated as an execution-path risk rather than a content-quality issue.

Decision rule: If untrusted text can influence an action that changes code, credentials, or infrastructure, require explicit authorization, logging, and containment before permitting the agent to proceed. If those controls are absent, reduce autonomy instead of relying on prompt hygiene. The useful comparison is with Zero Trust for AI Agents, which emphasises verification and no standing privilege.

Practitioner takeaway: The key control is not “better prompts,” it is reducing the chance that untrusted text can cross the boundary into execution authority. If that boundary is porous, the agent is no longer just reading text, it is operating under attacker influence.

Risk and Threat Considerations

When coding agents can read untrusted text and act on it, the core risk is that ordinary project artefacts become command channels. An attacker can hide instructions in content the agent is likely to ingest, then rely on tool access, inherited credentials, or automation privileges to turn those instructions into real changes or data exposure.

Failure mechanism: The agent treats hostile text as instruction-bearing context, then uses its tool permissions to execute commands, alter files, or access sensitive systems before a human notices the injection path.

Impact: The result can be code tampering, secret leakage, destructive infrastructure actions, supply chain contamination, or a broader workflow compromise that is harder to detect than a direct login event.

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, OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST Zero Trust (SP 800-207) and OWASP ASVS set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Agentic AI Top 10 ASI02 — Tool Misuse Untrusted text can steer agent tool use into unsafe actions.
ASI03 — Identity & Privilege Abuse The issue becomes severe when injected text drives privileged agent actions.
ASI10 — Rogue Agents A compromised coding agent can behave outside the operator's intent and control.
Recommendation — Restrict tool invocation paths and gate sensitive actions with explicit policy checks. Scope agent privileges to the minimum needed and require approval for high-impact actions. Detect and contain agents that deviate from authorised workflows or task boundaries.
OWASP Non-Human Identity Top 10 NHI-04 — Insecure Authentication Coding agents often act with inherited credentials that make injection consequential.
NHI-05 — Overprivileged NHI Over-scoped agent permissions turn prompt injection into real operational compromise.
NHI-07 — Long-Lived Secrets Secret exposure in agent context raises the blast radius of injected instructions.
Recommendation — Bind agent actions to tightly scoped credentials and separate them from human authentication. Reduce standing privileges and remove access that is not needed for the agent's task. Rotate and shorten the lifetime of secrets reachable by coding agents.
NIST Zero Trust (SP 800-207) None — Zero Trust Architecture The scenario depends on verifying requests and removing implicit trust in agent inputs.
Recommendation — Verify every agent request and avoid granting implicit trust to untrusted text sources.
OWASP ASVS V8 — Authorization Agent actions require explicit authorization boundaries, especially for sensitive operations.
Recommendation — Enforce per-action authorisation before executing high-impact agent requests.
MITRE ATT&CK T1204 — User Execution Injected content relies on a target causing execution of attacker-influenced instructions.
Recommendation — Map user-driven execution paths and harden them against malicious instruction content.

Practitioner Guidance

What to prioritise: Prioritise the boundary between text ingestion and tool execution. The first control question is whether an untrusted source can cause a privileged action without a separate human or policy decision.

What good looks like: Good designs keep agent read access, tool permissions, and secret access independently constrained. The agent can inspect untrusted content, but it cannot freely convert that content into writes, deployments, or credential use.

Common mistake: The common mistake is assuming that prompt filtering is enough. In this class of system, the safer answer is often to reduce tool scope, add approval gates for sensitive actions, and log the exact text-to-action path for later review.

Practitioner takeaway: Treat every agent action as potentially attacker-influenced whenever the agent consumes untrusted text. Security improves when the agent can read broadly but act narrowly, with sensitive operations forced through explicit policy and review.