Skip to content

gitleaks: tolerate newer versions (allowlist a generic-api-key false positive)#114

Merged
alexkroman merged 3 commits into
mainfrom
fix-gitleaks-newer-versions
Jun 12, 2026
Merged

gitleaks: tolerate newer versions (allowlist a generic-api-key false positive)#114
alexkroman merged 3 commits into
mainfrom
fix-gitleaks-newer-versions

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

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-key rule is keyword-greedy: max_tokens contains the substring "token", so it reads this line in aai_cli/stream_exec.py as a key=value pair and flags the "value":

list(opts.llm_prompt or []), opts.model, opts.max_tokens, interval=opts.llm_interval

interval=opts.llm_interval is 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:

  • the CI-pinned v8.21.2 (unaffected — allowlist is additive)
  • the newer v8.30.1

Full ./scripts/check.sh passes 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.sh can be bumped as a follow-up — the config is now ready for it.

🤖 Generated with Claude Code

alexkroman-assembly and others added 2 commits June 12, 2026 09:23
…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>
@alexkroman alexkroman enabled auto-merge (squash) June 12, 2026 16:24
@alexkroman alexkroman merged commit 56eaf3d into main Jun 12, 2026
16 checks passed
@alexkroman alexkroman deleted the fix-gitleaks-newer-versions branch June 12, 2026 16:30
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