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.
freeman-env
Advanced tools
simple function wrapper for code to only be run in production or development
Simple NPM wrapper for code that is only meant to be run in production/development.
This module tests the environment variable NODE_ENV
- made popular by Express and other Node modules.
npm install freeman-env --save
process.env.NODE_ENV = "production";
var env = require('freeman-env');
//callback mode - run a code block only in certain environments
env('production', function(){
console.log("This will only run in production.");
});
env('development', function(){
console.log("This will only run in dev mode.");
});
//raw mode - simple getter for process.env.NODE_ENV
//use this for switch statements and more...
env(); //this will return 'production'
switch(env()){
case "production":
...
break;
case "test":
...
break;
...
}
If you don't have process.env.NODE_ENV
defined, nothing will happen.
You can define process.env.NODE_ENV
to any string value and test against it. Here are some ideas: staging
, test
, development
, etc.
FAQs
simple function wrapper for code to only be run in production or development
The npm package freeman-env receives a total of 1 weekly downloads. As such, freeman-env popularity was classified as not popular.
We found that freeman-env 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
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.