Contact
FR EN DE
Our expertise
Apps & AI
Consulting & Support
Cloud & IT Architecture
About References Careers Blog
All articles
AI & Data

What AI didn’t do for me (3/4): the code worked, the tests passed

The code worked. The tests passed. I ran a security audit anyway. 34 issues reported, including one critical.

What AI didn’t do for me (3/4): the code worked, the tests passed

Two things come up systematically when you generate code. They have to be dealt with explicitly, otherwise nobody will.

1. Code duplication is the default behavior.

In my project: two near-identical components doing the same job, four buttons each carrying a copy of the same formatting block, the same error handling copied in three places. Everything worked, but all of it was technical debt. One cleanup pass: 211 lines fewer, zero change in behavior.

2. Security isn’t thrown in for free.

I had the code audited across six areas in parallel: 34 issues reported, including one critical.

The critical one: a malicious file server could write anywhere on my disk. The application blindly trusted the file name announced by the server. One well-chosen name, one click on “Download”, and a program ended up dropped in the Windows startup folder, executed the next time I logged in.

The detail that sums it all up: the check already existed in the code. It was simply applied on the wrong side: where the files came from my own disk, not where they came from the server. Plausible code, wrong exactly where it matters.

Another example: the password copied to the clipboard was never cleared. And Windows syncs the clipboard to your account and your other devices.

And the best for last.

Four tests were failing. Natural reflex: fix the code. But the code was right! It was the tests that were wrong. They compared two strings in a way that, in some cases, treats invisible characters as if they didn’t exist. So the test claimed to find something that wasn’t there.

Had I believed it, I would have weakened a protection that worked perfectly.

That’s the real lesson of this audit: a failing test isn’t always right, you still have to know which of the two is wrong.


“What AI didn’t do for me” series: 1 · 2 · 3 · 4

Author CAPCOD
Ready to start?

Let's talk about your project.

Tell us what you need, we reply within 48 hours.

Get in touch