Written by Mot
Security is an evermoving target - an arms race. But that doesn't mean it should be hard to use. Good design can make complex things simple, and that is what we are after at Dotenv.
Dotenv is a security tool. It has been since it was first developed in 2013. We saw developers struggling to keep their secrets safe so we pioneered the .env file format standard. The design led to better DSX - which led to safer secrets for millions of developers. Today, we are taking that to the next logical step.
What is the problem with .env files today? The world has changed. Developers manage secrets at far greater scale than a decade ago. .env files are not easily shareable between machines, environments, and team members. As a result, developers often share secrets over Slack and email. It's not scaleable and fraught with security risks. For a CTO or CSO it is a risk they should not take.
So, we started extending the .env file format to support syncing across machines, environments, and team members. It's come a long way and it is only going to get better. It's an exciting development and we welcome you to go on this journey with us.
We are designing a handful of extensions and services on top of the .env file format to make this happen. They are:
|.envfile||Trusted and proven file format for securing development secrets|
|.env.vaultidentifier||Uniquely identifies your project on dotenv-vault|
|.env.mecredential||Uniquely authorizes you to access a project's shared .env file|
|dotenv-vaultcli||Sync environment variables, securely.|
npx dotenv-vault push
You run npx dotenv-vault push. The request is started.
The .env file is encrypted and sent securely over SSL to Dotenv's in-memory servers.
This encrypted payload is decrypted and briefly held in memory to complete the next steps. Afterward, the memory is flushed. Rest assured the decrypted version is never peristed to Dotenv systems.
The .env file is parsed line by line - in memory.
Note: There are some differences between dotenv parsers across various languages and frameworks. So far Dotenv Vault handles these 100%, and we continue to add test cases to cover all edge cases.
Each key/value pair (and any comments) are extracted - in memory.
The secret is divided into its separate key and value. This is by design. They will be stored in separate databases for added security. This way if an attacker somehow gained access to one database they would not be able to make sense of the data - having only half of the puzzle.
The KEY is encrypted. The VALUE is encrypted. They are encrypted with different master encryption keys. This way if an attacker somehow gained access to the VALUE decryption key they would find the data useless. They would not know if the secret belonged to Twilio or to AWS.
Encryption uses the AES-GCM algorithm. It is:
Additionally, all master encryption keys are rotated on an unpublished schedule, further adding to the level of security.
Dotenv Vault Store
The encrypted VALUE is sent to Dotenv Vault for safe storage. A token is returned as an identifier. The token is used in the next step for mapping the KEY to the VALUE for later secure-read operations.
Multiple security measures go into the Vault. They include but are not limited to:
Dotenv Application Database
Store Key Part with Token
Lastly, the encrypted KEY and token (representing the encrypted VALUE) are placed in an envelope and stored together in the application database.
A success message is returned to the user.
And this is just the start. There are also integrations into 3rd party services like AWS Secrets, AWS Parameter Store, Vercel, Netlify, Slack, Heroku, GitHub, and more - as well as plans to allow you to Bring Your Own Vault™.
It is going to be an exciting journey. Thank you for using Dotenv.
Learn more about security at Dotenv.
|New to dotenv-vault? Start here|
|Connecting infrastructure (docs coming soon)|
|Managing granular permissions (docs coming soon)|
|Rolling back versions (docs coming soon)|
|IT tokens limited credential|
|How dotenv-vault works|
|Use dotenv with Express|
|Use dotenv and dotenv-vault with Express|