Skip to content

docs: report CRS conformance, and warn before blocking mode - #9

Merged
raffaelschneider merged 2 commits into
mainfrom
docs/measured-crs-claims
Aug 31, 2026
Merged

docs: report CRS conformance, and warn before blocking mode#9
raffaelschneider merged 2 commits into
mainfrom
docs/measured-crs-claims

Conversation

@raffaelschneider

Copy link
Copy Markdown
Contributor

Independent of #8 — docs only, main-based.

The problem

The README claimed full CRS support in three places, including a comparison table putting this agent level with libmodsecurity on detection:

Provides full OWASP Core Rule Set (CRS) support with zero C dependencies

  • Full OWASP CRS Compatibility: Parse and execute 800+ CRS rules

| Detection Rules | 800+ CRS rules | 800+ CRS rules | 285 rules |

ZentinelSec combines the best of both worlds: Full CRS compatibility like ModSec…

None of that was measured. Current CRS has 629 unique rule IDs (this engine compiles 703 rules from them), and 4,080 of 5,033 corpus cases pass.

The more serious problem is what the README does not say. It documents --block-mode defaulting to true and walks the reader through pointing --rules at a stock CRS checkout. Doing that today produces a WAF that denies every request, GET / included, because of zentinelproxy/zentinel-modsec#29. Someone following this page gets all their traffic blocked, having just been told compatibility was full.

What it says now

  • The measured conformance number, and explicitly what it does not cover — the corpus runs DetectionOnly at paranoia 4, so it measures whether rules match, not whether the WAF decides.
  • A "Before deploying in blocking mode" section: a short table of the open engine issues that affect real traffic (#29 denying everything, #34 the + bypass, #31 t:cmdLine), with the interim advice to run --block-mode false and treat output as detection only until #29 is fixed and released.
  • The comparison table row becomes stock CRS, conformance measured versus stock CRS (reference implementation), which is accurate in both directions.

The "combines the best of both worlds" line becomes "aims to combine the two", with the reason: this is not the reference implementation of SecLang, so its CRS behaviour is measured rather than assumed.

These are claims about the current released state (0.3.0), so this stands on its own and does not wait on #8 or on the engine fixes. When #29 ships, the "before deploying" section shrinks to whatever is still open.

… tests

Three problems, the third of which is why the first two went unnoticed.

**Rule files were concatenated, which broke CRS data paths.** `load_rules`
read every `--rules` glob match and spliced the text together, losing the one
thing the engine needs to resolve `@pmFromFile`/`@ipMatchFromFile` paths and
nested `Include`s: which file a directive came from. Those paths are relative
to their own rule file, so a concatenated string resolved them against the
process's working directory instead. Stock CRS references
`scanners-user-agents.data` among others, so the command in the README:

    zentinel-zentinelsec-agent --rules /etc/modsecurity/crs/crs-setup.conf \
                               --rules "/etc/modsecurity/crs/rules/*.conf"

failed at startup unless it happened to be run from /etc/modsecurity/crs/rules.
The patterns are still resolved here, so a bad path is still reported against
the pattern that produced it, but the engine is now handed quoted absolute
`Include` directives and does the reading itself. Same rules, 703 of them,
independent of the working directory.

**A block reported the wrong rule.** `X-WAF-Rule` is built from the first
reported id, and the ids came from `matched_rules()` -- every rule that
matched, including CRS setup actions and chain starters whose chain never
completed. Under stock CRS its first entry is 900990, a setup rule, not the
rule that blocked. They now come from `Intervention::rule_ids`, which is the
rules that caused the intervention, and `X-WAF-Message` carries the rule's own
`msg` instead of a constant string.

**The CRS integration tests never ran, and could not have failed if they had.**
They returned early when `test-rules/crs` was absent and CI never fetched it,
so they reported green as skips. The assertion was also vacuous:
`assert!(blocked || !rule_ids.is_empty())` where `rule_ids` came from
`matched_rules()`, which under stock CRS always contains the 901xxx setup
rules -- so it held whatever the engine did. And the fixture loaded five
hand-picked rule files, omitting REQUEST-920-PROTOCOL-ENFORCEMENT.conf, which
is where the rule that denies every request lives.

They now load the full rule set through `ZentinelSecEngine` itself rather than
a separately built engine, fail loudly with fetch instructions when the
checkout is missing, and assert on which rules fire. CI fetches CRS.

Two of the new tests -- that ordinary traffic is not blocked -- are `#[ignore]`d
because they fail against zentinel-modsec 0.3.0, where CRS 920100 denies every
request. They are the acceptance criteria for that dependency bump; remove the
attribute once it lands.

Adds `ZentinelSecEngine::rule_count` and `::modsec` so tests can exercise the
rules the agent actually loaded.

Closes #7
Refs zentinelproxy/zentinel-modsec#29
Refs zentinelproxy/zentinel-modsec#30

Claude-Session: https://claude.ai/code/session_01VkHAQ33U78fmpk6r161DKc
The README claimed "full OWASP Core Rule Set support" and "800+ CRS rules" in
three places, including a comparison table putting this agent level with
libmodsecurity on detection. None of it was measured.

It also documents `--block-mode` defaulting to true without saying that a stock
CRS deployment currently denies every request, `GET /` included
(zentinel-modsec#29). Someone following this README today gets a WAF that
blocks all their traffic, having been told compatibility was full.

Replaces the claims with the measured conformance number, states what that
number does not cover, and adds a short table of the open engine issues that
affect real traffic -- with the interim advice to run `--block-mode false`
until #29 is fixed and released.

Refs zentinelproxy/zentinel-modsec#29, #31, #34

Claude-Session: https://claude.ai/code/session_01VkHAQ33U78fmpk6r161DKc
@raffaelschneider
raffaelschneider merged commit c0d8122 into main Aug 31, 2026
3 checks passed
raffaelschneider added a commit that referenced this pull request Aug 31, 2026
#11)

#9 corrected the README but left the same claim in the two places that reach
people without opening it: the crate description, and the clap `about` string
printed by `--help`.

Both now say the agent loads the stock OWASP CRS rather than claiming full
compatibility with it. Conformance is measured in zentinel-modsec and reported
in the README.

Claude-Session: https://claude.ai/code/session_01VkHAQ33U78fmpk6r161DKc
@raffaelschneider
raffaelschneider deleted the docs/measured-crs-claims branch August 31, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant