
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
env-sops is a utility package designed to encrypt sensitive environment variables, ensuring secure storage within code repositories on platforms like GitHub. This package internally utilizes SOPS+AGE for robust encryption and decryption, coupled with the convenience of using dotEnv to load variables after decryption.
Before using env-sops
, ensure that you have SOPS and AGE installed on your machine. These tools are essential for encryption and decryption processes within the package.
Make sure to install and configure both SOPS and AGE to leverage the encryption and decryption features seamlessly offered by env-sops
.
Instructions on how to install the package using NPM.
npm install -D env-sops
touch encrypted-dev.env
Then edit the file and add some environment variables
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
"type":"module",
"scripts": {
"start": "node main.js",
"sops:encrypt:dev": "envencrypt encrypted-dev.env",
"sops:decrypt:dev": "envdecrypt encrypted-dev.env ./"
},
npm run sops:encrypt:dev
// main.js
import { loadEnvs } from 'env-sops'
const ENVS = {
"dev": "encrypted-dev.env",
"ut": "encrypted-ut.env",
"prod": "encrypted-prod.env",
}
loadEnvs(ENVS[process?.env?.env] || ENVS['dev'])
.then(() => {
console.info('Envs loaded:')
console.info(`DB_HOST: ${process?.env?.DB_HOST}`)
console.info(`DB_PASS: ${process?.env?.DB_PASS}`)
console.info(`DB_USER: ${process?.env?.DB_USER}`)
})
.catch(err => console.error(err))
npm start
## Exclude the .env file from git
echo '.env' >> .gitignore
git add .
git commit -m "Committing encrypted environment variables"
npm run sops:decrypt:dev
cp -f .env ./encrypted-dev.env
## open and edit the file encrypted-dev.env wirh your new values
npm run sops:encrypt:dev
npm run sops:decrypt:dev
## Then open the file .env and check the values
Youtube Video Soon at baikenlabs
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Initial Version
This project utilizes the following third-party tools and libraries:
FAQs
Package to help encrypt/decrypt ENV files
The npm package env-sops receives a total of 11 weekly downloads. As such, env-sops popularity was classified as not popular.
We found that env-sops 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.