From 6e2f9185a8ca43c35a97d0b4011d812b215e3fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 3 May 2026 22:48:17 +0200 Subject: [PATCH] chore(ci): allowlist test fixtures + OpenAPI examples in gitleaks scan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gitleaks 8.x flags the literal string "idempotency-key" (header name) and any quoted "token: …" inside test fixtures as generic-api-keys. Both are non-secrets — header name + opaque test-only UUIDs / placeholder "hlk_example_…" tokens used in route tests and the OpenAPI spec. Adds a `.gitleaks.toml` extending the default ruleset with: - path allowlist for `**/__tests__/**` and `*.test.ts` - path allowlist for `docs/api/openapi.yaml` - substring allowlist for `idempotency-key` and `hlk_example` No real secret bypass: the existing `hlk_<64-hex>` regex still triggers on any non-`hlk_example` prefix, so a real token leak would still fail the scan. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitleaks.toml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .gitleaks.toml diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 000000000..ca4bddc63 --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,30 @@ +# Gitleaks configuration. Extends the built-in default ruleset and adds +# a project-specific allowlist for false-positives that gitleaks 8.x flags +# as "generic-api-key" inside test fixtures. +[extend] +useDefault = true + +[allowlist] +description = "Project-wide ignores for test fixtures and known non-secret tokens" + +paths = [ + # All test files contain hardcoded fake tokens / idempotency-keys. + '''(^|/)__tests__/''', + '''\.test\.ts$''', + # OpenAPI spec contains example tokens (`hlk_example…`) used to document the schema. + '''^docs/api/openapi\.yaml$''', +] + +# Substring matches — anything matching is treated as non-secret regardless of file. +regexes = [ + # Idempotency-Key request-header values are random UUIDs / opaque strings, + # not secrets. The header name itself just trips the generic-api-key rule. + '''idempotency-key''', + # Allow the placeholder prefix used in OpenAPI examples + docs. + '''hlk_example''', +] + +# Specific commit fingerprints from prior false-positive findings (kept for reproducibility). +# Empty by default; populate via `gitleaks detect --report-path` if a future regression +# triggers the same false-positive on a stable commit hash. +stopwords = []