Guides · AI development
AI code security review checklist
AI writes code at a pace human review was never designed for, and it writes it with characteristic failure modes: confident, plausible, and insecure in specific, repeatable ways. Secrets hard-coded 'just for now'. Queries built by string concatenation. Authentication that looks right and checks nothing. This checklist is organised around what AI-generated code actually gets wrong, so a review can keep up with generation instead of pretending the old process still fits.
By the Ingenious AI team · Published 14 November 2026 · Reviewed 14 November 2026
The short answer
Review AI-generated code for its characteristic failures before anything else: hard-coded secrets and credentials, injection points (string-built SQL and shell commands), missing authentication and authorisation checks on new endpoints, unsafe defaults (debug on, permissive CORS, verbose errors), dependencies the model invented or left outdated, and business-logic shortcuts like client-side validation only. Run automated scanning for secrets and known patterns first, then spend human review time on authorisation and logic — the two places automation is weakest and AI code is sloppiest.
Try it free: Vibe Audit — scan AI-generated code for the failure patterns in this checklist — secrets, injection points and unsafe defaults — before it ships.
What is an AI code security review?
a review process adapted to code written or heavily assisted by AI models: it assumes higher volume, lower authorial understanding, and a specific defect profile (plausible-looking security code that does not actually enforce, invented package names, copied insecure patterns). It pairs automated scanning — which catches the mechanical failures at generation speed — with targeted human review of the decisions a scanner cannot judge.
Secrets and configuration: the first scan
AI models hard-code secrets constantly — an API key in a config file, a test password in a seed script, a token in a comment — because their training data is full of examples that do exactly that. Scan every AI-generated change for credential-shaped strings before it merges, including test files and examples. Check configuration too: debug modes enabled, development origins in CORS allowlists, default admin credentials in setup scripts. These are mechanical checks, which is good news: they can be fully automated, and they should block a merge the way a failing test does.
Injection and input handling
Models reach for string concatenation when building queries and commands because it is the shortest path to working code. Search generated code for query construction, shell invocation, template rendering with unsanitised input, and file paths built from user data. The review question is always the same: can any part of this string be influenced by a user? AI code also tends to validate on the client and trust the server-side request, so verify that every check the UI performs is repeated where the data is actually used.
Authentication and authorisation: where plausible is not correct
This is the deepest AI-code trap. Generated auth code often looks impeccable — hashing, tokens, middleware — while missing the check that matters: this user, this resource, this action. Review every new endpoint for an explicit authorisation decision, every object access for ownership verification, and every admin function for a server-side role check. Ask the question AI code hopes you won't: not 'is there auth code?' but 'show me the line that refuses the wrong user.' If that line does not exist, the rest is costume.
Dependencies the model invented
Models hallucinate package names, suggest abandoned libraries, and pin versions from their training era. Verify every new dependency exists, is the package you think it is (typosquatted names are a real attack), is maintained, and has no known critical vulnerabilities. Check the lockfile diff the way you check the code diff. A generated project can be one invented import away from installing an attacker's package with your build system's full trust — the review step is the only place that gets caught.
A workflow that matches generation speed
You cannot line-by-line review a thousand generated lines with the attention the old process assumed, so triage: automated gates (secrets, dependency and pattern scanning, tests) on every change; human review concentrated on auth, data access, payments and anything internet-facing; and a standing rule that the human who merges generated code owns it exactly as if they had typed it. Record which parts were AI-generated in the commit — not for blame, but because the defect profile differs and future reviewers deserve to know where to look hardest.
Your 5-action checklist
- Gate every AI-generated change with automated secret, dependency and pattern scanning that can block a merge.
- Search generated code for string-built queries, shell commands and user-controlled file paths; fix each injection point.
- For every new endpoint, find the line that refuses the wrong user — if it isn't there, the auth is decoration.
- Verify every new dependency exists, is correctly named, maintained and vulnerability-free; diff the lockfile.
- Concentrate human review on auth, data access and payments, and record AI-generated sections in the commit.
Worked example: Hill Country Meal Kits
Hill Country Meal Kits, a fictional subscription food startup, let an AI assistant build its customer portal in nine days. The pre-launch security review found three characteristic defects: a database query built by concatenating the search term (a working injection point), an order-history endpoint that checked the user was logged in but never checked the order belonged to them (any customer could read any order by changing an ID), and a payment-provider key hard-coded in a 'temporary' config file that had been committed 40 times. All three were fixed in a day. The founder's summary became the team's rule: the AI wrote nine days of code in nine days, and the review's job was not to slow it down — it was to check the three places AI code always cheats.
Sources
- NIST — SP 800-218, Secure Software Development Framework (SSDF) v1.1 (2022) — the review and verification practices this checklist applies to AI-generated code.
- MITRE — Common Weakness Enumeration (CWE) — the weakness catalogue behind the injection, authentication and configuration flaw classes named above.
Frequently asked questions
Can't we just ask the AI to write secure code?
Asking helps and is worth doing — security requirements in the prompt measurably improve output. But the same model that writes the flaw will confidently assure you it is not there. Prompting is an input to quality; review is the verification. Never let the generator be the only checker.
Should we scan AI code differently from human code?
The scanners are the same; the emphasis differs. AI code needs heavier weight on secrets, invented dependencies and missing authorisation — the model's signature failures — while human code needs more weight on logic errors and misunderstood requirements. A good review process names both profiles explicitly.
Who is responsible when AI-generated code has a vulnerability?
The team that shipped it. 'The model wrote it' is not a defence your customers, your insurer or a regulator will accept, which is why the merging human owns generated code fully. Choose tooling and review depth as if you typed every line — legally and operationally, you did.
Is AI-generated code less secure than human code overall?
It is differently secure: faster and often more consistent on boilerplate, weaker on authorisation logic, secrets hygiene and dependency judgement. With scanning gates and targeted review, teams ship AI code as safely as human code; without them, they ship its defect profile at machine speed.
What about the licence and provenance of generated code?
A real concern adjacent to security: models can reproduce licensed snippets. Keep provenance notes (which tool, which version), prefer tools with clear output terms, and run similarity checks for regulated or high-scrutiny codebases. It is cheaper to know than to discover in diligence.
Related guides and tools
- How to choose a website security scanner
- DMARC setup guide for small businesses
- Website security checklist for small businesses
- AI agent security: a buyer's guide
- How much does a website security audit cost?
- DMARC vs SPF vs DKIM: what each one actually does
- How to stop email spoofing of your domain
- AI chatbot security checklist
- All Ingenious AI guides
- The full Ingenious AI platform suite
- The security suite overview
- Vibe Audit — free tool