secure AI coding tools
Secure AI coding tools: what each scanner misses
Secure AI coding tools compared by family: what SAST, dependency, secret and AI review scanners catch, and the access rule none of them checks.
- By Azziz ERRIME
- 13 min read
Contents
- Every scanner answers the question it was built to ask
- Each family of secure AI coding tools sees one layer of risk
- Invented package names walk straight past dependency scanners
- No scanner can tell whether an access rule does what the business intends
- An automatic fix repairs only what its rule has already seen
- I would buy the scanners and keep a human on every access rule
- Frequently asked questions about secure AI coding tools
- Sources
TL;DR
- Secure AI coding tools complement one another, yet each family looks at one layer, and none verifies that an access control does what the business expects.
- In a USENIX Security 2025 study, 19.7% of the packages that code models recommended did not exist, a gap that version-based dependency scanning does not see.
- I would buy SAST with AI fixes and a provenance check on packages, and keep a human reviewer, told to look for security, on every access rule.
In March 2024, a backdoor in xz-utils came to light because one developer would not ignore half a second of latency. Secure AI coding tools share the limit that let it hide: each scanner finds what it was built to look for.
Andres Freund wants to know why SSH connections are taking about 500 milliseconds longer than they should. Half a second is easy to shrug off, and he chooses to keep pulling the thread. It leads him into xz-utils, a compression library, and to a backdoor hidden in test files and stitched into the code at build time, now catalogued as CVE-2024-3094. On 29 March 2024, he posts his alert to the oss-security mailing list. The discovery comes from a person puzzled by a timing figure, and from no tool built to catch malicious code.
Every scanner answers the question it was built to ask
What strikes me in the xz-utils case is the hiding place. A scanner reading source for dangerous patterns has little reason to look for production logic in test files or a build step. Freund’s question is broader: why is this slower than it should be? Only someone who knows how the system ought to behave can ask it.
Code written with an AI model raises the same issue. A static analyser, known as SAST, reads the source and matches it against rules that describe dangerous patterns, such as user input reaching a database query unfiltered. A dependency scanner compares the libraries you import with lists of published flaws. An AI reviewer reads each change and comments on it. Each of these AI code security tools answers its own question well, and none of them asks whether the code does what your business meant.
For a CTO or a CISO deciding what to buy, that turns the useful comparison into a list of blind spots, family by family.
Each family of secure AI coding tools sees one layer of risk
Most lists of the best AI code security tools rank products. This table groups them by family, names only products with a dated public source, ranks nothing and leaves out the vendors’ own effectiveness figures.
| Family | What it catches | What it misses | Tools named, with a dated source |
|---|---|---|---|
| Static analysis (SAST) with AI-written fixes | Dangerous patterns that a rule describes, such as injection, with a proposed patch for each alert | Any flaw that no rule describes, and an access check that exists but checks the wrong thing | GitHub Copilot Autofix for CodeQL, generally available 14 August 2024; Semgrep Assistant, generally available 20 March 2024; Sonar AI CodeFix, in early access 3 October 2024 and generally available 31 July 2025; Checkmarx AI Security Champion, with automatic SAST remediation and scanning of code generated with GitHub Copilot, 5 May 2024 |
| Dependency scanning (SCA) | Real packages in versions with a published vulnerability | A package name the model invented, which is new and has no advisory against it | None named here: my sources date no vendor launch aimed at this gap |
| Secret scanning | Keys and tokens committed to the repository, in formats it recognises | Secrets exposed by the running application, for instance through a database that a missing access rule leaves open | None named here |
| AI review of pull requests | Problems in context that no fixed rule describes, explained in plain language | Instructions planted in the pull request itself, as Comment and Control showed, and attacks on the reviewer’s own access, as in the CodeRabbit case | GitHub Copilot code review, usage update from GitHub, 5 March 2026 |
| Scanners built into AI app builders | Whether an access policy exists on the generated database tables | Whether that policy is correct for the application | Lovable 2.0 security scanner, April 2025, as described in Matt Palmer’s statement on CVE-2025-48757 |
Read down the “misses” column and a pattern appears. Every family recognises an object it can name: a pattern, a version, a key format, a code change, a policy. What escapes all five is intent, meaning what the code is supposed to allow, and for whom.
The AI fixes in the first row are a genuine gain, and I would want them, but they patch what the rule saw and nothing beyond it. What slips past a dependency scanner when the model invents the package itself?
Invented package names walk straight past dependency scanners
A dependency scanner works from history, and that is its weakness here. It knows a package, its versions and the advisories published against them. When a coding model suggests a library that has never existed, there is no history to check, and the scan has nothing to report.
The problem is far from marginal in size. In a study presented at USENIX Security 2025, Spracklen and colleagues tested 16 models: 19.7% of the packages they recommended did not exist, more than 205,000 invented names. Open-source models invented names roughly four times as often as commercial ones. The choice of model is a security decision too, and I compare models on that front in which AI model writes the most secure code.
Concretely, the attacker’s move costs very little. They collect names that models invent, register one on a public package registry, and wait for a developer to accept a suggestion and run the install. The package is new, so it carries no known vulnerability, and a scanner that checks versions against advisories lets it through. The flaw sits in the name itself.
When you compare secure AI coding tools for dependencies, ask the vendor one thing. Does the tool flag a package that is brand new, or unknown to the team, before it reaches a build? That is a provenance check, and it sits alongside the classic scan. And when the faulty code looks correct, what can a scanner see?
No scanner can tell whether an access rule does what the business intends
The OWASP project states this limit in plain terms. Its Top 10 for Business Logic Abuse notes that static and dynamic testing can detect a missing access control. Neither can verify that a control in place does what the business expects. An access control is the check that decides who may read or change a record. A tool can see that the check exists; it cannot know that a sales representative should see only their own clients, because that rule lives in a contract or a process.
A public case shows the gap at scale. In March 2025, Matt Palmer scanned 1,645 projects built on the Lovable platform. He found 170 without sufficient row-level security rules, the database setting that limits each user to their own rows. According to his statement on CVE-2025-48757, the exposed data included email addresses, phone numbers, payment information and API keys.
The following month, Lovable 2.0 added a security scanner which, Palmer writes, “merely checks for the existence of any RLS policy, not its correctness or alignment with application logic.” I read that sentence as a fair description of the whole category. The scanner answered the question a scanner can answer, whether a policy exists, while the data depended on whether the policy matched who should see what.
That question sits at the heart of secure code review. A reviewer who knows the business can write down “a customer never sees another customer’s invoices” and check the code against that sentence. It is the skill behind reviewing AI-generated code, and no licence fee buys it. The obvious objection follows: if the tools now write the fixes, why keep people reading the code?
An automatic fix repairs only what its rule has already seen
Several secure AI coding tools now write the fix themselves, and that is a real gain. When Copilot Autofix, Semgrep Assistant, Sonar AI CodeFix or Checkmarx propose a patch, that patch hangs off an alert, and the alert comes from a rule. A fix cannot reach a flaw that no rule raised, so an access policy that exists but lets the wrong people in raises no alert and gets no fix.
The volume of flawed code makes the point sharper. Veracode’s GenAI Code Security Report of July 2025, the work of an application security vendor, found a vulnerability in 45% of the generation tasks it tested. On cross-site scripting, the generated code failed in 86% of cases. Those are flaw classes that static rules are written to recognise, which is where SAST with an AI fix pays for itself. Logic flaws sit outside that list, whatever the volume.
AI security code review tools close part of the remaining gap, since they read names, comments and context that no rule covers. They also open a gap of their own. In April 2026, Aonan Guan and researchers from Johns Hopkins published Comment and Control. It shows that text planted in a pull request could steer Claude Code Security Review, Gemini CLI Action and GitHub Copilot Agent into leaking CI/CD credentials. A reviewer that obeys the text it reviews cannot be the last pair of eyes.
For a buyer, the fixes and the AI review are worth paying for, and the reading stays with people; I weigh AI code review as a practice separately. What remains is the question Freund’s half-second puts to whoever signs the purchase order.
I would buy the scanners and keep a human on every access rule
Go back to Freund and his half-second of latency. The backdoor surfaced because a person knew how fast the system should be and would not accept a gap he could not explain. Secure AI coding tools do not supply that reflex; they clear the ground so that the people who have it spend their attention where it counts.
Here is what I would put in place, in this order:
- SAST with AI-proposed fixes on every pull request, with a person approving each fix before merge.
- A provenance check on dependencies: a package the team has never used waits until someone confirms that it exists and who publishes it.
- Secret scanning on the repository, paired with a review of database access rules, because keys also leak through a running application.
- Any AI reviewer treated as a reader with access to your code: the narrowest access it can work with, and an approval that never counts alone.
- An explicit instruction to human reviewers to look for security, with the business rule that each access check must enforce. In the ICSE 2022 study by Braz and colleagues, simply asking reviewers to focus on security made them eight times more likely to detect the vulnerability.
The Linux kernel has already settled who answers for the result. Its guidance on coding assistants puts it bluntly: “Only humans can legally certify the Developer Certificate of Origin (DCO).” I would write the same rule into any team’s review policy, whatever tools it buys.
My doubt concerns the last item, which depends on reviewers who know the business rules and have time to read. I do not yet see how most teams will protect that time as the share of AI-generated code grows. A training score is no measure of vigilance, and a green dashboard is no better one. Freund had half a second and a question. Someone in your review chain needs both.
Frequently asked questions about secure AI coding tools
What are the best AI code security tools?
No single product covers every layer, so the useful choice is a combination of families. Static analysis with AI fixes, such as GitHub Copilot Autofix for CodeQL, generally available since August 2024, handles patterns that rules describe; dependency scanning handles known flaws in real packages. As the OWASP Top 10 for Business Logic Abuse notes, none can verify that an existing access control does what the business expects, so secure code review stays in the set.
Is AI-generated code secure?
Not by default: in Veracode’s GenAI Code Security Report of July 2025, a study by an application security vendor, 45% of generation tasks produced code with a vulnerability, and the code failed against cross-site scripting in 86% of cases. AI-generated code security risks call for the same scanning and review as human code, with extra attention to invented dependencies and to access rules.
Can SAST detect vulnerabilities in AI-generated code?
Yes, for flaws that a rule describes, such as injection or cross-site scripting, and several vendors now attach AI-written fixes to the alerts. SAST cannot judge intent, though: the OWASP Top 10 for Business Logic Abuse states that static and dynamic testing can spot a missing access control, but cannot verify that an existing one does what the business expects.
Do AI code review tools replace human review?
Not on their own: AI review reads every change in context, but text planted in a pull request can steer it, as the Comment and Control research showed in April 2026 against three AI tools wired into GitHub. Human review stays, and focus makes it stronger. In the ICSE 2022 study by Braz and colleagues, asking reviewers to look for security made detection eight times more likely.
Sources
- xz-utils backdoor (CVE-2024-3094), hidden in test files and injected at build, found while investigating SSH connections about 500 ms slower: Andres Freund, alert on the oss-security list, 29 March 2024. openwall.com
- Copilot Autofix for CodeQL code scanning alerts generally available: GitHub changelog, 14 August 2024. github.blog
- Semgrep Assistant generally available: Semgrep blog, 20 March 2024. semgrep.dev
- Sonar AI CodeFix in early access: Sonar blog, 3 October 2024. sonarsource.com
- Sonar AI CodeFix generally available: Sonar blog, 31 July 2025. sonarsource.com
- Checkmarx AI Security Champion, automatic SAST remediation and scanning of code generated with GitHub Copilot: Checkmarx blog, 5 May 2024. checkmarx.com
- GitHub Copilot code review, usage update: GitHub blog, 5 March 2026. github.blog
- Comment and Control, text in pull requests steering Claude Code Security Review, Gemini CLI Action and GitHub Copilot Agent into leaking CI/CD credentials: Aonan Guan and Johns Hopkins researchers, 16 April 2026. oddguan.com
- CodeRabbit, from a pull request to remote code execution and write access to repositories: Kudelski Security, published 19 August 2025. kudelskisecurity.com
- SAST and DAST can detect a missing access control but cannot verify that an existing one does what the business expects: OWASP Top 10 for Business Logic Abuse, Broken Access Control, 2025. owasp.github.io
- 19.7% of recommended packages do not exist, more than 205,000 invented names, open-source models about four times more than commercial ones: Spracklen et al., USENIX Security 2025. usenix.org
- Lovable, 1,645 projects scanned, 170 without sufficient RLS rules, exposed data, Lovable 2.0 scanner that checks only for the existence of a policy: Matt Palmer, statement on CVE-2025-48757, 2025. mattpalmer.io
- 45% of tasks with a vulnerability, cross-site scripting failed in 86% of cases: Veracode, GenAI Code Security Report, 30 July 2025. veracode.com
- Asking reviewers to focus on security multiplies detection by eight: Braz, Aeberhard, Çalikli, Bacchelli, ICSE 2022. arxiv.org
- “Only humans can legally certify the Developer Certificate of Origin”: Linux kernel documentation, AI coding assistants. docs.kernel.org