fix: reduce basic-auth false positives on Google Fonts CSS2 axis URLs#39
Open
AchieverSana wants to merge 1 commit into
Open
fix: reduce basic-auth false positives on Google Fonts CSS2 axis URLs#39AchieverSana wants to merge 1 commit into
AchieverSana wants to merge 1 commit into
Conversation
Fixes FasterApiWeb#28. The regex allowed /, ?, # inside the credential segment, so query strings like css2?family=...wght@0,9..40,400 were misread as user:pass@host. Credential segments now exclude path/query/ fragment characters and whitespace. Added a positive fixture (real embedded credentials still flagged) and a negative fixture (Google Fonts CSS2 axis URL no longer flagged).
tapheret2
reviewed
Jul 15, 2026
tapheret2
left a comment
Contributor
There was a problem hiding this comment.
Review: fix: reduce basic-auth false positives on Google Fonts CSS2 axis URLs
Files: patterns/generic.json, tests/test-patterns.js
Size: +9 / -1
Notes
- Static pass on the patch: no obvious blockers from the diff alone.
Thanks @AchieverSana — independent review on the patch.
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.
Fixes #28. The regex allowed /, ?, # inside the credential segment, so query strings like css2?family=...wght@0,9..40,400 were misread as user:pass@host. Credential segments now exclude path/query/ fragment characters and whitespace.
Added a positive fixture (real embedded credentials still flagged) and a negative fixture (Google Fonts CSS2 axis URL no longer flagged).
Summary
wght@0,9..40,400) were flagged as embedded basic-auth credentialsgeneric-basic-auth-urlregex to exclude/ ? # \sfrom the credential segmentType of Change
Checklist
node scripts/check-patterns.js)npm test)Test Plan
Ran
node scripts/check-patterns.js && npm test:https://admin:...@internal-api.example-corp.com/v1)Related Issues
Fixes #28