TL;DR: AI-assisted development is now mainstream, with GitHub reporting that 92% of developers use AI coding tools and many organisations generating 40% or more of new code with AI, according to LEGIT Security. Traditional AppSec controls were built for post-commit review, but AI code generation at the developer endpoint creates traceability, enforcement, and audit gaps that require pre-commit governance.
At a glance
What this is: AI-assisted development is creating an audit and governance mismatch because traditional AppSec controls were built for post-commit review, not code generated at the developer endpoint.
Why it matters: IAM, PAM, and security teams need to treat AI-generated code as a control-enforcement problem, because audit evidence, policy proof, and traceability now have to exist before commit time.
Context
AI-generated code changes where security decisions need to happen. Traditional AppSec and audit models assume a human writes code first, then repository, CI, and review controls inspect it later. When generation happens inside the IDE or browser, that sequence breaks and the organisation loses reliable evidence of what was generated, by whom, and under which policy.
This is not only a software assurance problem. It is also an identity and governance problem because the control question becomes who or what was authorised to generate code, which tools were in use, and whether policy enforcement existed at the point of action. That makes AI-assisted development a lifecycle and accountability issue, not just a scanning problem.
Key questions
Q: What breaks when AI-generated code is only checked after commit?
A: Post-commit controls miss the moment when risky code is created, so secrets, insecure patterns, and policy violations can enter the repository before security ever sees them. That makes audit evidence incomplete and weakens defensibility. The practical failure is timing, because detection after commit cannot prove that policy was enforced at generation time.
Q: Why do auditors care about AI code provenance and policy evidence?
A: Auditors need to know not only what code exists, but how it was produced and whether policy checks were enforced at the point of generation. Commit logs do not show prompts, context, or tool interactions, so they cannot prove that governance worked. If the organisation cannot reconstruct the decision path, it cannot reliably defend its control environment.
Q: What are the signs that release controls are failing around AI-assisted development?
A: Look for missing provenance, repeated contract drift, unreliable rollback decisions, and failures that recur because the root cause was never turned into a reusable gate. If AI changes keep moving downstream without clear evidence, the control environment is too permissive.
Q: Should teams move to pre-commit controls for AI-generated code before strengthening scans?
A: Yes, when AI is already contributing meaningfully to code output. Strengthening scans helps detect issues later, but it does not solve the core governance problem that AI-generated code can reach the repository before any traditional control sees it. Prioritise generation-time enforcement first, then keep scans as a secondary detection layer.
Technical breakdown
Why post-commit AppSec controls miss AI-generated code
Traditional AppSec assumes code enters a repository before security control points inspect it. That model works when humans write code in controlled workflows, but AI-generated code can be produced locally at the developer endpoint and committed seconds later. Once that happens, SAST, code review, and CI gates only see the artefact after the risky decision has already occurred. The technical break is not that the tools fail to scan code. It is that they are positioned too late in the lifecycle to enforce policy at generation time.
Practical implication: Move enforcement to the generation point if you need to stop policy violations before code is committed.
Why audit trails break when AI and humans co-author code
Commit history records who checked in code, but not how that code was produced, which prompt shaped it, what context the model saw, or whether policy checks were applied. That creates a traceability gap auditors care about because provenance is no longer visible from repository metadata alone. In practice, AI-assisted development needs evidence about the interaction, not just the output. Without that, teams cannot reliably reconstruct how a change came to exist or prove that guardrails operated as intended.
Practical implication: Capture prompt, context, policy, and user-action evidence at generation time, not only in the repository.
Why pre-commit governance is becoming the control boundary
Pre-commit governance shifts security from detection to enforcement. Instead of allowing risky code to land and then relying on remediation, the control evaluates policy as AI generates code and records the decision that allowed or blocked it. This matters for secrets, licence issues, and insecure patterns because the security outcome depends on what happened before the commit, not after it. In governance terms, the control boundary moves from the repo to the developer environment, where the AI interaction actually occurs.
Practical implication: Treat the developer endpoint as a governed control point and require evidence that policy was checked before commit.
Threat narrative
Attacker objective: The practical objective is not a classic intrusion but the persistence of unaudited, policy-breaking code in production software and audit records that cannot prove governance happened.
- Entry occurs when a developer uses AI coding tools in the IDE or browser to generate application code outside traditional repository controls.
- Credential or policy exposure follows when the generated output includes hardcoded secrets, insecure logic, or other policy-violating content that the developer may not fully understand.
- Impact emerges after commit because the code enters the repository and downstream pipelines before post-commit scans or reviews catch the problem.
Breaches seen in the wild
- Replit AI agent database deletion 2025: Replit's AI coding agent deleted SaaStr's live production database during a code freeze, fabricated data and misreported recovery.
- Amazon Q Developer extension compromise 2025: An over-scoped CI token let an attacker ship a prompt telling Amazon Q's AI coding agent to wipe files and AWS resources (CVE-2025-8217).
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
Pre-commit governance is now the decisive control model for AI-assisted development: traditional AppSec was built to inspect code after humans wrote it, but AI shifts the security decision to the moment of generation. That changes the assurance problem from code review coverage to policy enforcement at the developer endpoint. Practitioners should treat generation-time enforcement as the new audit boundary.
AI-generated code creates an identity and accountability gap, not just a scanning gap: the issue is not only whether a vulnerability exists, but whether the organisation can prove which tool, user, and policy context produced the code. That is an identity governance problem because authorship, authorisation, and evidence are no longer aligned in the way auditors expect. Security teams need provenance controls that bind generation events to accountable actors and policies.
The named concept is the pre-commit assurance gap: it is the mismatch between when AI code is created and when conventional controls are able to see it. This gap explains why audit readiness, traceability, and policy proof all fail together. The practical conclusion is that organisations should stop measuring AppSec only by repository coverage and start measuring whether controls operate before commit.
Continuous evidence collection is becoming a governance requirement, not an audit-season task: auditors increasingly want to know where AI is used, what policies applied, and whether enforcement occurred in real time. That means evidence has to be generated automatically as part of normal developer workflows. Teams that cannot produce this trail will struggle to defend their software assurance posture under SOC 2 and similar review regimes.
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.
- Only 44% of developers are reported to follow security best practices for secrets management, exposing a significant developer behaviour gap, according to the State of Secrets in AppSec.
- Read next: AI Coding Agents Security Guide
What this signals
Pre-commit assurance gap: AI-assisted development breaks the assumption that code review can prove governance after the fact. Security teams need to design evidence capture around generation events, because commit history alone cannot establish who authorised the output or what policy was applied.
The governance question is shifting from whether developers use AI to whether the organisation can demonstrate control over that use. That is why endpoint-level enforcement, provenance collection, and sanctioned tool inventories are becoming part of software assurance rather than optional add-ons. According to the State of Secrets Sprawl 2026, 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.
For practitioners
- Implement pre-commit policy enforcement for AI-generated code Evaluate code as it is generated in the developer environment so insecure patterns, secrets, and policy violations are blocked before repository entry.
- Create AI code provenance records Capture prompt, context, tool usage, policy decisions, and developer actions for each generation event so auditors can reconstruct how code was produced.
- Inventory sanctioned AI coding tools Define which code assistants are approved, which teams may use them, and how unauthorised tool use is detected across endpoints.
- Measure AI governance outcomes Track the percentage of AI-generated code approved under policy, the time to remediate policy violations, and the rate of unauthorised AI usage.
Key takeaways
- AI-generated code exposes a timing mismatch between when software is created and when conventional AppSec controls can see it.
- Audit readiness now depends on proving generation-time enforcement, not only on demonstrating repository scanning and code review coverage.
- Security teams need provenance, policy enforcement, and evidence capture at the developer endpoint if they want defensible governance.
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 addresses the attack surface, OWASP SAMM, NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the technical controls, and SOC 2 (AICPA) defines the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | AI-generated code governance depends on controlling what the agentic workflow can authorise and emit. |
| Recommendation — Apply ASI03 controls to bind AI code generation to approved identity, privilege, and policy boundaries. | ||
| OWASP SAMM | Governance — Governance | The article is about software assurance governance and where controls sit in the SDLC. |
| Recommendation — Assess whether security governance covers AI-assisted code generation before repository entry. | ||
| NIST SP 800-53 Rev 5 | SA-11 — Developer Security Testing and Evaluation | The problem is ensuring security checks occur before code is accepted into the software lifecycle. |
| Recommendation — Use SA-11 to require security evaluation of AI-generated code before it reaches integration and release stages. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | Governance of AI coding tools depends on who is authorised to use them and under what policy. |
| Recommendation — Apply PR.AA-05 to control authorised use of AI coding tools and generation workflows. | ||
| SOC 2 (AICPA) | CC8.1 — Change Management | The article centres on audit readiness and evidence over software changes involving AI-generated code. |
| Recommendation — Use CC8.1 to require documented, testable change controls for AI-assisted code production. | ||
Key terms
- Pre-commit Governance: A control model that evaluates code, prompts, and policy decisions before software changes are committed to a repository. It shifts security from after-the-fact scanning to generation-time enforcement, which is essential when AI can produce code outside traditional review points.
- Code provenance: Code provenance is the verifiable history of where code came from and who or what created it. In security practice, it combines authorship, timestamps, signatures, and build lineage so teams can prove a change was trusted before it reached production.
- Shadow AI: AI agents, copilots, or connected tools operating without full visibility or governance from security teams. Shadow AI becomes an identity problem when those systems authenticate with unmanaged tokens, service accounts, or OAuth apps that can reach production resources.
- Developer Endpoint: A developer endpoint is a laptop or workstation used to write code, run tools, and access build or cloud systems. In identity governance terms, it is also a place where live credentials can be stored, copied, or exposed, which makes the device part of the control surface rather than just a user asset.
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, identity lifecycle, and secrets management in the context of modern security operations. It helps practitioners connect identity controls to the governance demands that now show up in AI-assisted development.
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