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.
njet-configuration
Advanced tools
Configuration handler for projects. Njet configuration is responsible for loading yaml configuration files.
npm install njet-configuration
First load njet configuration
var njetConfiguration = require('njet-configuration');
and create first configuration:
var config = njetConfiguration.create();
To get Your configuration use:
config.get('x'); // to get specific value
config.getConfiguration(); // to get all values as json object
There are three ways to set configuration values.
config.set('x', 5);
will set "x" to 5. Now when You get Your configuration You will receive:
{ "x": 5 }
You can also replace whole configuration using load:
config.load({
y: 6
});
This will replace Your configuration and You will receive:
{ "y": 6 }
Or You can merge two objects together:
config.merge({
z: 1
});
To get:
{ "y": 6, "z": 1 }
Merge will always do deep copy of the objects. For example:
config.load({
x: 1,
y: ["a"]
});
config.merge({
y: ["b"],
z: 3
});
Will result:
{ "x": 1, "y": ["a", "b"], "z": 3 }
There are two ways to validate objects. You can add validators:
config.addValidator(function (config) {
if (config.key === undefined) {
return false;
}
return true;
});
Or schema:
config.schema({
x: config.expect.number()
});
To validate configuration, simply use:
config.validate();
config.isValid();
For more information about schema validation visit https://github.com/cruks/cruks-lib-config
You can load yaml files and directories containing yaml files like this:
config.load('/path/to/directory');
config.load('/path/to/file.yml');
config.merge('/path/to/another_file.yml');
config.merge('/path/to/another/directory');
You cann pass options to njet configuration constructor. Like this:
var config = njetConfiguration.create({
varbosity: 1,
expect: expect,
loader: loader
});
FAQs
Configuration handler for nodejs projects
The npm package njet-configuration receives a total of 0 weekly downloads. As such, njet-configuration popularity was classified as not popular.
We found that njet-configuration 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.