fix(gitleaks): uppercase allowlist condition AND (Bugbot) - #459
Merged
Conversation
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>
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. |
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.
Finding
Bugbot (from backend#1404, Medium severity): the gitleaks allowlist
conditionfield 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 defaultORcondition. That means the allowlist matched ontargetRulesORpathsORregexesinstead of requiring all criteria to match together — the intendedANDwas dropped, causing the allowlist to over-match.Fix
Change
condition = "and"tocondition = "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
conditionfield 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 allowlistconditionis changed from lowercase"and"to"AND". Gitleaks treats that field case-sensitively; unrecognized values fall back toOR, so the rule was matching when any oftargetRules,paths, orregexesmatched instead of requiring all three. WithAND, the allowlist only applies when the generic-api-key rule,_test.gopath, 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.