fix(security): stop gitleaks failing on doc placeholder bearer tokens - #14
Merged
Merged
Conversation
The Gitleaks job has been red on main. All 5 findings are false
positives: `curl` usage examples in SETUP.md, PYTHON_QUICK_REFERENCE.md
and public/docs.html whose Authorization headers carry the literal
placeholder `YOUR_ACCESS_TOKEN`. No real credential was ever committed,
so nothing needs rotating. The rule matches the header's shape, not its
value, so it fires regardless.
Add a second allowlist that matches the placeholder's *form* — an
all-caps SNAKE_CASE word, or a name in <angle>/{curly} brackets.
Deliberately no `paths` key: in a global allowlist, `paths` makes
gitleaks skip those files outright rather than filter findings, so
scoping to \.(md|html)$ would stop docs being scanned at all and hide a
real secret pasted into a README. Verified with the default ruleset:
placeholder token, same file -> suppressed (exit 0)
real high-entropy token, same header shape -> still reported (exit 1)
Full history rescan: 47 commits, no leaks found.
There was a problem hiding this comment.
Pull request overview
Updates the repository’s Gitleaks configuration to suppress known false positives caused by placeholder Authorization: Bearer ... tokens in documentation, while keeping real secret scanning enabled across the repo.
Changes:
- Refactors the existing CI-only
JWT_SECRETexception into an allowlist entry with explicit scope to.github/workflows/ci.yml. - Adds a new global allowlist entry intended to suppress placeholder bearer tokens in docs by matching placeholder shape (snake_case /
<...>/{...}). - Expands/clarifies inline documentation in
.gitleaks.tomlabout why the allowlist is global and not path-scoped.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+49
to
+51
| regexes = [ | ||
| '''(?i)authorization:\s*bearer\s+(<[^>]{1,40}>|\{[^}]{1,40}\}|[A-Z][A-Z0-9_]{2,40})(["'\s\\]|$)''', | ||
| ] |
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.
The Gitleaks job has been red on
main. All 5 findings are false positives —curlusage examples inSETUP.md,PYTHON_QUICK_REFERENCE.mdandpublic/docs.htmlwhose Authorization headers carry the literal placeholderYOUR_ACCESS_TOKEN.No real credential was ever committed, so nothing needs rotating. The
curl-auth-headerrule matches the header's shape, not its value, so it fires regardless of what the token is.Fix
Adds a second allowlist matching the placeholder's form — an all-caps SNAKE_CASE word, or a name in
<angle>/{curly}brackets.Why no
pathskeyIn a global allowlist,
pathsmakes gitleaks skip those files outright rather than filter individual findings. Scoping this to\.(md|html)$would stop docs being scanned at all — hiding a real secret pasted into a README. An earlier draft did exactly that; a planted-secret test caught it. Matching on shape alone keeps every file in scope.Verification
YOUR_ACCESS_TOKENFull history rescan:
47 commits scanned, no leaks found.Test plan