AI-generated code can pass every automated security check you give it and still contain a security decision nobody actually made.
Imagine an AI coding assistant builds authentication for a fintech app and gives session tokens a 7-day lifetime. A static code analyzer might see:
- the token is generated correctly
- the signing algorithm is approved
- the secret isn’t hard-coded
- no known vulnerability is present
Everything passes. ✅
But should a session that can authorize financial transactions stay valid for 7 days?
It depends on what else protects it.
- Does moving money require re-authentication, no matter how old the session is? If it does, a stolen session can look at the account but can’t drain it, so a long lifetime is less dangerous.
- Can a stolen session be revoked immediately? If the server can kill a session the moment fraud is detected, the risk is somewhat mitigated.
- Is the token tied to the user’s device? If the token only works on the phone it was issued to, someone who copies it to another device can’t use it.
If someone had already decided “re-authentication after 15 minutes is required” and encoded this rule in the code analyzer, the scanner could enforce it. But if nobody has made that decision, the scanner has nothing to check against.
Security automation is good at enforcing boundaries we’ve already defined. It can’t tell us where a new boundary should be.
That was true before AI. But when you wrote the code yourself, you at least had to pick the value. When AI writes your code, it could pick a “reasonable-looking” default, and it’s easy to merge it without noticing.
For security-sensitive behavior, someone still has to understand what the system can do and decide what should be allowed. Then, wherever possible, turn that decision into a rule the pipeline enforces so the next default gets flagged automatically by the code analyzer.
For platform teams, consider building a shared auth library with the defined rules and enforcing it by adding a pipeline check that flags code overriding it.
Loading comments…
Comments aren’t loading right now.
The post is unaffected; the comment service didn’t respond. Try again in a moment, or come back later.