Agentic coding increases risk because the agent can act, not just suggest. It can install packages, edit files, call tools, and open pull requests using a developer's permissions. That means a prompt injection, malicious dependency, or bad instruction can become an actual change, while traditional review and CI often see the result only after the risky actions already happened.
Why Correct Output Can Still Be Unsafe
Agentic coding changes the risk model because the system is not just generating text, it is taking actions inside a real development environment. A model can produce code that looks syntactically sound and still be unsafe if it was shaped by a prompt injection, a poisoned dependency, or an instruction that altered the agent’s task boundaries. The visible code may pass a quick read while the real issue sits in what the agent fetched, executed, modified, or approved along the way.
That matters because developer permissions are often broader than teams realise. Once an agent can edit files, install packages, run commands, or open pull requests, the security question shifts from “does the output look right?” to “what authority was exercised to get there?” The most dangerous failure is not a malformed function, it is a legitimate-looking change created through an untrusted path.
In practice, teams usually discover the problem after the tool has already made the risky move, not during the final code review.
How the Risk Shows Up in Real Workflows
The core issue is that agentic systems collapse reviewable intent and executable action into one pipeline. A human developer may use a package manager carefully, but an agent can be induced to do the same thing at scale and speed, with less skepticism about source provenance or side effects. That makes the surrounding workflow part of the attack surface, not just the code repository.
Common failure modes include:
- prompt injection that persuades the agent to ignore earlier constraints;
- malicious or typosquatted dependencies that are selected because they appear useful to the task;
- overbroad tool access that lets the agent touch secrets, files, or environments it does not need;
- review friction, where the final diff looks normal and distracts from the dangerous commands that produced it.
OWASP Top 10 for Agentic Applications 2026 is useful here because it treats prompt injection, tool misuse, and privilege abuse as design problems, not just code quality issues. For teams building or adopting coding agents, the relevant control is not only code review, but also limiting what the agent can execute, what it can reach, and what it can approve on its own.
These controls tend to break down when the agent is allowed to operate with a developer’s full workstation or CI credentials, because the environment then becomes the enforcement point rather than the model itself.
Common Variations and Edge Cases
Tighter agent permissions often reduce productivity, so organisations have to balance speed against blast radius. That tradeoff becomes sharper in high-trust engineering teams, where agents are used for refactoring, dependency updates, or repetitive scaffolding and the outputs look especially credible.
There is no universal standard for how much autonomy is safe, but a useful rule is that the more actions an agent can take without a second human deciding each step, the more you should treat it like an untrusted operator. A “correct-looking” diff is not enough when the agent also chose the dependency, fetched context, or executed commands that were never independently approved.
NIST AI Risk Management Framework helps frame this as governance, validity, and accountability rather than a narrow code-generation problem. The practical edge cases are the ones where the agent has partial access, such as read access to internal repos or write access in a sandbox that can still reach production-linked assets. That is where teams often misjudge risk because the generated code appears harmless while the surrounding action chain is not.
When the agent can cross trust boundaries, the risk becomes much less about code correctness and much more about whether the path from prompt to change stayed within controlled limits.
Risk and Threat Considerations
Agentic coding increases exposure to prompt injection, dependency poisoning, and privilege abuse because the adversary can target the agent’s decision path rather than the final code alone. The attack is often effective precisely when the resulting code looks plausible, since the harmful step happened earlier in the tool chain.
Failure mechanism: the agent accepts untrusted instructions, retrieves or installs unsafe material, or uses excessive permissions to carry out an action that a human would have questioned. Once that action is executed, traditional review may only see the end state, not the compromised reasoning that produced it.
Impact: organisations can ship malicious code, expose secrets, modify infrastructure, or approve changes that appear routine but were created through an untrusted execution path. The practical consequence is a larger blast radius than with passive code generation, because the model can operationalise a bad instruction instead of merely suggesting it.
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 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | A2 — Prompt Injection | Prompt injection can alter an agent's action path during coding tasks. |
| A4 — Tool Misuse and Excessive Agency | Coding agents can misuse tools and permissions even when code output appears normal. | |
| A7 — Supply Chain and Dependency Risks | Agents may select unsafe packages or dependencies while building code. | |
| Recommendation — Constrain agent instructions and isolate untrusted inputs before tool execution. Limit tool scope and require approval for state-changing actions. Verify dependency provenance and block unapproved package installation. | ||
| NIST AI RMF | GOVERN — Govern AI risk | Agentic coding needs governance over autonomy, accountability, and escalation. |
| MAP — Map AI risks | The question is fundamentally about where agentic coding risk arises in the workflow. | |
| Recommendation — Define approval boundaries and accountability for agent actions. Map prompt, tool, and permission risks across the coding lifecycle. | ||
| CIS Controls v8 | 4 — Secure Configuration of Enterprise Assets and Software | Agentic coding risk is reduced by hardening tool permissions and execution paths. |
| 5 — Account Management | Agents often act with developer permissions that must be tightly controlled. | |
| Recommendation — Harden agent environments and restrict write access to required systems only. Provision the minimum necessary privileges for coding agents and rotate access. | ||
| MITRE ATT&CK | T1204 — User Execution | Prompt-driven agent actions can be induced through deceptive instructions. |
| Recommendation — Monitor for coerced execution paths that cause the agent to run unsafe actions. | ||
Practitioner Guidance
What to prioritise: separate suggestion from execution. If the agent can run commands, install packages, or write to repos, treat those permissions as high-risk capabilities and scope them narrowly to the task.
What to verify: verify not just the final diff, but the provenance of dependencies, the commands run, and any tool calls that touched secrets, tokens, or deployment paths. A clean-looking output is not trustworthy if the route to it was unbounded.
Decision rule: if the agent can affect production-adjacent assets, require human approval before any action that changes state outside a sandbox. If it cannot be observed and reverted, it should not be autonomous.
Practitioner takeaway: the security test for agentic coding is whether the system can be tricked into doing something dangerous, not whether the generated code looks reasonable after the fact.
Related resources from NHI Mgmt Group
- Why do AI coding tools create a security risk even when code looks correct?
- Why do AI-generated code changes increase application security risk?
- Why do multiple domains increase security risk even when each site looks simple?
- Why do agentic coding tools increase blast-radius risk even when auto-approval is limited?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 14, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org