logoalt Hacker News

numbsafari • yesterday at 11:16 PM • 6 replies • view on HN

Environment variables are a terrible place to store secrets.

I'm just going to say it, since having said it non-stop for over 20 years, nobody seems to listen and we keep circling this drain.

The 12 Factor manifesto was 100% wrong on this point.

Use environment variables to point to where secrets are located, not to store their values.


Replies

skinfaxi • yesterday at 11:50 PM

> Use environment variables to point to where secrets are located, not to store their values.

Now your apps need to be able to read the secret that is pointed to, as opposed to the task runner populating the secret and the app would not know about the details.Not to mention the changes it entails to development.

➕ show 1 reply
jrochkind1 • yesterday at 11:53 PM

It doesn't sound like they got them via a shell environment, they just hacked into the place that stored them. If the place you store secrets can be hacked into, it doesn't really matter if they are injected into environment variables or not.

trollbridge • today at 3:32 AM

Or we could just use our operating systems for the things we do well, and have a service to send our API calls to that inserts the appropriate token.

I don't have to enter my Mac's password every time I open an app.

atherton94027 • today at 1:20 AM

How does this help? If your container gets compromised it's trivial to exfiltrate the secrets.

tptacek • yesterday at 11:27 PM

Environment variables are generally fine for secrets. Environment files are problematic. Modern systems that inject secrets into the environment launch the program itself.

➕ show 1 reply