Skip to content

Commit 187d820

Browse files
committed
chore(gitleaks): allowlist shell-variable Bearer headers (false positive)
The authorization-header-value rule fires on `-H "Authorization: Bearer $BOB_TOKEN"` because the broad `\S+` match treats the shell variable as a high-entropy literal. The actual token comes from $BOB_TOKEN at runtime (set elsewhere in the flow), not from the literal source text. Adds a narrowly scoped allowlist regex matching only the shell variable expansion form (`$VAR` / `${VAR}`). A genuinely hardcoded Bearer string like `Bearer abc123def456...` still trips the rule because the allowlist regex requires a literal `$`. Triggered on PR #496 (the agent_buy_with_retry helper inherited the existing flow-13/14 step 46 idiom; the original sites in flow-03/04 and buy-external are pre-existing on main and so never appeared in a PR diff scan).
1 parent 3cea3fb commit 187d820

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.gitleaks.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ regexes = [
4444
'''test test test test test test test test test test test junk''',
4545
# USDC storage slot values (uint256 padded, not secrets)
4646
'''0x0{50,}[0-9a-fA-F]{1,14}''',
47+
# Shell variable expansion in HTTP Auth headers — the actual secret
48+
# comes from $BOB_TOKEN / $LITELLM_KEY / etc. at runtime, not from
49+
# the literal source text. Matches `Authorization: Bearer $VAR` and
50+
# `Authorization: Basic ${VAR}` forms only; a hardcoded literal still
51+
# trips the rule because the allowlist regex requires a literal `$`.
52+
'''Authorization:\s+(?:Basic|Bearer)\s+\$\{?[A-Za-z_][A-Za-z0-9_]*''',
4753
]
4854
paths = [
4955
# Gitleaks own config

0 commit comments

Comments
 (0)