Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@commutatus/cm-env
Advanced tools
Node package to encrypt and decrypt environment files. Each environment uses a different encryption key to maintain security
The inputs and outputs are configurable with the defaults aligned to how .env
files are generated for Next.Js
cm-env
uses Node's in-built crypto API to handle the encryption/decryption. This allows running cm-env
to be used in any environment that can run Node and avoids OS-level issues as frequently happens with other approaches that use openssl
$ npm install --save cm-env
with yarn:
$ yarn add cm-env
Installing the package locally in the project is recommended to avoid version conflicts between different projects
Inside the package.json
add some custom scripts:
{
scripts: {
"encrypt": "cm-env encrypt",
"decrypt": "cm-env decrypt",
"setup-encryption-keys": "cm-env setup",
"cm-env": "cm-env"
}
}
Here are some examples on how to use the scripts you added in the Installation
section
You'll need to create they encryption keys before you can start encrypting files
$ npm run setup-encryption-keys
This will create 3 different .key
files. Make sure to never commit these files
.env.local
with the environment variablesnpm run encrypt -- [env name]
Replace [env name]
with the environment name, for example:
$ npm run encrypt -- staging
# or
$ npm run encrypt -- dev
# or
$ npm run encrypt -- prod
This will create a file under keys/[env name].enc
which is the encrypted version of .env.local
Run this command to decrypt the .enc
file for a particular environment:
$ npm run decrypt -- [env name]
This will replace the .env.local
file with the contents of the file that was decrypted
The package takes additional arguments which can be used to customize it's behavior to better fit your needs. Check out the help menu by using this command:
$ npm run cm-env -- help
FAQs
Utilities for encrypting and decrypting env files
The npm package @commutatus/cm-env receives a total of 18 weekly downloads. As such, @commutatus/cm-env popularity was classified as not popular.
We found that @commutatus/cm-env demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.