Insight / Verifying AI-generated code

Why AI-generated code needs independent verification

AI writes code faster than any team can read it. The research says speed is not the problem. Unchecked confidence is.

Swallowtail Systems™  /  Published November 30, 2026  /  3 min read

Key points
  • In Veracode's 2025 tests of more than 100 models, 45 percent of coding tasks produced code with a known security flaw.
  • A Stanford user study found people using an AI assistant wrote less secure code and were more likely to believe it was secure.
  • Verification has to be independent of the tool that wrote the code, and every finding has to be checkable by your own team.

What the research says

The clearest controlled evidence comes from Veracode's 2025 GenAI Code Security Report. Its researchers gave 80 coding tasks to more than 100 large language models. Each task could be completed safely or unsafely. Across all models and tasks, only 55 percent of generations were secure; in 45 percent, the model introduced a known flaw such as SQL injection or cross-site scripting 1. Newer and larger models did not do significantly better on security, even as they got better at writing code that runs 1.

The human side is just as important. In a user study published at ACM CCS 2023, Stanford researchers found that participants with access to an AI assistant wrote significantly less secure code on most of the security tasks studied, and were more likely to believe their code was secure 2. The tool changed the code and the confidence at the same time.

45 percent of AI coding tasks introduced a known security flaw.Veracode, 2025 GenAI Code Security Report 1

Developers sense this. In Google's 2025 DORA research, 90 percent of technology professionals reported using AI at work, and 30 percent reported little or no trust in AI-generated code 37. GitGuardian's 2026 secrets research found that commits co-authored by one popular coding agent leaked secrets at roughly twice the baseline rate 4.

Why review by the same tool is not enough

Many AI builders now scan their own output before publishing. That is a good default and it catches real problems. It does not replace an independent check, for three reasons.

  • Shared blind spots. A model that chose an unsafe pattern while writing may not flag the same pattern while reviewing.
  • Missing context. Whether a database rule is too open depends on who should see the data. That is a business fact, not a code fact.
  • No accountable reader. A finding nobody reads changes nothing. Someone with authority has to decide what gets fixed and when.

What good verification looks like

We think of verification as producing evidence, not opinions. A finding is useful when your own team can reproduce it and confirm the fix. That means four things for every item: the file or configuration, the risk in plain words, a severity, and the fix. Findings should be organized in a frame your security team already uses, such as the OWASP Top 10:2025 for web applications and the OWASP Top 10 for LLM Applications 2025 for AI features 56.

The review should look first where AI-built software tends to fail: access control, secrets, database and storage rules, sign-in, payment logic, third-party packages and the AI features themselves. These map closely to the top of the OWASP list, where Broken Access Control is ranked first 5.

For teams shipping AI-built software

What this means for your team

  1. Treat AI-generated code as unreviewed code, whoever or whatever wrote it.
  2. Ask for findings your team can verify, with the file, the risk, the severity and the fix.
  3. Separate the reviewer from the tool that wrote the code.
  4. Put a named owner on every critical and high finding, with a date.

This is Swallowtail Systems™ analysis of public sources. Figures belong to the organizations cited, and we link every one. Nothing here describes a client engagement.

Sources

  1. Veracode, 2025 GenAI Code Security Report (July 2025)
  2. Perry, Srivastava, Kumar and Boneh, "Do Users Write More Insecure Code with AI Assistants?", ACM CCS 2023
  3. Google Cloud DORA, State of AI-assisted Software Development 2025
  4. GitGuardian, The State of Secrets Sprawl 2026
  5. OWASP Top 10:2025
  6. OWASP Gen AI Security Project, Top 10 for LLM Applications 2025
  7. Google, "How are developers using AI? Inside Google's 2025 DORA report" (Sep 23, 2025)

/ Next step

Want this read against your own systems?

In a 30-minute briefing we walk through what we would look for in your environment and what a written scope would include.

Request a briefing