
Updated November 2026. Victor Sowers leads growth at Pixee.
To audit AI-generated code, run the same deterministic checks you trust for human code on every change (static analysis, dependency scanning and secret detection). AI-only scans never flagged the vulnerable dependency in Replit's tests and gave different answers on the same code. Then triage what the scanners report for exploitability, and send every fix through review and CI before it merges.
In January, Replit published research showing something security engineers already suspected: AI can't reliably audit its own code.
Their team compared the built-in "security scans" of two competing vibe coding platforms, the AI-powered development environments promising full-stack applications in minutes, against Replit's own deterministic scanner. Here's what they found.
Dependency vulnerabilities. Replit tested one vulnerable dependency, 10 runs per scanner: 0% detection by AI-only scanners. Not low detection. Zero.
Secrets embedded in JSX literals. Missed entirely. Move that same secret to a variable assignment? One of the two AI scanners caught it. Rename the variable from key to myValue, and the paper notes the model's read can change again.
Same code, same scanner, 10 runs. One AI scanner's results changed from run to run.
That last finding is the architectural problem. Security scanning needs to be deterministic. When the same input produces different outputs, you have a slot machine.
Large language models analyze code through interpretation, not structural pattern matching. They judge via statistical associations, perceived intent, and natural language cues rather than deterministic rules.
In most contexts, non-determinism works fine. For security scanning, it's a fundamental limitation.
Replit's experiments tested code variants that were functionally identical but syntactically different. These are the results from the paper:
Source: Feng, "Securing AI-Generated Code," Replit, January 2026, sections 3.1 to 3.4. Each scan ran 10 times on identical code; the XSS row also varied the prompt.
Identical vulnerability. Same security risk. Different detection outcomes based on syntax that has nothing to do with exploitability.
Replit sells the deterministic-plus-LLM approach it tested, and the paper calls itself an informal case study rather than a benchmark.
Traditional static analysis tools (SAST scanners like CodeQL, Semgrep, or SonarQube) operate differently. They parse source code into an abstract syntax tree and match patterns against structural rules.
Same code, same rule set, same findings. Every time. Regardless of variable names, formatting, or how "obvious" the vulnerability appears.
That determinism is what makes security scanning auditable. When a deterministic scanner makes a mistake, you can trace the exact rule logic that failed and fix it. When an AI scanner makes a mistake, you're debugging statistical inference.
The same holds for AI that makes security decisions further downstream. Production AI triage needs its own validation, a step most "AI-powered" tools skip entirely.
Replit's research identified three specific failure modes where AI-only scanning breaks down.

AI-only scanners never flagged the vulnerable dependency in Replit's tests.
This isn't surprising. Identifying a vulnerable dependency requires:
• Parsing the lockfile to identify exact package versions
• Querying a vulnerability database (NVD, GitHub Advisory, OSV) in real time
• Matching version ranges to affected versions
• Determining whether the vulnerable code path is reachable in your application
Most of this is database lookup and version comparison, exactly what deterministic tools excel at and LLMs can't reliably perform.
Replit tested this specifically with CVE-2024-24558, a cross-site scripting vulnerability in @tanstack/react-query-next-experimental 5.17.0 that GitHub's advisory rates HIGH (versions from 5.0.0 up to, but not including, the 5.18.0 fix are affected). The AI-only scanners didn't flag it. They had no reliable way to. Flagging it means matching the installed version against the advisory's affected range, and the AI-only scans had no live vulnerability feed to match against, which the paper calls a capability gap.
Much of your application code comes from dependencies you didn't write. If your security scanning can't see dependency vulnerabilities, it's missing a large share of your attack surface.
Embedding secrets directly into JSX literal text bypassed AI-only scanners entirely. The same secret stored in a variable assignment was sometimes detected.
This happens because LLMs detect secrets through pattern recognition of what "looks like" a credential. A variable named key or api_key triggers the association. A raw string inside JSX markup doesn't.
Deterministic secret scanners use different approaches: entropy analysis (high-randomness strings), pattern matching (known credential formats like AWS keys), and structural rules (assignments to variables matching specific names). These methods catch the secrets they cover regardless of where they appear in code, whether in a variable, a literal, a configuration file, or a comment.
Developers don't always follow the patterns LLMs expect. Debugging code, rapid prototyping, copy-paste from documentation. These real-world scenarios produce code that doesn't match the "tidy" patterns in LLM training data.
Replit's research revealed that AI-only scanner coverage depends heavily on prompt phrasing. When explicitly instructed to "analyze the code for XSS and unsafe HTML rendering," one of the scanners often found dangerouslySetInnerHTML usage. Under generic prompts like "review this project for security issues," detection became inconsistent.
This creates a structural problem. AI-only scanner coverage is bounded by what the user already knows to ask about. Security scanning should find the vulnerabilities you don't know to look for.
Deterministic tools don't have this limitation. Their coverage is defined by their rule set, applied uniformly to all code. You don't need to know about every vulnerability class to detect them. The scanner's rules do.
Other studies point the same way from the generation side.
Tenzai tested five AI coding agents (Cursor, Claude Code, OpenAI Codex, Replit and Devin) in December 2025 and found 69 vulnerabilities across the apps they built. The agents avoided basic security mistakes (no exploitable SQL injection or XSS, the classes frameworks already guard against) but failed at business logic, authorization and context-dependent security issues.
CodeRabbit's December 2025 report analyzed 470 open-source pull requests and found about 1.7× more issues overall in AI-co-authored code than in human-only code, with security issues up to 2.74× higher. The most prominent patterns were improper password handling and insecure object references. The second is an authorization flaw, and catching it takes context from outside the immediate code being written.
OX Security describes AI coding assistants as an "army of juniors." Its October 2025 analysis of 300+ repositories found AI-generated code doesn't carry more vulnerabilities per line than human code. The risk is speed. In my experience, they're fast, tireless, and produce syntactically correct code. But they share the junior developer's blind spot, optimizing for the problem they can see, not the security implications they can't access.
The pattern is consistent: AI excels at generating code that solves the immediate problem. AI fails at security that depends on context beyond the code in front of it, which is why it shouldn't grade its own output.
Replit's research also shows the counter-case. Across all their variants (secrets in literals, secrets in variables, secrets logged to the console or rendered through a child component), the deterministic scanner consistently identified the same class of issue.
Why? Because deterministic analysis operates on structural rules, not interpretation.
• SAST (static application security testing) parses code into an abstract syntax tree and matches patterns against known vulnerability signatures. A SQL injection is a SQL injection whether the variable is named query, sql, or bananaPhone. The scanner sees the structure, not the name.
• SCA (software composition analysis) reads lockfiles, queries vulnerability databases and compares version ranges. No interpretation required. Either your version is in the affected range or it isn't.
• Secret detection combines entropy analysis (statistically random strings), pattern matching (known formats like AWS access keys), and structural rules (assignments to variables matching known patterns). It catches the secrets its patterns cover regardless of syntax.
These tools are deterministic by design. Same input, same output, every time. That's what makes security scanning auditable, testable, and trustworthy for the vulnerability classes their rules cover.
The three intelligence types needed for effective triage (false positive elimination, business context application, and risk re-scoring) all require deterministic foundations. You can't build consistent triage on stochastic detection.
Yes, for the classes their rules and advisory databases cover, and that coverage doesn't change with phrasing or variable names. In Replit's tests, the deterministic scanner caught every variant the AI-only scans missed.
Static tools are weak where AI-written code is also weak, in business logic and authorization. They also report more as AI output grows. Apiiro saw monthly findings in Fortune 50 repositories rise tenfold in six months, to more than 10,000. What happens after the scan decides the outcome.
Replit doesn't conclude "don't use AI for security." Its conclusion is that LLMs are best used as remediation assistants, not security oracles.
This maps to a hybrid architecture.
Deterministic tools establish the baseline. SAST, SCA, DAST, and secret detection provide consistent, auditable coverage. They find the vulnerability classes their rules cover every time, regardless of syntax.
AI augments with remediation and reasoning. Once you know what's actually vulnerable, AI excels at generating fixes, understanding intent, and reasoning about business logic. These are interpretive tasks where stochastic systems add value.
The order matters. The baseline must be deterministic to be trustworthy. Remediation can be probabilistic because humans review the output before it ships.
Replit's architecture adds a third step, feedback loops in which deterministic tools check the changes the AI makes.
Something other than the model that wrote it. Replit's paper opens on this worry, that a built-in AI "security scan" asks the model to audit its own output. Three checks belong between AI-written code and production.
1. Deterministic scanners in CI that re-run on every change, whoever or whatever wrote it.
2. A reviewer who sees small diffs, with the design context the model didn't have.
3. For fixes an AI writes, a separate evaluation pass, with its own context, before any human sees it.
This is the loop we've built at Pixee. On the triage side, Pixee natively integrates with every tool you already run and analyzes each finding for exploitability, which cuts false positives by up to 95%. Triage verdicts are benchmark-tested against known true and false positives before each release. There is no second runtime judge on triage, so the risk is a real finding marked as a false positive, which is what the release benchmark against known true positives is there to catch.
On the remediation side, Pixee produces merge-ready fixes that match your conventions. Before a developer sees a fix, a separate Fix Evaluation Agent (a different inference call with its own context window) scores it on safety, effectiveness and cleanliness, and fixes that miss any threshold are never shown. The rest land as pull requests only, through your code review, your CI and a re-scan by your own SAST tools.
Across our 2025 customer cohort, that loop reached a 94% end-to-end resolution rate, from scanner finding to handled decision. More on how AI-written fixes get checked before merge and how the loop runs as a purple team.
1. Scan every change the same way, whoever or whatever wrote it. SAST, SCA and secret detection run in CI on each pull request.
2. Don't let the generating model be the only reviewer. An AI review pass can help, but it shouldn't be the check of record.
3. Check dependencies against a live advisory database, and confirm new packages exist. A model has no live feed to match versions against advisories, it can't see CVEs disclosed after its training, and it sometimes names packages that were never published.
4. Give authorization and business-logic changes a human review with design context. Writing the security requirement into the spec before generation helps too.
5. Triage findings for exploitability before they reach developers. Developers can't work a list that grows the way Apiiro saw in Fortune 50 repositories, tenfold in six months.
6. Send fixes as pull requests through review, CI and a re-scan, and keep a record of each decision. That's the feedback loop Replit's architecture ends on.
It depends on what you measure. Endor Labs' Agent Security League, built on Carnegie Mellon's SusVibes benchmark, reports that more than 80% of LLM-generated code in realistic tasks introduces security vulnerabilities. Opsera's 2026 benchmark of 250,000+ developers found 15 to 18% more vulnerabilities in AI-generated pull requests. OX Security found no difference per line and pointed at speed instead.
Not reliably. CodeRabbit says it couldn't confirm authorship for its own report and inferred it from co-author signals. It also matters less than it sounds. Sonar's 2026 survey puts AI at 42% of committed code, so scan every change the same way.
Yes, several platforms ship LLM-based security scans. In Replit's tests they never flagged the vulnerable dependency and changed answers with phrasing, so they shouldn't replace the deterministic baseline. They earn a place on flaws rules can't express, such as broken authorization, running alongside SAST, SCA and secret detection.
It can take a first pass, but it shouldn't be the only check. Sonar found that 96% of developers don't fully trust AI-generated code, yet only 48% always verify it before committing. Put a check that isn't the generating model between the code and the merge.
Yes. In Replit's tests, AI-only scans never flagged a dependency CVE, which the paper calls a capability gap. A model reviewing code can't reliably map package versions to vulnerable ranges without a live vulnerability feed.
Cut what reaches a human. Opsera found AI-generated pull requests wait 4.6× longer for review than human ones. Triage findings for exploitability before anyone sees them, deliver fixes as pull requests through the same review and CI, and run security checks inside the coding agent itself so fewer issues reach review at all.
Vibe coding isn't going away. AI-powered development environments are faster, more accessible, and genuinely productive for many use cases. Adoption won't slow down.
But the security model for AI-generated code can't be "ask the AI if its code is secure." That's asking the same system to both generate and validate, a conflict of interest at minimum, and architecturally unsound regardless.
A scan that changes its answer between runs can't be the check of record.
Before you trust a platform's security scan, ask what it runs that gives the same answer twice.
Replit's full research is available at securing-ai-generated-code.replit.app. The methodology section is worth reading if you're evaluating AI-powered security tools.
Sources
• Feng, D. (2026, January). "Securing AI-Generated Code: Why Deterministic Tools Must Establish the Baseline." Replit Agent Infrastructure. https://securing-ai-generated-code.replit.app/
• GitHub Advisory Database. GHSA-997g-27x8-43rf (CVE-2024-24558). https://github.com/advisories/GHSA-997g-27x8-43rf
• Tenzai (2026, June 25; agents tested December 2025). "Bad Vibes: Comparing the Secure Coding Capabilities of Popular Coding Agents." https://www.tenzai.com/blog/bad-vibes-comparing-the-secure-coding-capabilities-of-popular-coding-agents
• CodeRabbit (2025, December). "State of AI vs Human Code Generation Report." https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report
• OX Security (2025, October 23). "OX Research: AI Code Not Inherently Less Secure, but 'Army of Juniors' Effect Undermines Software Security." https://www.ox.security/blog/ox-research-ai-code-not-inherently-less-secure-but-army-of-juniors-effect-undermines-software-security/
• Apiiro (2025, September). "4x Velocity, 10x Vulnerabilities." https://apiiro.com/blog/4x-velocity-10x-vulnerabilities-ai-coding-assistants-are-shipping-more-risks/
• Spracklen et al. (2025). "We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs." USENIX Security 2025. https://arxiv.org/abs/2406.10279
• Endor Labs (2026, April; updated October 2026). "Is AI Coding Safe? Introducing the Agent Security League." https://www.endorlabs.com/learn/is-ai-coding-safe-introducing-the-agent-security-league
• Opsera (2026, January). "AI Coding Impact 2026 Benchmark Report." https://opsera.ai/resources/report/ai-coding-impact-2026-benchmark-report/
• Sonar (2026, January). "State of Code Developer Survey Report." https://www.sonarsource.com/blog/state-of-code-developer-survey-report-the-current-reality-of-ai-coding/
AI code security flaws we covered in 2025
• Software Supply Chain Security
Every Thursday, 1,500+ security leaders get the week in AppSec cut down to a 5-minute read.
Join 1,500+ security leaders. Five minutes, once a week.
Your first issue lands Thursday.
One email a week. Unsubscribe in one click.