How secrets reach the repository
Every team knows not to commit credentials, and it happens continuously regardless. A developer adds a connection string to get a local build working. A configuration file is copied from a working environment into a test fixture. A key is pasted into a chat channel to unblock somebody at five in the afternoon, and chat channels remain searchable for years afterwards. The problem is not knowledge. It is that the correct path was slower than the wrong one at the moment somebody was blocked.
Making the right path the easy path is most of the fix. A managed secrets store with a local development route, so nobody needs their own copy of anything. Automated scanning on commit and across history, since a credential removed in a later commit is still sitting in the repository. And a rotation procedure that has actually been used, because the first time a key is rotated should not be during an incident. Unrehearsed rotation usually breaks something nobody predicted.
Treat exposure as an operational event with a rehearsed response. Which key, what it can reach, rotate it, check the access logs for use during the window it was exposed, and record the outcome in writing. Organisations without that sequence tend to respond to an exposed credential by debating whether it was really a problem, which consumes exactly the time that should have gone on rotating it. The answer is always to rotate. The disagreement is usually about embarrassment.
- Managed secrets store with a local development path that is easier than copying a file
- Automated secret scanning on commit and across repository history, not only current files
- Rotation as a rehearsed procedure with a known blast radius, tested outside an incident
- Distinct credentials per environment and per service, so one exposure stays contained
- A written response sequence for exposure that ends in rotation rather than in a discussion