Fix scheme-less URL prefilter gaps, CVE year grammar, and registry double-space check#406
Open
fhightower wants to merge 2 commits into
Open
Fix scheme-less URL prefilter gaps, CVE year grammar, and registry double-space check#406fhightower wants to merge 2 commits into
fhightower wants to merge 2 commits into
Conversation
_URL_MARKER_RE only recognized '://' and '.tld/' markers, so scheme-less URLs the grammar accepts — 'example.com:8080/admin' (port breaks the '.tld/' shape) and '1.2.3.4/gate.php' (digit after the dot) — never produced a candidate span and were silently dropped. Add ':port' to the tld marker and an IPv4-host marker; the grammars remain the validators, and the existing CIDR-removal pass keeps '1.1.1.1/0' out of urls. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…paces
- The CVE year grammar 'Word("12") + Word(nums, exact=3)' was greedy and
non-backtracking, so years whose digits are all 1s and 2s (e.g.
CVE-2121-12345) consumed every digit in the first Word and failed.
Replace with Regex('[12]\\d{3}'), matching the candidate regex.
- hasMultipleConsecutiveSpaces used start-anchored re.match, so a
registry-key section with an *internal* double space passed the check
and surrounding prose was absorbed into the parsed path. Use re.search.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Changes
_URL_MARKER_REnow recognizes.tld:port/and IPv4-host (1.2.3.4[:port]/) markers, so scheme-less URLs likeexample.com:8080/adminand1.2.3.4/gate.php— which thescheme_less_urlgrammar already accepted — are no longer silently dropped by the candidate prefilterWord("12") + Word(nums, exact=3)(greedy, non-backtracking — failed on years whose digits are all 1s and 2s, e.g.CVE-2121-12345) withRegex(r"[12]\d{3}")hasMultipleConsecutiveSpacesto usere.searchinstead of start-anchoredre.match, so registry-key sections with an internal double space no longer absorb surrounding prose into the parsed path