Skip to content

fix(security): stop gitleaks failing on doc placeholder bearer tokens - #14

Merged
BasitS-hash merged 1 commit into
mainfrom
fix/gitleaks-doc-placeholder-allowlist
Aug 1, 2026
Merged

fix(security): stop gitleaks failing on doc placeholder bearer tokens#14
BasitS-hash merged 1 commit into
mainfrom
fix/gitleaks-doc-placeholder-allowlist

Conversation

@BasitS-hash

Copy link
Copy Markdown
Owner

The Gitleaks job has been red on main. All 5 findings are false positivescurl 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 curl-auth-header rule 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 paths key

In a global allowlist, paths makes 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

case default rules with this config
placeholder YOUR_ACCESS_TOKEN flagged suppressed (exit 0)
real high-entropy token, identical header shape flagged still flagged (exit 1)

Full history rescan: 47 commits scanned, no leaks found.

Test plan

  • Reproduced the 5 findings locally (gitleaks 8.30.1)
  • Positive test: placeholder suppressed
  • Negative test: real token in same shape still reported
  • Gitleaks job green on this PR

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.
Copilot AI review requested due to automatic review settings August 1, 2026 07:51
@BasitS-hash
BasitS-hash merged commit 539e971 into main Aug 1, 2026
11 checks passed
@BasitS-hash
BasitS-hash deleted the fix/gitleaks-doc-placeholder-allowlist branch August 1, 2026 07:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_SECRET exception 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.toml about why the allowlist is global and not path-scoped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .gitleaks.toml
Comment on lines +49 to +51
regexes = [
'''(?i)authorization:\s*bearer\s+(<[^>]{1,40}>|\{[^}]{1,40}\}|[A-Z][A-Z0-9_]{2,40})(["'\s\\]|$)''',
]
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.

2 participants