By NHI Mgmt Group Editorial TeamBased on Checkmarx: “Cursor Is Changing How Developers Build. Security Has to Change Too.” (May 4, 2026)

TL;DR: AI coding tools can generate functions, fixes, and dependency changes in seconds, shifting developers from authors to reviewers and creating a gap where insecure patterns, secrets, and risky packages can enter code faster than traditional AppSec checks, according to Checkmarx. The review step is now the security choke point, not the build pipeline.


At a glance

What this is: AI-assisted coding is turning developers into reviewers of machine-generated changes, creating a faster path for insecure patterns and risky dependencies to reach code review.

Why it matters: AppSec teams need to move security validation earlier because the acceptance step, not the pipeline alone, is now where AI-generated risk is most likely to slip through.


Context

AI-generated code changes the security problem from post-write review to pre-acceptance validation. When developers prompt a coding assistant to generate functions, refactors, or dependency updates, they inherit responsibility for code they did not author line by line, which increases the chance that security defects are accepted before traditional controls see them. This is an application security governance issue, but it also matters to IAM and NHI teams because generated code can introduce secrets, credentials, and privilege-related mistakes into software delivery.

The core gap is timing. If security checks only run after merge, they are increasingly blind to the point where developers decide whether AI-generated changes are acceptable. That makes review quality, not raw generation speed, the control boundary that matters most. In practice, organisations need to treat AI-assisted development as a change in the review model, not just a productivity feature.


Key questions

Q: What breaks when AI-generated changes are reviewed only at merge time?

A: Merge-time review fails because AI-driven pipelines can create code, dependencies, workflows, and infrastructure in one step. By the time a human sees the change, the underlying security decisions may already be embedded across multiple artefacts. Teams need controls at generation, build, and runtime, not only at approval.

Q: Why do AI coding tools increase secrets risk?

A: AI coding tools increase secrets risk because they can accelerate the reuse of insecure patterns across repositories, test fixtures, and automation scripts. The issue is not the model inventing credentials, but the way generated code can spread bad defaults faster than human review can catch them.

Q: What signs show AI-assisted development is outpacing security review?

A: The clearest signs are rising pull request size, fewer but denser merges, more findings per change, and an increase in privilege or secret-related defects. If review queues are growing while the number of touches per merge also increases, the process is losing inspection quality. That usually means the team is measuring throughput, not control effectiveness.

Q: How should security teams use AI-generated code fixes without losing control of AppSec risk?

A: Treat AI-generated fixes as draft remediation, not authoritative change. Security teams should keep the same review, test, and approval gates they use for any vulnerable code change, with extra scrutiny for authentication, secrets, and privilege logic. The goal is to reduce remediation time without weakening assurance or bypassing ownership.


Technical breakdown

Why AI-generated code changes the AppSec control point

AI coding assistants can produce complete functions, dependency changes, and multi-file edits at a pace that outstrips manual authoring. That shifts developers from primary authors to reviewers and orchestrators, which means the security function moves from creating code to validating code they did not fully compose. Traditional AppSec assumes review follows authorship and that humans retain enough context to spot risk. With AI-generated output, the context window can be broader and the acceptance decision is compressed, so security defects can be approved before downstream scanning ever begins.

Practical implication: move security checks into the editor and review workflow, not just into post-commit pipelines.

Which risks AI assistants can introduce into the codebase

AI-generated output can include insecure patterns, weak authentication logic, outdated dependencies, vulnerable package versions, exposed secrets, and infrastructure-as-code misconfigurations. Those risks are especially dangerous because they often look syntactically valid and can be spread across several files or services in one interaction. From an identity security perspective, secrets and credentials embedded in generated code create immediate NHI exposure, while poor authentication logic can weaken both human and service-to-service trust. The problem is not that the model is malicious by default, but that it can reproduce unsafe patterns at machine speed.

Practical implication: validate generated code for secrets, auth logic, and dependency trust before it is accepted.

Why after-the-fact scanning is no longer enough

Pull request, CI/CD, and post-merge scanning still matter, but they are increasingly late in the decision chain. By the time a vulnerability is detected there, the developer may already have accepted the code, moved on, or lost the rationale for the change. That delay matters because AI-generated changes are often accepted in larger batches than hand-written edits, which increases the blast radius of a missed issue. Security has to be present at the moment of acceptance, when the reviewer still understands the intended change and can reject unsafe output before it enters the main branch.

Practical implication: combine pre-acceptance validation with downstream scanning so the same issue is caught before and after merge.


Threat narrative

Attacker objective: The objective is to get unsafe code, exposed secrets, or vulnerable dependencies accepted into the codebase before security review can stop them.

  1. Entry occurs when a developer prompts an AI assistant to generate or modify code, including dependencies or infrastructure files.
  2. Credential exposure, insecure authentication logic, or risky package choices can be embedded in the generated output and accepted during review.
  3. The risky code then moves through the pipeline faster than traditional AppSec checks can correct it, increasing the chance of production exposure.
  4. The impact is insecure software delivery, including secrets leakage, vulnerable dependencies, and weakened application trust boundaries.
  • Checkmarx KICS supply chain attack 2026: Credentials stolen via Trivy let attackers poison Checkmarx KICS Docker images, VS Code extensions and Actions to steal developer secrets.
  • Fake Dependabot commits 2023: Stolen GitHub tokens were used to push fake Dependabot commits to hundreds of repos, adding workflows that stole Actions secrets.

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 has created a review governance problem, not just a coding productivity problem. When the developer is no longer the sole author, the review function becomes the primary control boundary. That matters because review quality depends on context, and AI-assisted changes often arrive in volumes that exceed human attention. The practical conclusion is that application security now has to govern acceptance decisions, not merely scan finished artefacts.

Secrets and authentication defects are the most immediate identity risk in AI-assisted development. Generated code can carry exposed credentials, weak authentication logic, and dependency updates that expand the trusted surface of the application. In NHIMG terms, this is where human application workflow intersects with NHI exposure, because credentials, tokens, and keys are often the easiest security boundary to lose in generated output. Practitioners should treat generated code as a potential secret-handling event.

The named concept here is review gap compression: the interval between code generation and security validation is shrinking until post-merge controls can no longer reliably compensate. That is a control design problem, not a tooling preference. Teams that still assume review happens after authorship are working from an outdated operating model, and the right response is to shorten the security feedback loop to the acceptance moment.

Multi-file AI changes increase the chance of correlated failure across code, dependencies, and infrastructure. A developer may approve one seemingly useful change while missing the combined effect across several files, packages, or services. That is why code review, dependency trust, and configuration review now need to be analysed together. The conclusion for practitioners is straightforward: treat large AI-generated diffs as compound risk, not as isolated edits.

Machine-speed generation does not eliminate accountability, it intensifies it. Developers remain responsible for what they accept, but the organisation must now give them controls that match the pace of AI-assisted work. That means governance has to extend into the IDE, the review workflow, and the policy layer that decides which generated changes are acceptable. Practitioners should align security controls with the point of human acceptance, not the point of code commit.

From our research library:

What this signals

Review gap compression: AI-assisted development shortens the time between code creation and code acceptance, so security teams have less room to rely on downstream scanning alone. The practical shift is toward inline validation inside the developer workflow, where risky dependencies, secrets, and insecure patterns can be stopped before they become committed state.

In identity terms, generated code can turn secrets handling into an accidental control failure. When AI suggests package updates, auth logic, or configuration changes, the reviewer becomes the last defence for tokens, keys, and other machine credentials, which means developer education and editor-level controls now matter as much as pipeline policy.


For practitioners

  • Embed security checks in the editor Surface findings while developers are still reviewing AI-generated changes, so insecure patterns and risky dependencies are caught before acceptance.
  • Gate acceptance of generated code Require explicit validation for multi-file AI changes, dependency upgrades, and infrastructure edits before they can be merged or committed.
  • Scan AI output for secrets and credentials Treat generated code as a possible credential exposure path and check for tokens, keys, and embedded secrets at the point of review.
  • Review dependencies as trust decisions Inspect package recommendations from AI assistants for provenance, maintenance status, and suspicious behaviour before allowing them into production code.
  • Align AppSec with developer workflow Place validation where the developer is already deciding whether to accept the change, because that is where AI-generated risk is easiest to stop.

Key takeaways

  • AI-generated code changes the AppSec problem from author review to acceptance control, which makes the review step the decisive security boundary.
  • The risk is not abstract. Generated output can carry insecure patterns, weak authentication logic, exposed secrets, and risky package choices into the codebase faster than downstream checks can react.
  • Security teams need validation in the developer workflow itself, with downstream scanning kept as a second line of defence rather than the first time risk is seen.

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 and OWASP API Security Top 10 address the attack and risk surface, while OWASP ASVS and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageGenerated code can surface exposed secrets and credentials before review catches them.
NHI-04 — Insecure AuthenticationThe article highlights weak authentication logic created or accepted through AI-generated code.
Recommendation — Scan AI-generated diffs for exposed secrets and revoke any credentials found in accepted code. Review generated authentication flows for unsafe assumptions before they reach production.
OWASP API Security Top 10API2 — Broken AuthenticationAI-assisted code can introduce authentication flaws in application and API paths.
Recommendation — Test generated API changes for broken authentication before merge and release.
OWASP ASVSV6 — AuthenticationThe article focuses on validating authentication logic during code review.
Recommendation — Apply ASVS authentication requirements to generated code before accepting it.
CIS Controls v8CIS-16 — Application Software SecurityThe problem is insecure code entering the software lifecycle too quickly for downstream controls.
Recommendation — Use application software security controls to shift validation into the developer workflow.

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.
  • Review gap compression: The shrinking window between code generation and security validation. As AI systems produce larger changes faster, downstream checks have less opportunity to prevent insecure code from being accepted, so the security control must move closer to the developer’s acceptance decision.
  • Secrets Management: The discipline of securely storing, distributing, rotating, and auditing secrets across an organisation's systems and pipelines, typically implemented via a centralised secrets vault such as HashiCorp Vault, AWS Secrets Manager, or Akeyless.
  • Authentication logic: The code paths that establish and verify identity for users, services, or APIs. When AI-generated output introduces weak authentication logic, the issue is usually a design or implementation flaw that undermines access control even if the code appears functionally correct.

Deepen your knowledge

The NHI Foundation Level course covers NHI governance, secrets management, and agentic AI identity through the industry's only accredited NHI security programme. It helps security and identity practitioners align review controls with the risks created by AI-assisted development.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 2, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org