Configures and runs gitleaks - Go-based secret scanner with `gitleaks git` (scan local git via `git log -p`), `gitleaks dir` (filesystem), `gitleaks stdin` (pipe); 100+ built-in rules + custom rules in `.gitleaks.toml` ([[rules]] with regex / entropy / keywords / tags); allowlist via [[rules.allowlists]] (commits / paths / stopwords); pre-commit hook + GitHub Action integration; plus baseline management for legacy debt - onboarding a repo with historical findings via `--baseline-path` snapshots, `.gitleaksignore`, cross-tool suppression consistency with TruffleHog, and rot-prevention cadence. Use when the team needs OSS secret scanning at commit time + CI gate, or is adopting scanning on a repo with pre-existing findings.
72
91%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Companion reference for gitleaks-scanning. Consult when enabling secret
scanning on a repo that already has historical findings (unblock PRs without
ignoring the debt), or when per-scanner ignore configs have drifted out of
sync and need consolidating into one governed allowlist.
From broadest to narrowest:
| Layer | Mechanism | Config location |
|---|---|---|
| Baseline snapshot | --baseline-path gitleaks-baseline.json | CI flag |
| Config allowlist (all rules) | [[allowlists]] block | .gitleaks.toml |
| Config allowlist (one rule) | [[rules.allowlists]] block | .gitleaks.toml |
| Fingerprint suppress | .gitleaksignore (one fingerprint per line) | repo root |
| Inline suppress | # gitleaks:allow comment | source file |
[[allowlists]] supports commits (SHA list), paths (regex), regexes
(secret-value pattern), stopwords (keyword match), and regexTarget
("match" or "line"). Within a block the default condition is OR; set
condition = "AND" to require all criteria (gl).
.gitleaksignore is marked experimental and matches by exact Fingerprint
value from the scan JSON output (gl).
TruffleHog's primary suppression lever is output filtering, not path exclusion:
| Layer | Mechanism | How |
|---|---|---|
| Output filter | --results=verified | Show only API-confirmed secrets |
| Detector skip | --exclude-detectors=TYPE | Drop noisy detector class |
| Inline suppress | trufflehog:ignore comment on the finding line | Source file |
--results accepts verified, unverified, unknown, and
filtered_unverified; default is verified,unverified,unknown (th).
TruffleHog ships no baseline-snapshot file and no path-exclusion flag: the
practical baseline equivalent is gating CI on --results=verified and
recording remaining unverified findings as waivers.
# Gitleaks - full history snapshot
gitleaks git --report-format json --report-path .secrets/gitleaks-baseline.json
# TruffleHog - full snapshot for the triage record
trufflehog git file://. --results=verified,unverified,unknown \
--json 2>/dev/null > .secrets/trufflehog-baseline.jsonCommit .secrets/ so CI diffs against this state.
# Gitleaks: only NEW findings fail the build
gitleaks git --baseline-path .secrets/gitleaks-baseline.json \
--report-format json --report-path leaks.json
# TruffleHog: verified-only gate; unverified tracked separately
trufflehog git file://. --results=verified --json 2>/dev/null > trufflehog.jsonEvery finding in a committed baseline snapshot needs a waiver entry with
expires + approved_by + reason - the paper trail that stops baselines
from silently accumulating unreviewed debt. The waiver-file schema, approval
tiers, expiry windows, and verdict-time enforcement are owned by
multi-tool-finding-triage (its references/waiver-schema.md) -
do not maintain a parallel waiver format here.
Suppress always-safe paths and known dummy values in both scanners together, or a finding fixed in one keeps firing in the other:
# .gitleaks.toml - global allowlist
[[allowlists]]
description = "vendor and generated code"
paths = ['''vendor/.*''', '''generated/.*''', '''tests/fixtures/.*\.json$''']
[[allowlists]]
description = "known test-key patterns"
stopwords = ['''EXAMPLEKEY''', '''DUMMYSECRET''', '''REPLACE_ME''']TruffleHog has no path-exclusion flag (th): use trufflehog:ignore
inline comments where feasible, or rely on the --results=verified gate.
One-off exceptions: append the Fingerprint value to .gitleaksignore
(one per line).
multi-tool-finding-triage at verdict time).--baseline-path filters by fingerprint, so stale
entries for rotated secrets cause no false negatives - but they obscure the
true size of accepted debt. Regenerate after each bulk rotation:gitleaks git --report-format json --report-path .secrets/gitleaks-baseline.json