Regex cross-language compatibility#367
Merged
tsellers-r7 merged 1 commit intorapid7:masterfrom Jul 28, 2021
Merged
Conversation
Contributor
Author
rkirk-nos
approved these changes
Jul 28, 2021
Contributor
|
Seems great here! Any chance we can get a test case to scan new regexes for the incompatible variants? ([:digit:], non-leading ?i, etc). |
Contributor
Author
|
@hdm - I'm leaning towards an effort to separate the fingerprint databases into their own repo and then have language/tool specific tests that ensure that we know that patterns are valid in the standard/common regex libs for Ruby, Go, Java, etc and also pass the build in tests vs examples. |
Contributor
|
See #138 for when tests for this can be accomplished 😃 |
gschneider-r7
approved these changes
Jul 28, 2021
3 tasks
3 tasks
3 tasks
3 tasks
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.
Description
The intent of this PR is to improve cross language compatibility for the regex patterns used.
The changes:
Moves inline flags such as
(?i)and(?m)to the beginning of the regex. In Python these flags have global meaning and use of them anywhere other than the start of the pattern is deprecated. This does not change the function of these flags in current patterns for other languages.Replaces the use of POSIX character class indicators (
[[:alnum:]],[[:digit:], and[[:space:]) with either the short backslash version (\d,\s) or a character range (a-zA-Z0-9). The reason for this is that certain languages (Java, Python, Javascript) don't support the use of POSIX character classes.How Has This Been Tested?
rspec, 3rd party regex testors.Types of changes
Fingerprint construction
Checklist: