-
Notifications
You must be signed in to change notification settings - Fork 1.7k
V3/collection re fix #2018
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
V3/collection re fix #2018
Conversation
Could somebody re-run the CI build? Looks like it was failed (by Travis):
Thanks :) |
Merged ea937cf and 640daa4. I do have something that I want to discuss about 3334d2a and 4e1b99a. The regular expression implementation is self-contained in the regex class. It means that this is the only class which effectively depends on libpcre*. Within this patch, the definition PCRE_CASELESS will be spread among other classes making them also dependent on pcre. As of now, it won't be a problem, but, as we aiming to support different regular expression backends, we better avoid this scenario. I would rather prefer to have a new signature to the method -- considering the PCRE_CASELESS flag only inside the regex class or even a modificator on the regular expression string.
|
You can make a regular expression case insensitive by prefixing it with |
Hi @WGH-, thanks, I know it - but the problem is not that. The problem is, the comparing variables on collections (in-memory and LMDB) must be case insensitive. This condition is not met. BTW, the ModSec2 follows this way... so I think we have to align the ModSec3 too. |
@@ -50,8 +50,7 @@ class SMatch { | |||
|
|||
class Regex { | |||
public: | |||
explicit Regex(const std::string& pattern_); | |||
explicit Regex(const std::string& pattern_, int flags); | |||
explicit Regex(const std::string& pattern_, bool caseSensitive = false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may not need this to be explicit anylonger.
@airween as commented by @WGH- the regular expression could be handled this with the ignore case "modificator". In any case, your pull request is currently holding four commits:
In 8040904 you have fixed a problem added in 3334d2a and 3334d2a. Do you mind to change 3334d2a and 3334d2a to actually incorporate 8040904 ? |
The 8040904 should ignore. Do I revoke it? I know what @WGH- said and your idea, but the CRS contains regex's without modifications, and modsec2 works with it. I'ld like to follow that way, tha's why I sent this PR. The other solution would be that all occurrences of necessary regex's need to add the modifier, and works of libmodsec3 should differ from ModSec2. |
Closed this PR, and re-opened a new one here: #2107 |
Looks like the Regex::searchAll() method is not case insensitive (InMemoryPerProcess::resolveSingleMatch() needs that). This bug detected with help of CRS regression test 920450.
Also fix (temporary) the 'ovector' limit bug, which triggered when the regex contains too much brackets, eg. in CRS rule 942130.