Artificial Intelligence

AI-generated code needs a quality gate

Coding assistants have changed how software gets written. A feature that took a day can appear in an hour, and it usually compiles, runs and reads well. That polish is the problem: code that looks finished gets less scrutiny, and the research says it still needs plenty.

By BuildQore · · 4 min read

What the research shows

56%

average security pass rate for AI-generated code

Across more than 100 models, with no security-specific prompting, and virtually unchanged from a year earlier. The code compiles; the gap is in security.

Source: Veracode 2026 GenAI Code Security Report (opens in a new tab)

Veracode tested code from more than 100 models, with no security-specific prompting. The average security pass rate was 56%, virtually unchanged from a year earlier. The code compiles. The gap is in security. Source: Veracode 2026 GenAI Code Security Report (opens in a new tab).

Developers have noticed. 46% say they actively distrust the accuracy of AI tools and only 33% trust it, while 84% use or plan to use them. Adoption has outrun confidence. Source: Stack Overflow Developer Survey 2025 (opens in a new tab).

Why problems slip through

An assistant answers the prompt it was given. It does not know your threat model, which data is sensitive, or who should be allowed to call a new endpoint. It also works quickly, so the volume of change grows while the time for review does not. The failures tend to be quiet ones that a passing test never touches:

  • A new route that works, with no authorisation check.
  • A database query built by joining strings.
  • An API key pasted into a configuration file.
  • A dependency that is outdated or does not exist, which an attacker could register under the invented name.
  • Tests that repeat what the code does, rather than check what it should do.

A gate in five steps

A quality gate is a set of checks every change must pass, whoever or whatever wrote it. It does not slow assistants down. It stops their speed from bypassing the safeguards you already rely on.

01 of 05

Own it

The person who prompted the code reads all of it and can explain it. If they cannot, it does not go forward.

The same gate applies to every change, however it was written.

Automate the first pass

This GitHub Actions workflow runs linting, tests, a dependency audit and static analysis with Semgrep on every pull request. Turn on secret scanning in your repository settings as well, and make these checks required so nobody can skip them on a busy day.

.github/workflows/quality-gate.yml
name: quality-gate

on:
  pull_request:

jobs:
  tests-and-dependencies:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run lint
      - run: npm test
      - run: npm audit --audit-level=high

  static-analysis:
    runs-on: ubuntu-latest
    container: semgrep/semgrep
    steps:
      - uses: actions/checkout@v4
      - run: semgrep scan --config auto --error

What the human reviewer looks for

Tools catch known patterns. They rarely catch logic that is wrong for your business, so reviewers should spend their attention there.

  • Who is allowed to do this, and where is that enforced?
  • What happens with missing, duplicated or hostile input?
  • Is every new dependency real, maintained and necessary?
  • Does a test fail when the behaviour is broken? Break it and see.

Where to start

You do not need to ban assistants or buy a platform. Make your existing checks mandatory, add static analysis and a dependency audit, and agree that nobody merges code they cannot explain. If AI-written code is already in production, begin with an independent review of the parts that handle authentication, payments and personal data, because that is where a missed check costs most.

Keep reading

All articles

Get new articles by email.

Occasional notes on building and testing software. No filler.

Used only for these updates. See the privacy policy.

Want this done on your project?

Tell us what you are building or fixing, and we will talk through how we could help.