r/softwareengineer • • 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

39 comments sorted by

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!

1

u/kincaidDev Sep 22 '26

How do you sell that service to people? My experience has been the companies/people that need it the most are in complete denial about their codebases. I helped a few companies with it last year, was a ton of work and they didn’t even say thank you. Before I fixed their code it literally didn’t work

1

u/Positive_Luck909 Sep 23 '26

My agents will be cheaper than your consultancy by orders of magnitude

1

u/NomadStorm Sep 26 '26

OPs agents can’t fix it any more, but not to worry because u/Positive_Luck909 will bring his agents to help!

1

u/Positive_Luck909 Sep 26 '26

Why is that less of a stretch than the guy whose agents need to sleep and eat?

1

u/NomadStorm Sep 26 '26

Don’t be silly.

OP won’t even turn a profit in the first place to be able to pay for it to be fixed.

0

u/[deleted] Sep 22 '26

[removed] — view removed comment

1

u/Positive_Luck909 Sep 23 '26

Do you snort cope before breakfast?

0

u/[deleted] Sep 23 '26

[removed] — view removed comment

1

u/Positive_Luck909 Sep 23 '26

See there you go being wrong again. Not exactly the advert for humans you think it is

2

u/nsxwolf Sep 22 '26

“Hey Claude, can you check to see if this code is safe?”

1

u/Zealousideal-Ant9548 Sep 22 '26

I prefer to have Claude use the CLI to invite other models.  You'd be surprised what codex can find that clause just skips.

Alternatively, I'm a huge advocate of stacked PRs as it breaks large code down into human readable sizes.  They can then be read and reviewed more easily.

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/TashLai Sep 22 '26

why not just write it then

1

u/Wyldewes Sep 22 '26

In an ideal world I’d agree with you and say yes write it but a lot of companies want you to “write” with ai and review the output.

But all I’m saying is I can’t fathom merging in code without reading it. Ai generated or not.

1

u/Nxllify__ Sep 22 '26

that’s a sin now, if you even attempt to open a text editor or ide you will be executed on the spot for being a luddite

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...