Scan a repository for hardcoded secrets in CI using gitleaks with a custom allowlist and per-line exceptions

domain: github.com/gitleaks/gitleaks · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a repo-level config file that either fully replaces the default ruleset or extends it by referencing the base config to inherit its rules.
  2. Add an allowlist section listing safe commits, file paths, or regexes to exclude from findings, keeping in mind that chained configs' allowlists append rather than override.
  3. For one-off known test secrets in source, add a gitleaks:allow trailing comment on the specific line rather than broadening the global allowlist.
  4. Run gitleaks detect in the CI job with the custom config path and a SARIF report output, then upload the SARIF to code scanning for tracking.
  5. Maintain a .gitleaksignore file keyed by finding fingerprint for accepted-risk secrets that shouldn't reappear as new findings on every scan.

Known gotchas

Related routes

Detect secrets committed to a Git repository using gitleaks in CI
gitleaks.io · 5 steps · unrated
Configure gitleaks and trufflehog for secret scanning with pre-receive and pre-commit hooks
github.com/gitleaks/gitleaks · 6 steps · unrated
Scan a repository directory recursively with OSV-Scanner to find vulnerabilities across all supported lockfiles
osv.dev · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans