gitleaks: tolerate newer versions (allowlist a generic-api-key false positive)#114
Merged
Conversation
…ions gitleaks >= 8.30's generic-api-key rule is keyword-greedy: `max_tokens` contains "token", so it reads `opts.max_tokens, interval=opts.llm_interval` in aai_cli/stream_exec.py as a key=value pair and flags the "value", which holds no literal secret. CI pins an older gitleaks (scripts/gate_tool_pins.sh, v8.21.2) that doesn't match it, so the local gate fails for anyone on a newer gitleaks while CI stays green. Allowlist the exact expression so the secret-scan gate passes under both the pinned version and newer gitleaks. Tightly scoped to this expression -- every other real-looking token still fails the gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The secret-scan gate (
scripts/check.sh→ gitleaks) fails locally for anyone running gitleaks >= 8.30, while CI stays green because it pins v8.21.2 (scripts/gate_tool_pins.sh).The newer
generic-api-keyrule is keyword-greedy:max_tokenscontains the substring "token", so it reads this line inaai_cli/stream_exec.pyas a key=value pair and flags the "value":interval=opts.llm_intervalis pure attribute access — no literal secret — so this is a false positive.Fix
Allowlist the exact expression in
.gitleaks.toml. The entry is value-based and tightly scoped, so it holds across gitleaks versions and every other real-looking token still fails the gate.Verification
gitleaks dir -c .gitleaks.toml .exits 0 under both:Full
./scripts/check.shpasses with v8.30.1 on PATH.Note
This leaves the CI pin at v8.21.2 (reproducibility). If we'd rather have CI exercise the newer version directly, the pin in
scripts/gate_tool_pins.shcan be bumped as a follow-up — the config is now ready for it.🤖 Generated with Claude Code