fleetlint Policy for a fleet of repositories
v0.11 (latest)
Getting started

hooks/secret-scan

Hooks scan for secrets

Severityerror
Tiers1, 2
Stacksany
Scoperoot
Kindoutcome
Sourcelibrary v0.8.0
Selected byfleetlint-minimal@v0.8.0

Requirement

A pre-commit hook (pre-commit/prek or lefthook’s pre-commit) runs a secret scanner that blocks commits containing secrets: gitleaks, trufflehog, ggshield, detect-secrets or secretlint. detect-private-key alone finds only private key blocks and counts as a partial result (warning).

Why

Secrets must be stopped before they enter history; removing them afterwards means rotation and rewrites.

Applies when

[".pre-commit-config.yaml", "lefthook.yml", "lefthook.yaml", "lefthook.toml", "lefthook.json", "lefthook.jsonc",
 ".lefthook.yml", ".lefthook.yaml", ".lefthook.toml", ".lefthook.json", ".lefthook.jsonc"].exists(f, file(f))

Fix

Add the gitleaks hook (repo: https://github.com/gitleaks/gitleaks) to .pre-commit-config.yaml, or gitleaks git --pre-commit --staged to lefthook’s pre-commit.

Agent instruction: Add the gitleaks pre-commit hook to .pre-commit-config.yaml and run prek update; with lefthook add a pre-commit command running gitleaks git --pre-commit --redact --staged --verbose.

A finding that names no file points at the first existing file of .pre-commit-config.yaml, lefthook.yml, lefthook.yaml, lefthook.toml, lefthook.json, lefthook.jsonc, .lefthook.yml, .lefthook.yaml, .lefthook.toml, .lefthook.json or .lefthook.jsonc, else .pre-commit-config.yaml.

Sources


Generated by fleetlint docs from catalog v0.8.0.