A key’s day

Part 5, Coverage · Step 3: Pre-commit hook

Hooks, CI, history, chat, and builds: what each layer catches

The pre-commit hook stops the key on the laptop. Hana ships the team a pre-commit hook that runs TruffleHog open source. Later that morning, Sam copies the payment key into .env.local to test checkout, and stages it by mistake. The hook checks the new commit, sees a live payment key, and stops it.

Why it matters. The key never reaches Git history, so there is no copy on the code server to chase.

See it in the lesson Part 5 recap

What the research found: Truffle Security, 2026

GitHub’s default push protection roughly halved how often the key types it recognizes reach public code. But 51.8% of the credentials still live in public code are shapes it doesn’t recognize.

What a hook can and can’t do

Try it with TruffleHog open source

Runs on each commit through Git hooks, the pre-commit framework, or Husky.

trufflehog git file://. --since-commit HEAD --fail

Sources

Keep going

More topics