-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ctl:removeTargetById doesn't know how to work with regex #911
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
I would loooooove this! |
As I do, kinda missing it right now ! |
…wasp-modsecurity#911 SecRule REQUEST_URI "@beginswith /index.php" \ "id:1001,phase:1,pass,nolog, \ ctl:ruleRemoveTargetById=942100;ARGS:/^password\[\d+\]$/"
Hello everyone, We have performed an investigation of the changes that would be required in order to support regular expressions in the target list of the Whenever the parser encounters an action, it creates an instance of the class associated to the respective action (e.g.: Therefore, in the case of the In contrast, the Given the above, the proper way to support regular expressions in the target of the However, this is not a trivial task due to the current implementation of the parsing of actions. In particular, regardless of the action encountered, the parser will eventually invoke the |
We have also come up with an alternative that would not require changes to the current parser implementation, but may not be the preferred way of tackling the issue. This workaround consists of the following:
We are looking forward to your opinion regarding both the analysis and the possible workaround, in order to shape a common approach in tackling the issue. |
Hey, everybody. I have some news. I came across the need to use regular expressions in ctl:ruleRemoveById Example: SecRule REQUEST_METHOD "@Streq POST" My task, to exclude checking not the whole request, but only a part of the request body, which is json. I.e. to disable checking of those json keys that match my regular expression. Error: nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsec/rules/coreruleset-4.5.0/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf. Line: 224. Column: 43. Expecting an action, got: ^hex.*$/,\ in /etc/nginx/nginx.conf:39 |
Hi @netcedec, yes, as the issue describes, actually this is the expected behavior. We will work on this feature, namely both engines (v2, v3) support the regex syntax. |
Main problem:
ctl:removeTargetById doesn't know how to work with regex . For instance:
ctl:ruleRemoveTargetByID=981248;ARGS:widget-text[4][text] - OK
ctl:ruleRemoveTargetByID=981248;ARGS:/^widget/ - BAD
The text was updated successfully, but these errors were encountered: