Skip to content

fix: reduce basic-auth false positives on Google Fonts CSS2 axis URLs#39

Open
AchieverSana wants to merge 1 commit into
FasterApiWeb:mainfrom
AchieverSana:fix/google-fonts-css2-basic-auth-fp
Open

fix: reduce basic-auth false positives on Google Fonts CSS2 axis URLs#39
AchieverSana wants to merge 1 commit into
FasterApiWeb:mainfrom
AchieverSana:fix/google-fonts-css2-basic-auth-fp

Conversation

@AchieverSana

Copy link
Copy Markdown
Contributor

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

  • Fixes false positive where Google Fonts CSS2 variable-axis URLs (wght@0,9..40,400) were flagged as embedded basic-auth credentials
  • Tightens generic-basic-auth-url regex to exclude / ? # \s from the credential segment
  • Adds one positive and one negative test fixture

Type of Change

  • New pattern (adds detection for a new secret type)
  • Pattern improvement (reduces false positives/negatives)
  • New agent adapter (adds support for a new AI agent)
  • Bug fix
  • Documentation
  • CI/CD or tooling
  • Other (describe below)

Checklist

  • I have read CONTRIBUTING.md
  • Pattern validation passes (node scripts/check-patterns.js)
  • Tests pass (npm test)
  • No real secrets are included in this PR
  • Documentation is updated (if applicable)
  • I understand maintainers may require CODEOWNER review before merge

Test Plan

Ran node scripts/check-patterns.js && npm test:

  • 78 patterns valid, 0 errors
  • 49/49 tests passed, including new fixtures:
    • matches real embedded credentials (https://admin:...@internal-api.example-corp.com/v1)
    • correctly rejects the reported Google Fonts CSS2 URL

Related Issues

Fixes #28

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).
@AchieverSana
AchieverSana requested a review from EshwarCVS as a code owner July 13, 2026 06:45

@tapheret2 tapheret2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive: Google Fonts CSS2 axis URLs match Basic Auth pattern

2 participants