r/devsecops • u/Diligent-Side4917 • Aug 24 '26
Is code scanning still a thing? what are your toughts on Agent Guardrails?
Been running agents and scanners on my PRs for a while now, triage and native scanning before anything goes up. I've ended up somewhere I didn't expect and want to know if I'm alone.
Started where I think everyone starts: lean on memory. Let the agent carry context session to session, build up a picture of the project. It helps. It wasn't where the gains came from.
What actually moved things was rules written against mistakes the agent already made. Not a generic OWASP checklist. A scoped rule: this defect class showed up, here's the sink, here's the banned construct, stop doing it. A defect shows up a third time, I write a rule, the class stops recurring. Five or six patterns closed instead of a hundred bugs chased one at a time.
The distinction I keep circling: memory is passive, the agent might use it. A glob-scoped rule loads whether the agent wants it or not, tied to the file in front of it. One line of repo rule changes the default output of every session in that repo. And MUST/NEVER phrasing outperforms polite wording by a margin that surprised me.
One thing I'd flag: these files are executable surface. The agent reads them as ground truth, so a poisoned rule file is a real problem, not a hypothetical. I keep security rules separate, reviewed like code, capped so they don't rot.
So, three questions I actually want answers to:
- Rules-on-mistakes vs raw memory — which is carrying more weight in your setup? I might be over-indexed on rules.
- How are you scoping? Glob per file, per directory, or one fat rules file everyone edits?
- Is anyone treating rule and memory files as an attack surface, or am I being paranoid?
Genuinely want to be argued with on the first one. If memory is doing the heavy lifting for you and rules are noise, tell me what your setup looks like.
2
u/juanMoreLife Aug 25 '26
Yes. Algos are cheaper than tokens. You want a hybrid approach
1
u/Electrical-Hall8869 Sep 07 '26
you are not being paranoid- scoped, reviewed rules seems more reliable than relying on memory alone. Treating rules files as an attack surface also makes sense.
1
u/broken_flexispot Aug 24 '26
https://semgrep.dev/products/semgrep-guardian/
Products like this seem better, why wait until ci to find out there's a problem
1
u/Logical_Cheetah_5214 Oct 28 '26
i'll argue with the first one a bit. rules-on mistakes works until the file gets big enough that nobody can say why line 40 exists, and MUST/NEVER loses its effect when every line says MUST. i'd keep your cap strict and tag each rule with the defect that caused it so you can retire it later. memory i mostly use for project layout, not security. semgrep is plenty for checking the class actually stopped recurring, and something like ox security, an AppSec platform, blocks insecure patterns inside Cursor or Claude Code while the agent is writing, so a security rule doesn't depend on the agent choosing to follow it. on poisoning, not paranoid. an unreviewed rule file is just an unreviewed prompt.
1
u/[deleted] Aug 27 '26
[removed] — view removed comment