Skip to content

Allow empty anchored variable to use #2024

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

Closed

Conversation

airween
Copy link
Member

@airween airween commented Feb 11, 2019

The problem is that when a SecRule contains an negated operator (eg. "!@ENDSWITH .pdf"), and the variable is empty (eg. REQUEST_BASENAME, and the query is a simple "GET /"), then the result of negated evaluate of empty variable will TRUE. Then the rule interpreted as the GET / IS endsWith .pdf, so it will generate a false positive match.

I don't see the reason why didn't allowed the empty variable previously, but this patch fix this bug above, and all other test result keep as PASSED.

See the rule-920200.json regression test file, which inspired the CRS id 920200 and its test.

@victorhora victorhora added enhancement 3.x Related to ModSecurity version 3.x pr available labels Feb 11, 2019
@victorhora victorhora added this to the v3.0.4 milestone Feb 11, 2019
@zimmerle zimmerle self-requested a review February 12, 2019 12:31
zimmerle added a commit that referenced this pull request Feb 12, 2019
@zimmerle
Copy link
Contributor

Merged! Thanks!

@zimmerle zimmerle closed this Feb 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x enhancement pr available
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants