Skip to content

chore(ci): allowlist the validator key: field gitleaks false positive#17

Merged
21tmccauley merged 1 commit into
mainfrom
chore/gitleaks-validators-allowlist
Jul 23, 2026
Merged

chore(ci): allowlist the validator key: field gitleaks false positive#17
21tmccauley merged 1 commit into
mainfrom
chore/gitleaks-validators-allowlist

Conversation

@21tmccauley

Copy link
Copy Markdown
Collaborator

What

Adds a repo-root .gitleaks.toml that keeps gitleaks' full default ruleset and adds one narrowly-scoped allowlist for a false positive in the validator registry.

Why

The secrets CI job runs gitleaks git over the full repo history, across all branches. Every validator file (validators/<category>/<id>.yaml) starts with:

key: <validator-id>     # e.g. key: s3_replication_kms_encryption

gitleaks' generic-api-key rule reads that YAML field name as a credential assignment and flags validators/aws/s3_replication_kms_encryption.yaml (the one whose identifier clears the entropy threshold today). It's a declarative validator identifier, not a secret.

Because the scan spans full history, that single commit trips the secrets gate on every open PR — including ones that never touched validators/ (e.g. #3). This unblocks all of them at once.

The allowlist

condition = "AND" over three conditions, so a finding is suppressed only when all hold:

  • rule is generic-api-key,
  • file is under validators/…​.yaml,
  • the matched line is key: <snake_id>.

A real credential elsewhere in a validator file — or from any other rule — is still reported.

Verification (gitleaks 8.30.1, the CI version)

Config Result
default (no config) 1 leak
this .gitleaks.toml (auto-detected, exact CI invocation) 0 leaks
control: path matches, key: regex forced non-match 1 leak (regex required)
control: key: regex matches, path forced non-match 1 leak (path required)

The negative controls prove it's genuinely surgical — neither the path nor the regex alone suppresses the finding.

After merge

Merging this to main clears the gate for open PRs whose CI checkout merges in main (#3, #15). They may need a re-run or a quick main-merge to pick it up.

🤖 Generated with Claude Code

The `secrets` CI job runs `gitleaks git` over the full repo history, across
all branches. The validator registry (validators/<category>/<id>.yaml) begins
each file with `key: <validator-id>`, and gitleaks' generic-api-key rule reads
that YAML field name as a credential assignment — flagging
`validators/aws/s3_replication_kms_encryption.yaml` (the one whose identifier
clears the entropy threshold today). It is a declarative validator identifier,
not a secret.

Because the scan spans full history, that one commit fails the secrets gate on
*every* open PR, not just the branch that introduced it.

Add a repo-root `.gitleaks.toml` that keeps the full default ruleset and adds a
tightly-scoped allowlist: condition = "AND" over the generic-api-key rule, the
validators/ path, and the leading `key: <snake_id>` line — so a real credential
elsewhere, or from another rule, is still caught. Verified with gitleaks 8.30.1
(the CI version): scan goes from 1 finding to 0, and negative controls confirm
neither the path nor the regex alone suppresses it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@21tmccauley
21tmccauley merged commit 5b72cdc into main Jul 23, 2026
7 checks passed
@21tmccauley
21tmccauley deleted the chore/gitleaks-validators-allowlist branch July 23, 2026 15:51
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