When you build a product whose entire reason to exist is safety, security can't be something you bolt on later. It has to be a default — baked into the workflow from day one.

So before any application code, I set up how my app handles secrets. This post walks through that setup: a deliberate, three-layer approach that makes it structurally impossible for a token to end up in version control.

The star of the show is a Git pre-commit hook. I'll explain it from scratch.

Defense in depth

No single control should be the only thing standing between you and a leak. Three layers, each catching what the previous one might miss: