## Что это
Pre-commit hook через `husky` запускает `gitleaks detect --staged` на staged changes. При detection: reject commit, показ list of leaks с file:line:rule. Для каждого leak — suggestion: «Move to env var», «Add to .gitleaks-allow.toml as false-positive», «Encrypt with sops». Hooks unblock-able через `--no-verify` только с явным confirmation.
Локальный rule-set `.gitleaks.toml` extends global patterns: AWS keys, GitHub tokens, Stripe keys, JWT, generic API key regex. Custom rules per workspace через `.gitleaks-rox.toml`. CI re-runs gitleaks как safety net (PRs без pre-commit caught там).
Компоненты: `.gitleaks.toml`, husky hook, CI job `gitleaks-scan`. Allow-list rotates: review quarterly.
## Зачем
Секреты в git — top-1 cause for real-world breaches. Pre-commit catches 95% случаев раньше, чем секрет попадает в remote. Без auto-fix suggestions developers обходят гука («просто закоммитить»). Auto-suggestions делают safer path easier path.
## Источники вдохновения
- [m14r41/PentestingEverything](https://github.com/m14r41/PentestingEverything) — OWASP+DevSecOps checklist для secret detection
- [blacklanternsecurity/bbot](https://github.com/blacklanternsecurity/bbot) — modular recursive scanner для audit/security-probes
- [agisota/sweetcookie](https://github.com/agisota/sweetcookie) — cookies-reader reference для credential discovery
## 🔗 Linear
- [PZD-427](https://linear.app/kuhjie/issue/PZD-427) — backing ticket