TL;DR: AI coding tools are now mainstream, with 82% of developers using or planning to use them, but review capacity has not kept pace and insecure patterns such as hardcoded credentials and broken access control are being reproduced at scale, according to Arnica. The control problem is no longer code volume alone, but whether AppSec can treat AI-authored output as untrusted input before merge.
At a glance
What this is: Arnica argues that AI-generated code has outgrown manual review, creating an AppSec governance gap where insecure patterns are reproduced faster than security teams can inspect them.
Why it matters: AppSec and IAM teams need to treat AI-authored output as untrusted input because the same gap that lets insecure code ship also affects secrets, access logic, and agent-driven development workflows.
By the numbers:
- 82% of developers use or plan to use AI coding tools.
- AI-assisted pull requests on GitHub grew by 40% year-over-year.
Context
AI-generated code security is an application security governance problem, not just a developer productivity issue. When code is produced faster than review can keep up, the control point shifts from manual inspection to automated policy enforcement at pull request time. That matters because AI output can carry insecure defaults into production even when the intent behind its creation was benign.
The identity angle is real because the article also covers developer and AI agent identities, secrets, and repository-bound access. Once agents can open pull requests, touch CI/CD, and interact with secret stores, AppSec and IAM controls have to work together to govern who or what is allowed to change code, with what privilege, and under what review boundary.
Key questions
Q: What breaks when AI-generated code is reviewed without security gates?
A: What breaks is the assumption that a clean-looking diff is a safe diff. AI-generated code can hide unsafe defaults, dependency issues, and weak validation that basic review misses. Without CI-enforced tests and security checks, the merge process becomes a distribution channel for defects rather than a control point.
Q: Why does AI code generation create risk even when developers trust the output?
A: Because the model optimises for plausible code, not for your threat model or secure defaults. If training data contains insecure examples, the output can look correct while still embedding access control flaws or secret exposure. That makes human confidence a poor indicator of security quality, especially when acceptance rates are high and context is shallow.
Q: What do security and engineering teams get wrong about AI-assisted development?
A: They often confuse faster output with better control. AI assistants can generate code quickly, but they do not automatically preserve architecture, reuse patterns, or the source of truth. If teams only measure throughput, they may miss the fact that they are borrowing speed from the future and creating systems that are harder to govern.
Q: What happens when AI agents can modify code and secrets workflows?
A: The control boundary moves from developer intent to agent authorization. If an AI agent can open pull requests, modify CI/CD, or reach secret stores, then its identity and privilege scope must be governed like any other high-risk non-human identity. Otherwise, the agent can create or propagate insecure changes without a reliable human checkpoint.
Technical breakdown
Why AI-generated code reproduces insecure patterns
Large language models optimise for plausible and functional code, not for secure design. They learn from public repositories and examples that include hardcoded secrets, weak authorization checks, missing validation, and unsafe deserialization patterns, so those mistakes reappear when the prompt context makes them statistically likely. Because the model does not understand the application’s threat model, secure defaults, or governance requirements, it can generate code that looks correct but violates the environment’s security assumptions.
Practical implication: security teams need controls that inspect AI-generated output before merge, not after developers have accepted it.
Why manual review breaks at AI code volume
The core scaling problem is that AI suggestions arrive faster than human reviewers can inspect them, and acceptance rates are high enough that weak patterns can move quickly through pull requests. A reviewer may spot a defect in one file, but not at the volume created by thousands of AI-assisted changes per month. That creates a governance gap where review becomes a sampling exercise instead of a reliable control, especially when the codebase changes across many files and services at once.
Practical implication: shift review from human-only inspection to automated gates that run on every AI-touched file.
How agentic development changes the control boundary
Agentic development changes the problem because an AI agent can write code, open pull requests, modify CI/CD configuration, and interact with secrets managers without a person in the loop. That collapses the older assumption that a human author is always present to own intent and context. In practice, the control boundary moves from the commit history to the issuance and authorization step, where the system decides whether an AI agent may create, modify, or submit code and related infrastructure changes.
Practical implication: govern AI agent identities and permissions as tightly as developer access, especially where agents can reach secrets or deployment pipelines.
Threat narrative
Attacker objective: The attacker objective is to get insecure code or exposed credentials accepted into the software supply chain so they can later access systems, data, or privileged workflows.
- Entry occurs when a developer or AI agent ingests external context that carries insecure instructions or when an AI assistant generates code from shallow context.
- Credential exposure or insecure logic is introduced when the model reproduces hardcoded credentials, weak access control, or unsafe deserialization patterns.
- Escalation happens when the vulnerable code is accepted into a pull request and reaches CI/CD without an effective security gate.
- Impact is insecure application logic, leaked secrets, or compromised downstream systems after the flawed code is deployed.
Breaches seen in the wild
- AI LLM hijack breach: attackers used stolen AWS access keys to hijack Anthropic LLM models on Bedrock.
- 230M AWS environment compromise: 230M AWS environments compromised via exposed .env files with cloud credentials.
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
AI-generated code is becoming a governance problem before it is a tooling problem. The issue is not simply that models write flawed code, but that organisations often still assume review capacity can absorb the output. That assumption fails when code volume rises faster than AppSec staffing or workflow redesign, so the control model has to move to policy enforcement at generation and merge time.
The new governance gap is trust in AI-authored output. Treating suggestions as benign developer assistance creates the wrong control posture for a system that can reproduce insecure patterns from training data. AppSec teams should regard AI-written code as untrusted input, and the security model should reflect that before the code ever reaches a protected branch.
AI agent identity is now part of the AppSec boundary. Once agents can open pull requests or interact with secret stores, the question is no longer just what code was written, but what identity was allowed to write it. That brings NHI governance into the same conversation as application security, because agent permissions, provenance, and offboarding all affect whether risky changes can enter production.
Prompt injection and credential exposure are the same governance story at different layers. A model that reads hostile context can be driven to emit insecure code, and that output can then expose secrets or weaken access control. The named concept here is AI code trust gap: the mismatch between high developer confidence in generated code and low assurance in how that code was produced. Practitioners should close that gap with enforced policy checks, provenance tracking, and identity-aware controls.
From our research library:
- 90% of IT leaders say properly managing NHIs is essential for a successful zero-trust implementation, according to the Ultimate Guide to NHIs.
- By 2029, 40% of enterprises that successfully implement zero trust within cloud service provider environments will rely on the advanced visibility and control capabilities offered by CNAPP solutions.
- Read next: Ultimate Guide to NHIs — Lifecycle Processes for Managing NHIs
What this signals
AI code trust gap: AppSec programs now need to govern the gap between developer confidence and the assurance level of generated code. Automated merge-time controls matter because the risk is not just bad logic, but bad logic arriving faster than review can absorb it.
Agentic workflows make code security an identity problem as well as a scanning problem. When non-human identities can write, modify, and submit code, governance has to cover permissions, provenance, and offboarding, not just static analysis.
The operational signal for practitioners is simple: if your controls still assume a human author is always in the loop, they are already behind the risk model. Treat AI-authored code as a controlled input source and gate it accordingly.
For practitioners
- Enforce PR-time scanning on every AI-touched file Run SAST, dependency scanning, and secrets detection on every pull request that contains AI-generated or AI-assisted changes before merge.
- Track provenance for AI-assisted code Mark files and commits that were generated or modified by AI so security teams can target re-review when a vulnerability class appears later.
- Treat AI suggestions as untrusted input Apply the same approval standard to AI-authored code that you would apply to third-party contributions, especially where the code touches authentication or secrets handling.
- Scope AI agent permissions to code change tasks Limit AI agent identities so they can only access repositories, build systems, and secret stores required for the task they are performing.
- Add policy boundaries before merge Require a security policy gate that blocks commits when generated code introduces hardcoded credentials, weak authorization, or unsafe deserialization paths.
Key takeaways
- AI-generated code is creating a governance gap because insecure patterns can be reproduced faster than manual review can reliably catch them.
- The evidence in the article points to a scale problem, with 82% of developers using or planning to use AI coding tools and AI-assisted pull requests rising 40% year-over-year.
- The practical response is to move security enforcement to the pull request boundary, combine scanning with provenance tracking, and govern AI agent permissions as non-human identities.
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 OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | AI agents modifying code and secrets workflows create privilege and identity abuse risk. |
| Recommendation — Restrict agent privileges and audit any AI system that can open pull requests or touch secrets. | ||
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | The article highlights hardcoded credentials and secret exposure in generated code. |
| NHI-05 — Overprivileged NHI | Agentic development widens the blast radius when AI identities can write to repos and CI/CD. | |
| Recommendation — Scan AI-generated code for leaked secrets and block merge when credentials appear in source. Constrain AI agent access to the minimum repository and pipeline privileges required for the task. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | The governance gap involves who or what may submit code and reach secrets workflows. |
| Recommendation — Review entitlements for AI agents and developers so only approved identities can change production-bound code. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Secrets and credentials in generated code make credential lifecycle control directly relevant. |
| Recommendation — Manage authenticators so exposed or embedded credentials can be rotated and revoked quickly. | ||
| CIS Controls v8 | CIS-5 — Account Management | The article ties risk to the accounts and agent identities that can modify code and infrastructure. |
| Recommendation — Keep account inventories current and remove unnecessary access from AI and developer accounts. | ||
Key terms
- AI-generated code: Software produced wholly or partly by an AI model or agent rather than a human developer. The security concern is not authorship alone, but whether the resulting logic, access control, and dependency choices have been independently verified before release.
- Agentic Development Lifecycle: The Agentic Development Lifecycle is the control pattern for building, approving, deploying, and reviewing AI agents before they reach production. It extends software change discipline into identity governance by requiring traceability for creation, access grants, business purpose, and ongoing oversight.
- Prompt Injection (Agentic): An attack where malicious instructions are embedded in content that an AI agent reads, causing the agent to execute unintended actions using its own legitimate credentials. A primary vector for agent goal hijacking and identity abuse.
- Pull Request Gating: Pull request gating is the practice of requiring code to pass defined checks before it can be merged. It adds a review boundary after local development and helps prevent unsafe or low-quality changes from reaching shared branches. This control works best when paired with earlier feedback in the IDE or commit flow.
Deepen your knowledge
NHI Mgmt Group covers identity security, NHI governance, and agentic AI through independent research, practitioner guides, and the NHI Foundation Level course. Explore nhimg.org for resources that connect identity governance to the broader security disciplines your programme depends on.
Published by the NHIMG editorial team on August 18, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org