Repository navigation
Fix checked parsing for argument and JSON depth limits - #3602
AnnoyingTechnology wants to merge 3 commits into
Conversation
|
fzipi
left a comment
There was a problem hiding this comment.
Thanks @AnnoyingTechnology, this is a nice catch and a clean fix.
What I checked:
- Reproduced the bug on current v3/master: with
SecArgumentsLimit 4294967296the value wraps to 0, the debug log showsSkipping request argument, over limit (0), and a simpleARGS:adeny rule no longer fires.modsec-rules-checkaccepts that config without complaint. - With your change the same config fails to load with
Failed to parse SecArgumentsLimit: Value is too big., and the uint64-overflow case givesNumber out of range. The new productions follow the same pattern as the neighbouringSecRequestBodyLimitone. - Regenerated the parser with bison 3.8.2: the committed
seclang-parser.ccis byte-identical to fresh output. - The new regression file is registered in
test-suite.in. 4 of its 6 cases fail on master and all 6 pass with the fix. Fullmake checkon the PR merged into current v3/master: 5141 total, 5121 pass, 20 skip, 0 fail.
Comments:
-
(blocking for merge, mechanical only) The branch is behind v3/master and
src/parser/seclang-parser.ccnow conflicts. The.yyandtest-suite.inmerge cleanly, so a rebase plus regenerating the parser with bison 3.8.2 (--enable-parser-generation, or run bison on the.yy) is all that's needed. I did that locally and it builds and passes. -
(non-blocking) The two "accepts the uint32 maximum" cases only check that the config loads, and they also pass on master because
atoihappens to give 4294967295 there. If you want them to show more, you could send an argument and assert it's still inspected (e.g. a deny rule onARGSwithSecArgumentsLimit 4294967295). Fine to leave as is.
Approving on the code; it just needs that rebase before it can be merged.
The uint32 maximum cases only checked that the configuration loaded, which also passed with the previous atoi() parsing. Send an argument and a JSON body and assert that a deny rule on them still fires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8d3612c to
f3cfe39
Compare
|
Thanks for the thorough review. Rebased on current v3/master and regenerated src/parser/seclang-parser.cc with bison 3.8.2. Also took your second suggestion: the uint32-maximum cases now send an argument and a JSON body and assert a deny rule still fires (verified they fail with the limit forced to 0). Full make check: 5154 total, 5093 pass, 61 skip, 0 fail. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|



I have excess 5.6-sol and Fable 5 credits, and decided to use them to contribute back to OSS that I depend upon.
gpt5.6-sol cross-checked by Opus 4.8. Fable 5 could not cross-check due to safeties being triggered.
what
SecArgumentsLimitthrough its existing checkedConfigUnsignedIntwrapper.SecRequestBodyJsonDepthLimit.wrapper's range.
uint32_tmaximum,2^32, and decimals wider thanuint64_t.make checksuite.why
PR #3421 converted these fields to checked unsigned wrappers so out-of-range
configuration would fail during startup, but these two grammar productions
still assigned
atoi(...)directly.On the tested platform,
4294967296wrapped to zero. A zeroSecArgumentsLimitskipped every request argument, while a zeroSecRequestBodyJsonDepthLimitprevented the top-level JSON argument from beingexposed. The new code uses the same checked parsing pattern as the adjacent
body, PCRE, and upload limits.
This is configuration validation for trusted directives, not a remotely
triggerable vulnerability claim.
validation
SecArgumentsLimitregression: 2 passed, 0 failed.make check: 5,049 total; 4,997 passed; 52 skipped; 0 failed.git diff --check: pass.jq: pass.Base:
v3/masterat7ea9fefbe0ba409d8733b4d682c8c4c059cd028d.references
productions that still assigned
atoi(...)directly.Summary by CodeRabbit
Bug Fixes
Tests