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.
Simpler way to handle spawning processes in NodeJs
var Nodeproc = require('nodeproc');
var processes = new Nodeproc();
// Most basic use
processes.spawn('npm ls').then(function(results) {
console.log('Finished');
console.log('Process ID: ', results.procId);
console.log('Exit code: ', results.exitCode);
});
// Slightly more complicated
processes.spawn({
command: 'npm',
args: ['ls'],
cwd: '/home/joe' // Specify where the command should be run from
}).then(function() {
console.log('Finished');
});
// Control stdout and/or stderr from the process.
// These can be anything that supports the write(data, encoding) method.
// These default to process.stdout and process.stderr respectively
var captureStdout = {
write: function(data, encoding) {
console.log('Got data: ', data.toString(encoding));
}
};
processes.spawn({
command: 'npm',
args: 'ls' // Can either be an array or a space-delimited string
stdout: captureStdout
}).then(funnction() {
console.log('Finished');
});
// Catch errors using a Promise catch function
processes.spawn({
command: 'npm',
args: ['doesnotexit'],
ignoreExitCode: true
}).catch(function(err) {
console.log('Got error! ', err);
console.log('Process ID: ', err.procId);
console.log('Exit code: ', err.exitCode);
console.log('Stderr: ', err.stderr);
});
// Can ignore error exit status codes, and always resolve the process
processes.spawn({
command: 'npm',
args: ['doesnotexit'],
ignoreExitStatusCode: true
}).then(function() {
console.log('Finished');
});
See the tests for more examples
FAQs
Simpler handling of spawning processes
The npm package nodeproc receives a total of 0 weekly downloads. As such, nodeproc popularity was classified as not popular.
We found that nodeproc 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.