fix(runner): preserve case sensitivity for match-regex and filter-regex flags (#2523)#2524
Open
ThryLox wants to merge 1 commit into
Open
fix(runner): preserve case sensitivity for match-regex and filter-regex flags (#2523)#2524ThryLox wants to merge 1 commit into
ThryLox wants to merge 1 commit into
Conversation
…ex flags (projectdiscovery#2523) Previously, -mr (match-regex) and -fe (filter-regex) flags were registered with goflags.NormalizedStringSliceOptions, which automatically converted regex inputs to lowercase. This caused case-sensitive regex patterns and character sets (e.g. [0-9A-Z]) to fail matching against response bodies. Replaced with goflags.StringSliceOptions to preserve exact string case during flag parsing, matching the behavior of -er (extract-regex).
WalkthroughThe ChangesRegex flag normalization fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2523 by preserving case sensitivity for
-mr(match-regex) and-fe(filter-regex) command-line flags.Root Cause
Previously,
-mrand-feflags were registered withgoflags.NormalizedStringSliceOptionsinrunner/options.go, which automatically converted user-supplied regex strings to lowercase (e.g. converting[0-9A-Z]to[0-9a-z]). This caused valid case-sensitive regex patterns to fail matching against response bodies.Fix
Replaced
goflags.NormalizedStringSliceOptionswithgoflags.StringSliceOptionsforOutputMatchRegexandOutputFilterRegex, matching the existing behavior of-er(extract-regex).