fix(regex): add missing 4th octet to Email address preset for IPv4 domains#2318
Closed
terminalchai wants to merge 1 commit intogchq:masterfrom
Closed
fix(regex): add missing 4th octet to Email address preset for IPv4 domains#2318terminalchai wants to merge 1 commit intogchq:masterfrom
terminalchai wants to merge 1 commit intogchq:masterfrom
Conversation
The 'Email address' preset in the Regular Expression operation was
missing the 4th IPv4 octet in the bracketed address form, causing
addresses like user@[1.2.3.4] to never match.
The IPv4 bracket group ended after {3} repetitions of 'octet.':
\\[(?:(?:(octet))\.){3}\\]
This matches [1.2.3.] (a false positive) but not [1.2.3.4].
Fix: add the 4th octet group before the closing bracket, mirroring
the correct regex already used in ExtractEmailAddresses.mjs:
\\[(?:(?:(octet))\.){3}(?:(octet))\\]
Closes gchq#2150
|
|
Member
|
Hi @terminalchai , thank you for your pull request! I think we are already tracking this issue and have a fix ready here: #2167 . Could you check whether the changes in that pull request would satisfy your use case, or are there any other changes we need to make? |
Author
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.
Problem
The Email address preset regex in the Regular Expression operation was missing the 4th IPv4 octet in the bracketed address form (RFC 5321 address literals).
The IPv4 bracket group matched only three octets followed by a trailing dot:
\
\[(?:(?:(octet))\.){3}\]
\\
This means:
Fix
Add the 4th octet group before the closing bracket, matching the correct regex already used in \ExtractEmailAddresses.mjs:
\
\[(?:(?:(octet))\.){3}(?:(octet))\]
\\
Now:
Changes
Fixes #2150