Live data from Hacker News

Don't use ENV variables for secret data (2017)

diogomonica.com

11–20 of 147 posts

Re: Don't use ENV variables for secret data (2017)

#11
Great :-(

Had to read to the end of the description of why environment variables are bad to discover that it is effectively an advertisement for Docker. I don't use Docker so the article told me pretty much nothing that wasn't fairly obvious already, although it is a valuable reminder.

Re: Don't use ENV variables for secret data (2017)

#12
The advice is good. But why is ENV capitalized? The term is just "environment variable". One heuristic I use for evaluating technical material is orthography: if you spell or capitalize or spell something improperly, it's likely you'll get a lot else wrong too.

As for secret storage: didn't we solve this problem with keyrings? If I must put a secret in long-term plaintext storage, I might as well put it in a file, where I can see, access-control it, and audit it. Where's the audit log for someone reading an environment variable value?

Re: Don't use ENV variables for secret data (2017)

#13
So the author offers two alternatives:

1. Using docker-secret inside of a Docker swarm

2. Using Keywhiz [1], a Java server together with a FUSE client.

This seems overkill for a lot of cases. If environment variables are such a security problem, why not just use a config file (not checked into the source code repository) with proper permissions set?

[1] https://developer.squareup.com/blog/protecting-infrastructur...

Re: Don't use ENV variables for secret data (2017)

#15
post #4

Earlier quoted context omitted.

It's way better than hard coding them into the code.

Why is that? Also, as an aside: The very premise of plaintext credentials for computer-computer database connections always seemed strange to me. Maybe I'm just not knowledgeable enough here, but I wish the standard for database credentials was key-based.

Now every developer has access to any db credential that was in source control. If your project has had hundreds or thousands of developers that is a security concern.

Re: Don't use ENV variables for secret data (2017)

#16
post #4

Earlier quoted context omitted.

It's way better than hard coding them into the code.

Why is that? Also, as an aside: The very premise of plaintext credentials for computer-computer database connections always seemed strange to me. Maybe I'm just not knowledgeable enough here, but I wish the standard for database credentials was key-based.

Because if I give an external developer access to the source code for developing, I won't expose internal data and systems.

Bigger companies also may have different compliance restrictions which means developers don't get access to production, only the Administrators.

Re: Don't use ENV variables for secret data (2017)

#18
post #4

Earlier quoted context omitted.

It's way better than hard coding them into the code.

Why is that? Also, as an aside: The very premise of plaintext credentials for computer-computer database connections always seemed strange to me. Maybe I'm just not knowledgeable enough here, but I wish the standard for database credentials was key-based.

if you hard code the credentials you can’t tumble them without a complete rebuild. Also, and more importantly if you check in your code those creds are now in source control and should be considered compromised.

Injecting via secrets allows us to tightly control where the secret goes and who has access as well as make it easy to tumble.

Re: Don't use ENV variables for secret data (2017)

#19
If migrating your infrastructure to swarm is not feasible:

- make sure to sanitize the environment before spawning any child processes.

- Be sure to `set +x` (or your shell's equivalent) in your CI process

- that your secrets never get interpolated into a string through your scripting language.

Post reply on HN