By NHI Mgmt Group Editorial TeamDomain: Cyber SecuritySource: SonarPublished February 20, 2026

TL;DR: AI code security risk is now the dominant developer concern, with 57% worried about exposing sensitive company or customer data while only 37% of organisations have tightened code security practices, according to Sonar’s State of Code Developer Survey. The pattern points to a verification gap, not just an adoption gap: teams are generating faster than they can reliably review.


At a glance

What this is: Sonar’s developer survey says AI code risk is rising faster than code security controls, with developer concern, tool sprawl, and unreliable output all outpacing governance.

Why it matters: For IAM, NHI, and broader security programmes, this matters because ungoverned AI use creates the same control problem seen in shadow IT and shadow AI: authority, visibility, and verification diverge.

By the numbers:

👉 Read Sonar's State of Code Developer Survey on AI code security risk


Context

AI code security risk is not just a developer productivity issue. It is a governance problem created when organisations adopt generative tools faster than they can verify output, constrain access, and enforce consistent review across the development lifecycle. That creates a familiar security pattern: more capability at the edge, less control at the centre.

The article is about software development rather than identity infrastructure, but it still intersects with identity governance where AI usage occurs through personal accounts, fragmented toolchains, and weak accountability for who generated or approved code. That makes the topic relevant to IAM, PAM, and NHI teams because the same visibility and lifecycle questions appear whenever work is done outside managed enterprise identity boundaries.


Key questions

Q: How should security teams govern AI-generated code in production environments?

A: Security teams should treat AI-generated code as normal production code with extra provenance risk. Require architectural review, test coverage, static analysis, and approval before merge. Then bind the agent and the build pipeline to least privilege, short-lived credentials, and complete audit logging so implementation speed does not outrun control.

Q: Why do personal AI accounts create so much risk in enterprise environments?

A: Personal accounts bypass enterprise identity controls, so security teams lose visibility into who authorised access, what scopes were granted, and whether the session can be revoked. They also separate the data trail from the user’s corporate identity, which makes investigation, containment, and audit evidence much harder.

Q: What do security teams get wrong about AI-generated code risk?

A: They often focus on catching insecure output after code is written, which is too late for AI-native workflows. The more important control point is the moment the agent is allowed to initiate the action. If that step is not governed, testing becomes a detection layer rather than a prevention layer.

Q: Should organisations prioritise AI code verification before expanding AI use?

A: Yes. Expansion without verification simply scales risk faster than control. Organisations should first establish automated analysis, review gates, and accountable ownership for AI-assisted code, then broaden adoption. That sequence reduces security debt instead of creating a larger backlog of hidden flaws.


Technical breakdown

Why AI-generated code creates a verification problem

Large language models can generate code that is syntactically valid, logically plausible, and still insecure. That makes the failure mode harder to catch than obvious build breaks because reviewers may trust output that appears coherent. In practice, the risk is not simply that AI makes mistakes, but that it makes mistakes with enough confidence and structure to bypass casual review. This is why code security has to shift from reading output to validating behaviour, dependencies, and security properties before deployment.

Practical implication: insert deterministic security checks into the pipeline instead of relying on manual confidence in AI output.

How fragmented AI toolchains weaken governance

When developers use several AI tools across both corporate and personal accounts, governance fragments along with the workflow. Each tool may have different logging, retention, access controls, and data handling rules, which makes it difficult to know where sensitive code or prompts went. Personal accounts also create an identity boundary problem because the organisation cannot consistently apply policy, monitor usage, or revoke access. The result is a shadow AI pattern that mirrors other unmanaged technology sprawl.

Practical implication: catalogue AI tools, enforce enterprise accounts, and block unapproved consumer access paths for code work.

What vibe, then verify means for secure delivery

The article’s proposed pattern is a useful framing because it separates creative generation from deterministic assurance. The first phase allows AI to assist with drafting or refactoring, but the second phase requires automated verification for security, quality, and policy conformance. In security terms, verification must be mandatory, repeatable, and embedded in CI/CD rather than left to individual judgement. That approach does not eliminate AI risk, but it reduces the chance that plausible-looking output reaches production without scrutiny.

Practical implication: require automated verification gates in CI/CD before AI-generated code can merge or deploy.


Threat narrative

Attacker objective: The attacker’s objective is to exploit weak verification and governance gaps so insecure code or sensitive data is introduced into production workflows.

  1. Entry occurs when developers use AI coding tools through fragmented enterprise and personal accounts, creating an unmanaged path for sensitive prompts and source code.
  2. Escalation follows when plausible but unreliable output is accepted into the build or review process without rigorous verification, allowing security defects to persist.
  3. Impact emerges when insecure code reaches production, increasing the chance of data exposure, compliance failure, or downstream compromise.

NHI Mgmt Group analysis

AI code security has become a governance issue, not just a developer quality issue. When organisations let generative tools into the software lifecycle without stronger verification, they create a control gap that looks like productivity but behaves like risk accumulation. The problem is not the model alone. It is the absence of enforceable review, policy, and accountability across the workflow. Practitioners should treat AI-assisted development as a governed security process, not an informal productivity layer.

Shadow AI in development is an identity problem as much as a tooling problem. The use of personal accounts across multiple AI tools breaks the organisation’s ability to apply lifecycle controls, audit activity, or revoke access cleanly. That mirrors familiar NHI governance failures where service identity sprawl outruns oversight. The named concept here is AI toolchain identity sprawl: unmanaged accounts and tools that fragment accountability, obscure data handling, and weaken control enforcement. Teams should manage AI access as part of enterprise identity governance.

The core failure is verification trust, not model intelligence. Developers can recognise that output looks correct while still being unable to validate its security properties reliably. That means the security programme should stop assuming review alone can catch AI-induced defects at scale. Deterministic checks, policy gates, and security testing need to become the default control plane for AI-assisted code. Practitioners should judge AI by how well they can verify it, not by how fluent it sounds.

This pattern validates a broader shift toward governed augmentation. AI will continue to expand in software delivery, but the enterprises that stay secure will be the ones that constrain where AI can operate, what accounts it uses, and how output is approved. The market signal is clear: governance now has to reach into the workflow boundary, not just the perimeter. Practitioners should align AI adoption with identity, access, and verification controls from the start.

What this signals

AI toolchain identity sprawl: when developers use multiple AI tools through mixed corporate and personal accounts, governance fragments faster than most security teams can track it. That is the same structural problem seen in unmanaged NHI estates, where visibility and lifecycle control disappear as usage grows. The relevant next step is to bring AI access into the same governance model used for privileged and non-human access, supported by the NIST Cybersecurity Framework 2.0.

The practical signal for security leaders is that verification control now matters as much as adoption control. Teams that cannot prove where code was generated, which account accessed the tool, and what checks ran before merge will struggle to defend the programme in audit or incident response. That makes identity-centric logging and policy enforcement foundational, not optional.

Where AI-assisted development intersects with secret handling or privileged automation, the control discussion should extend beyond code review into lifecycle governance. The right benchmark is whether every account, token, and workflow used by engineering can be discovered, approved, and revoked with the same discipline applied to other critical access paths.


For practitioners

  • Enforce enterprise-only AI access for development work Require managed corporate identities for all code-generation tools, disable personal account use for source code tasks, and log tool access centrally. Treat consumer accounts as an unmanaged access path that cannot satisfy audit or incident response needs.
  • Insert automated verification gates before merge and release Make static analysis, secret scanning, dependency checks, and security testing mandatory for AI-generated code before it reaches main branches or deployment pipelines. Verification must be deterministic, not dependent on developer confidence.
  • Track AI tool sprawl as a governance metric Inventory every AI tool used by engineering teams, identify which are approved, and measure how much usage occurs outside enterprise tenancy. This exposes shadow AI patterns and supports policy enforcement.
  • Separate generation from approval authority Ensure the person or workflow that uses AI to draft code is not the only control approving its release. Add independent review, policy checks, and security sign-off for high-risk changes.

Key takeaways

  • AI code security risk is growing faster than the controls meant to manage it.
  • Fragmented AI tool use and personal accounts create a governance gap that looks like convenience but behaves like shadow AI.
  • Automated verification, managed accounts, and enforced review gates are now the minimum defensible pattern for AI-assisted development.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5, NIST AI RMF and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0PR.AC-4Identity and access control matter because personal AI accounts weaken governance.
NIST SP 800-53 Rev 5AC-6Least privilege is directly relevant to controlling who can use AI coding tools.
NIST AI RMFGOVERNAI governance is central because code generation introduces policy and accountability risk.
CIS Controls v8CIS-5 , Account ManagementAccount management is necessary when developers use multiple AI tools and personal accounts.
MITRE ATT&CKTA0006 , Credential Access; TA0010 , ExfiltrationUnmanaged AI use can expose source code and credentials through trusted workflows.

Map AI workflow abuse to credential access and exfiltration tactics during threat modelling.


Key terms

  • 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.
  • AI Toolchain Identity Sprawl: A condition where teams rely on multiple AI tools and mixed personal or corporate accounts, making access governance fragmented and inconsistent. It weakens the organisation’s ability to enforce policy, audit activity, and revoke access across the development lifecycle.
  • Security Debt: Accumulated risk that builds when vulnerabilities, unsafe dependencies, and policy gaps are left unresolved across the software lifecycle. In AI-assisted development, security debt grows quickly because more code is produced, more decisions are made automatically, and remediation often lags behind delivery.
  • Deterministic Verification: A verification method that produces the same enforced result every time when the required proof is present, instead of relying on human judgement or probabilistic signals. It is useful for high-blast-radius access changes because it removes discretion from the decision point.

What's in the full report

Sonar's full report covers the operational detail this post intentionally leaves for the source:

  • Chapter-level survey findings on how developers, juniors, and senior engineers differ in their AI security concerns.
  • Breakdowns of AI-related toil, technical debt, and the review burden that follows AI-generated code.
  • Data on direct and indirect prompt injection concerns across enterprise and SMB organisations.
  • The report's discussion of agentic workflows and how they are changing developer accountability.

👉 Sonar's full report covers the developer survey detail, chapter findings, and AI workflow implications behind the summary.

Deepen your knowledge

The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, identity lifecycle, and secrets management. It helps security practitioners build the control discipline needed to govern access and verification across modern digital workflows.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 20, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org