Reputation: 4951
I am aware that the standard way to store sensitive data is in the environment variables, in particular outside of the git repo.
There are many posts discussing this topic, reiterating this as standard practice, but I am still unclear on what the pros and cons of storing passwords/keys actually as environment variables versus simply as JSON somewhere in the user's home directory outside the repo?
Unless I'm mistaken, if the server becomes compromised, both environment variables and arbitrary JSON file are equally exposed to someone with access to the machine.
The two methods seems remarkably similar when you consider that for persistent environment variables the keys and secrets would probably be stored in an appropriate script like .profile anyway.
Upvotes: 3
Views: 1867
Reputation: 175
If you store API keys and something/someone gains permissions like those of the program which must normally use those keys it is theoretically game over. However, practically there are games you can play to make life hard for the adversary (and yourself sadly):
Wish I could give a better answer. At the end of the day security is best effort. Secure your perimeter, your network, and the server and make it difficult to find the key post-intrusion. This difficulty may give you time to detect the intrusion before a data breach occurs.
Upvotes: 0