Repository navigation
Conversation
…g changed in 2.9.8 - REQUEST_BODY_LENGTH: state that it is set whichever request body processor is used (unlike REQUEST_BODY in v2), so `@gt 0` is the way to check that a request has a body; note that v3 only sets it for a non-empty body. (owasp-modsecurity/ModSecurity#3466) - @rx: document that a macro-expanded pattern is compiled as is since 2.9.8 (and always in v3), list what 2.9.7 and earlier escaped, and how that affects CRS 3.2/3.3 rules 920420 and 920480. (owasp-modsecurity/ModSecurity#3380) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
what
Two reference-manual corrections that close two ModSecurity issues.
REQUEST_BODY_LENGTH(owasp-modsecurity/ModSecurity#3466)The manual only said "Contains the number of bytes read from a request body", and readers took the
REQUEST_BODYsentence about the URLENCODED processor to apply to it too. Added:SecRule REQUEST_BODY_LENGTH "@gt 0"is the "request has a body" check asked for in the issue (with an example rule);Checked against the code: v2
var_request_body_length_generatereturnsmsc_reqbody_length, whichmodsecurity_request_body_store_memoryaccumulates for every processor; v3 sets it inTransaction::processRequestBodyfrom the raw body buffer, after the body-access check and only when the body is not empty.@rxand macro expansion (owasp-modsecurity/ModSecurity#3380)Documented the 2.9.8 change from ModSecurity 2105ed06 ("Do not escape special chars in regex pattern with macro"): the expanded pattern is now compiled as is, which is also how v3 has always behaved. Up to 2.9.7, v2 ran the whole expanded pattern through
log_escape_re, which escapes+ . ? ( ) [ ] /(and:,") but not| ^ $ * \. The note uses the CRS 3.xallowed_request_content_typecase from the issue as the example (application/soap+xml), and says that CRS 3.2/3.3 rules 920420 and 920480 need the value escaped in the variable; CRS 4 does not use the construct.testing
hugobuilds without errors.🤖 Generated with Claude Code