docs: report CRS conformance, and warn before blocking mode - #9
Merged
Conversation
… 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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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-modedefaulting totrueand walks the reader through pointing--rulesat 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
DetectionOnlyat paranoia 4, so it measures whether rules match, not whether the WAF decides.+bypass, #31t:cmdLine), with the interim advice to run--block-mode falseand treat output as detection only until #29 is fixed and released.stock CRS, conformance measuredversusstock 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.