fix(921422): reduce false positive#4433
Open
touchweb-vincent wants to merge 9 commits into
Open
Conversation
Contributor
|
📊 Quantitative test results for language: |
Added a new negative test case for boundary value checks.
Added comments to clarify rule logic and boundary validation.
for more information, see https://pre-commit.ci
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.
Proposed changes
Hello,
It can happen - rarely - and usually on custom-built applications, that this rule is triggered because of an unlikely boundary.
For example, this one:
curl -H "x-format-output: txt-matched-rules" -H "x-crs-paranoia-level:4" "http://sandbox.coreruleset.org/" -H 'Content-type:multipart/form-data; boundary=3cmYTdyNT2jZxYyV7T_pL4irNeChj-CSS'921422 PL2 Content-Type header: Dangerous content type outside the mime type declaration
RFC 2046, section 5.1.1 https://www.rfc-editor.org/rfc/rfc2046.html, appears to define the allowed content for the boundary value, but I disagree with opening things up that much, since I have never observed anything outside the scope
[\w\-]+. I therefore propose to stick with the[\w\-]+scope for the chained rule handling these rare false positives, rather than adopting what RFC 2046 allows:^[\w\-'()+_,./:=?]{1,69}$.This will probably make the rule sensitive to multiple Content-Type declarations on unlikely frontends that do not comply with RFC 7230 section 3.2.2, but rule 920620 is supposed to address this need.
What do you think?
PR Checklist
commentfield to write the expected behaviorFurther comments
For the reviewer
ctl:requestBodyAccess=Offwere used in the rule