AI coding assistants are genuinely great. They are also confidently wrong in ways that are hard to spot, because the output looks like something a competent developer wrote. Security is where this bites hardest.
Plausible but wrong
A model will happily generate auth middleware that decodes a token without verifying its signature, or a database call that concatenates user input into a query. It compiles. It runs. It passes your happy-path test. And it is exploitable.
The patterns that keep showing up
jwt.decode()used wherejwt.verify()was needed, trusting a token nobody validated.- Secrets with a fallback default like
process.env.SECRET || "secret". - Firebase or Supabase rules generated wide open because the demo needed it.
bcryptrounds set absurdly low, or hashing skipped entirely.- User input dropped straight into SQL, shell commands, or HTML.
The model did not make a mistake a beginner makes. It made a mistake that looks like expertise, which is worse.
Why review does not catch it
When you did not write the code, you read it more charitably. It looks finished, so you skim. The insecure line is one token different from the secure one, and your eye slides right over it.
Scan for the specific patterns
You cannot eyeball your way to safety across a whole AI-assisted codebase. What works is scanning for the specific known-bad patterns that AI tools produce, by name, and flagging each one with the fix. That turns a vague worry into a concrete checklist.