hooks/secret-scan
Hooks scan for secrets
| Severity | error |
| Tiers | 1, 2 |
| Stacks | any |
| Scope | root |
| Kind | outcome |
| Source | library v0.7.0 |
| Selected by | fleetlint-minimal@v0.7.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 of this rule points at the file ([".pre-commit-config.yaml", "lefthook.yml", "lefthook.yaml", "lefthook.toml", "lefthook.json", "lefthook.jsonc", ".lefthook.yml", ".lefthook.yaml", ".lefthook.toml", ".lefthook.json", ".lefthook.jsonc"].filter(f, file(f)) + [".pre-commit-config.yaml"])[0] yields.
Sources
- https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html (guidance, 8 Detection)
- https://github.com/gitleaks/gitleaks (spec)
- https://fleetlint.org/baseline/#git-hooks
- https://fleetlint.org/baseline/#security
Generated by fleetlint docs from catalog v0.7.0.