Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
config-leaf
Advanced tools
config-leaf helps you hide your sensitive node.js bits in plain sight. It is based on John Resig's post, Keeping Passwords in Source Control.
The idea is that the configuration of deployed apps can be managed in version control for transparency and ease of rollback. But, since configuration often contains sensitive information like passwords, it shouldn't be kept in plaintext. This is where config-leaf comes in, by letting you encrypt your config in development, check it in, and then decrypt it in production or other dev environments.
Let's say that we have a node.js project with some sensitive configuration information, kept in a file called config.json
.
First, install this library as a dependency of the project:
npm install config-leaf --save
Then, make sure that you add this file to .gitignore
(or appropriate ignore file depending on your version control system) to make sure it never gets checked in:
echo config.json >> .gitignore
Finally, edit your package.json
to add the encrypt
and decrypt
scripts, such as in the following:
{
"name": "my-project",
"version": "0.0.1",
"scripts": {
...
"encrypt": "encrypt config.json config.json.cast5",
"decrypt": "decrypt config.json.cast5 config.json"
}
}
Here, the encrypt
script will encrypt the config.json
file as config.json.cast5
, and the decrypt
script will decrypt the config.json.cast5
file as config.json
. In both cases, the name of the encrypted file can be chosen arbitrarily.
Once config-leaf is installed and configured, run the encrypt
command every time you update your configuration, and enter the password when prompted.
npm run encrypt
This saves the encrypted file according to the name you set in your package.json
.
After checking the file in, use the decrypt
command in production or other dev environments, and enter the password when prompted.
npm run decrypt
Again, this saves the decrypted file according to the name you set in your package.json
.
(The MIT License)
Copyright (c) 2013 Jed Schmidt <where@jed.is>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Hide your sensitive node.js bits in plain sight.
We found that config-leaf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.