82.9 Secrets Management: Environment Variables and Vault
Right, let’s talk about secrets. Not your deep, dark ones—I’m not your therapist. I’m talking about the things that, if leaked, turn your cloud bill into a number that would make a CFO weep: API keys, database passwords, signing certificates, private crypto keys. The lifeblood of your application and the crown jewels for an attacker. The first rule of secret management is simple: your code should never contain a secret. I don’t care if it’s a config.php file you swear is only on the server. I don’t care if it’s a commented-out line you forgot about. It’s version controlled, it’s in a backup, it’s sitting in a colleague’s local history. It’s a liability. The goal is to have a codebase you can shout from the rooftops without giving anything away. So how do we feed these secrets to our applications without baking them in? We have two main schools of thought, one deceptively simple and one properly robust.