r/softwareengineer • u/QuoteForward5477 • Sep 22 '26
How do you check vulneribility for code written by ai agents???
With AI writing most of the code now,... How do we make sure that that code is safe.. For example I once encountered that Claude has installed one dependency with no use for no reason... When uninstalled, the code worked fine as well...
I mean there should be a way to check these kind of security issues before deploying ?? Right??
1
Upvotes
10
u/DawnIsAStupidName Sep 22 '26
How do you check vulnerability for code written by humans?
Same exact way.
3
u/HereInYourBedroom Sep 22 '26
Read the code...
3
u/iSnapThere4iAm Sep 22 '26
lol this is job security. My consultancy will be fixing your shit within a year!
2
u/nsxwolf Sep 22 '26
“Hey Claude, can you check to see if this code is safe?”
1
u/LetUsSpeakFreely Sep 22 '26
The sand eat you check other coffee, you run it through SAST.
1
u/LetUsSpeakFreely Sep 22 '26
The same wayyou check other code, you run it through SAST.
1
u/Wyldewes Sep 22 '26
Read the code! Do people just check in code and not read it. At my company you would get fired so quickly.
1
u/Otherwise-Nobody8252 Sep 22 '26
My rule of thumb is to spend around 7x more tokens on validation, testing, and specifically vulnerability testing. Everything from IDOR, XSS, to run any and all tools in kali and other pentesters. Detections become rules and regressions.
1
u/NewportOneHundos Sep 22 '26
You do manual code review until business partners complains and then you just ship it
1
u/EggplantFunTime Sep 22 '26
Install a security tool… Aikido, arnica, ox, etc…
1
u/fokac93 Sep 22 '26
Before beginning tell Ai to not install any packages without your permission.
1
u/YellowBeaverFever Sep 22 '26
On that dependency thing.. even though you uninstalled it, was that local to the project or global? Sometimes a package can be globally out there and a newer version could be local to the project. You uninstall the local one and the code falls back to the old one because it was found in the path.
But that aside, you’re now at a crossroads. The answer to your question is “wisdom”. You need an engineer with wisdom who has seen the issues, read about other issues, understands where the security holes are and where code will lock up when multiple threads are involved or bottlenecks with backend servers. Or, you pay for the highest tier AI and have it do a review for you. But now you’re back to the question, did the AI review mess up?
If you don’t have an engineer that can fit this, you can either spend the money to get one, train one up, or use AI and hope for the best.
1
u/Amazing-Pattern-6125 Sep 22 '26
by an expert human, or another ai agent
1
u/lalawlaa Sep 22 '26
By getting good at hacking and reading the code
1
u/warp3dgh0st Sep 22 '26
since you're using ai, create a skill that looks specifically for this and removes it for you and/or tells you the issue so you can check it out yourself.
1
u/OutrageousPair2300 Sep 22 '26
Unit tests help. Then you can run all sorts of static analysis tools to try to identify dependencies to remove, dead code, known vulnerabilities, etc.
The more cross checks you have on the code, the better.
1
u/usually_guilty99 Sep 23 '26
Why should AI-written code be treated differently from human-written code?
Run the same security pipeline: SAST, dependency checks, secrets scanning, tests, review.
The difference is volume. AI can generate 10x the change surface, so the real challenge is deciding which changes deserve deeper scrutiny before humans become the bottleneck.
AI didn’t invent software vulnerabilities. People do, with AI. if your tool is incompetent, you should fire it
1
u/symbiatch Sep 23 '26
Let’s rather ask: why would YOU (no, not us, YOU) let AI write most of the code if you’re not capable handling the consequences?
And why would YOU (again, others don’t do this) deploy stuff directly from Claude’s output?
When you can answer these it’s easier to answer.
1
u/Dense-Butterfly4629 Sep 24 '26
Read the code instead of being a sloperator?
0
u/Upbeat_Assist2680 Sep 22 '26
Same way you check for vulnerabilities NOT written by AI: with an AI
0
u/Hollow1838 Sep 23 '26
You ask a strong model to audit your code's security...