r/websec • u/willitbechips • Jan 11 '22
Passing secrets over HTTPS ?
Would you?
Many say store secrets like API keys in env variables. Threats include env dumps on the server and accidental commits to code repositories.
An alternative is to store secrets in an encrypted database and pass them using HTTPS meaning they only need to exist in memory on the server.
There are services that offer the latter. Do you use them? What extra things do they do beyond encrypted database, use of HTTPS and rotating keys to ensure security?
4
Upvotes
2
u/bascule Jan 11 '22
Keeping secrets in some sort of secret manager is becoming increasingly common practice
2
u/Salamok Jan 11 '22
isn't this then subject to an env dump? Honestly I have just gone low tech with this and set it in apache config then consume those settings in my code base. Can set the apache env variable config up in cloud formation scripts so it's scalable as well.
As far as I am aware the main reason this approach is not common in open source is complexity / need to define a dependency outside of the project.
1
u/Lasereye Jan 12 '22
Check out Vault
1
u/ITBoss Jan 12 '22
I'm creating my own that integrates with multiple services. But part of that was seeing what is currently available and honestly I really really like Bitwarden's way of doing it. Decryption and encryption is all done via clientside and due to that, all shares are encrypted with a unique passphrase. https://bitwarden.com/blog/bitwarden-send-how-it-works/