-
-
Notifications
You must be signed in to change notification settings - Fork 449
Drop unnecessary capture groups #1111
Copy link
Copy link
Closed
Description
Issue for tracking original pull request created by user fgsch on date 2018-05-31 18:59:33.
Link to original PR: SpiderLabs/owasp-modsecurity-crs#1111.
HEAD is: 3b0ffac0a9edcc048190f29063e45dc1ef586d6a
BASE is: c875186
This is a WIP to remove unnecessary capture groups, i.e. where they're not referenced in the rules.
Since there are quite a few of them I will keep updating this PR until most (all?) are covered.
I've also doing some cleanup, e.g. replace or add (?i:...)
The way I'm approaching this is roughly:
- Search for patterns containing parenthesis (
rx.*(). - Check if the parenthesis are creating capture groups (~ opening parenthesis not preceded by \ and not followed by ?)
- Check if the rule has references to TX > 0
- Understand the rule
- Remove capture groups, convert them to non-capture groups (
(?:..)) or merge them with(?i)
While some tools do help, this is a very manual process.
For some patterns, I found it easier to break them apart first (over multiple lines) to understand them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels