Skip to content

fix(gitleaks): uppercase allowlist condition AND (Bugbot) - #459

Merged
LukasWodka merged 1 commit into
developfrom
fix/bugbot-gitleaks-condition-casing
Aug 5, 2026
Merged

fix(gitleaks): uppercase allowlist condition AND (Bugbot)#459
LukasWodka merged 1 commit into
developfrom
fix/bugbot-gitleaks-condition-casing

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Finding

Bugbot (from backend#1404, Medium severity): the gitleaks allowlist condition field in .gitleaks.toml (line 9) was set to lowercase "and".

Gitleaks parses this field case-sensitively and only recognizes uppercase AND / OR. A lowercase value is not matched, so gitleaks silently falls back to the default OR condition. That means the allowlist matched on targetRules OR paths OR regexes instead of requiring all criteria to match together — the intended AND was dropped, causing the allowlist to over-match.

Fix

Change condition = "and" to condition = "AND" so the allowlist requires all criteria (targetRules AND paths AND regexes) as intended.

Confirmation that uppercase is correct

Verified against the gitleaks config documentation (gitleaks README): the condition field values are uppercase — "OR" (default) and "AND". Quote: the default condition is "OR", and "AND" "can be used to make sure all criteria match." Lowercase values are not recognized.

🤖 Generated with Claude Code


Note

Low Risk
Single config-token change in .gitleaks.toml; tightens secret-scan allowlist behavior with no runtime or auth impact.

Overview
Fixes gitleaks allowlist logic for the synthetic idempotency-key exception in submit tests.

In .gitleaks.toml, the allowlist condition is changed from lowercase "and" to "AND". Gitleaks treats that field case-sensitively; unrecognized values fall back to OR, so the rule was matching when any of targetRules, paths, or regexes matched instead of requiring all three. With AND, the allowlist only applies when the generic-api-key rule, _test.go path, and the nightly-claims idempotency-key pattern all match together.

Reviewed by Cursor Bugbot for commit ae46277. Bugbot is set up for automated code reviews on this repo. Configure here.

Gitleaks parses the allowlist `condition` field case-sensitively and only
recognizes uppercase `AND`/`OR`. The lowercase `"and"` was silently treated
as the default `OR`, so the allowlist matched on targetRules OR paths OR
regexes instead of requiring all criteria — over-matching and potentially
suppressing real findings. Corrected to `AND`.

Bugbot finding from backend#1404.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka LukasWodka self-assigned this Aug 5, 2026
@LukasWodka
LukasWodka requested a review from saadqbal August 5, 2026 10:46
@LukasWodka
LukasWodka merged commit 7289b4b into develop Aug 5, 2026
29 checks passed
@LukasWodka
LukasWodka deleted the fix/bugbot-gitleaks-condition-casing branch August 5, 2026 12:41
@LukasWodka

Copy link
Copy Markdown
Contributor Author

FR on staging → Ready for prod (staging FR sweep, 2026-08-06). Basis: CI/tooling-only change with no product runtime surface — verified green through code review + Bugbot on develop and the fr-gated staging promotion. No product-behavior verification required for this class.

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.

1 participant