r/devsecops • • 1d ago

How much of security policy enforcement actually requires an LLM?

Security checks should be as deterministic as possible. But certain repository-specific policies require contextual understanding.

Instead of sending code to a general-purpose LLM for review, I've been exploring a different approach:

  • Break complex policies into smaller questions.
  • Resolve everything possible deterministically.
  • Use specialized decision models like Jev only when semantic judgment is necessary.
  • Validate individual assertions against passing and failing examples.

I don't need generated explanations for every check. I need reliable decisions.

The objective is to minimize opportunities for mistakes by reducing probabilistic behaviour, rather than relying on increasingly powerful models.

I'd love technical feedback from people implementing custom policies in CI/CD, particularly around false negatives and the reliability required for blocking checks. Wdyt?

3 Upvotes

5 comments sorted by

2

u/DishSoapedDishwasher 19h ago

Ai shouldn't be used for policy evaluation, jev only in the context of using real policy engine like Cedar and OPA. There's a bunch if while papers on this actually, you should try reading them, see if any spark a better idea.

But in tests LLMs are the worst policy engine you could have, they have very little consistency or repeatability.

1

u/Ok-Buyer-9421 4h ago

Fair point. I'm not trying to replace OPA or Cedar. I'm exploring the gap where repository-specific rules require semantic interpretation rather than deterministic policy evaluation. I'll look into the papers you mentioned!

1

u/DishSoapedDishwasher 3h ago

The key is, if something is ambiguous in the state you're trying to evaluate it, you're probably using the wrong perspective.

Like asking: how do i prove that the compiled binary is actually a product of the associated and specific source code version, by instrumenting the compiler?...  Well you probably could but it wont happen easily. But if you start talking about reproducible builds, well if you're using LLVM that might be realistic pretty quickly; then you just build it again elsewhere and match the sha256.

But you'll never eliminate false negatives until you formally verifying with cedar or similar 

2

u/Apart_Excitement9242 10h ago

95% of this is usually solvable with custom linter rules and strict AST matching tbh. The remaining 5% often comes down to architectural intent, which is really tough to validate at the PR level without full system context anyway.

1

u/Ok-Buyer-9421 4h ago

Fair breakdown. The interesting gap I'm exploring is precisely that remaining 5%: architectural conventions and repository-specific intent that aren't easily captured by AST rules. Agree that broader system context is probably the hardest part.