I am developing applications that require user secrets to function. These credentials should not be stored in source control due to security concerns. Instead, they need to be manually created by the user or generated via a deploy script, with the values kept separate from the source code.
I am looking for the best approach to securely manage and access these user secrets in a deployment environment. What are the recommended options and best practices for handling such sensitive information, ensuring it remains secure and accessible to the applications when needed?
Specifically, I would like to understand:
- What are the common strategies or tools used to store and manage user secrets securely outside of source control?
- How can these secrets be securely accessed by the applications during deployment or runtime?
- Are there any recommended techniques or patterns to automate the process of secret management and deployment while minimizing the risk of exposing sensitive information?
Any guidance or insights on the best practices, tools, and techniques for handling user secrets in a deployment scenario would be greatly appreciated.
.envfiles is that you don't commit them to source control - only anenv.templatethat doens't contain secrets. For local development you would copyenv.templateto an untracked.envfile and "fill in the blanks". At deploy time, you would add.envfiles based on sensitive variables in your deployment ool or from secrets from your secrets vault. Some people commit encypted versions of the.envfile, in which case you would still substitute the secrets per-enrivonment. – Fenton Jun 01 '23 at 07:45