-
Notifications
You must be signed in to change notification settings - Fork 1.6k
multimatch applies operator too often #1086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also, there is an interesting edge case: If a multimatch rule has no transforms at all, the operator is never applied. This is consistent with the reference, yet somewhat unintuitive:
|
@dstelter you can think of it being applied but since there are no transformations is just the initial match |
@dstelter this is an interesting reduction perhaps this information should be stored as a set. For now its just an inefficiency, correct - no missing data? |
Regarding no-match-at-all:
This rule will never block anything! |
Firing the operator too often can have unintended side effects if the action increases anomaly score. I suppose one could/should refactor this to increase the score in a chained subrule, but the underlying issue remains. I'll submit a PR in a moment. |
…h doesn't modify the input Fixes owasp-modsecurity#1086
Thanks for the pull - we'll run it through the build bot forthcoming. In general i think you are right this pull request is kind of a double edged sword esp with anomaly score. |
Consider this rule:
Intuitively, this rule should never invoke the operator more than twice, right?
My test cases look like this:
The first test is successful, but the second request yields these matches ("(id, msg)"):
The operator is applied once too often if there are more multiple transforms and any of them modify the input. This problem only occurs if multiple transforms are present. The operator is always applied with the final transform value.
Another case:
Rule:
Test:
Reported matches:
Removing the
removeNulls
transform makes the duplicate match disappear, but it shouldn't appear at all ifremoveNulls
doesn't modify the input.Am I misinterpreting the multimatch specification or is there a bug?
The text was updated successfully, but these errors were encountered: