Back to course

Pre-commit Hooks: Preventing Leaks

Modern DevSecOps (The Hard Way)

Automating Local Security Checks

Git hooks are scripts that run before certain Git events. A pre-commit hook can scan for secrets before they ever leave your computer.

Tools: trufflehog or detect-secrets.

Configuration:

Install pre-commit framework and add a .pre-commit-config.yaml to your repo. It will block git commit if it finds a private key or password.