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.
middleware-chain
Advanced tools
Chain your node.js functions.
Middleware Chain allows you to simply chain your syncronous / asyncronous middleware functions. It works in a very similar way to how express handles middleware.
Works really well using the consign module to autoload your scripts.
chain([context], chain);
var chain = require('middleware-chain');
chain([ one, two, three ]);
// Optionally pass in context
var app = { hello: 'world' };
chain(app, [ one, two, three ]);
Please check out the examples or test folder for more!
$ npm install middleware-chain
The optional context object is passed in as the first parameter, it can be an object containing anything you'd like to access throughout your middleware chain.
The chain parameter is required, it's an array containing functions to be called in order.
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
var chain = require('middleware-chain');
function one(context, next) {
setTimeout(function() {
context.one = 'Hello';
console.log('Hello from one', context);
return next();
}, 1000);
}
function two(context, next) {
setTimeout(function() {
context.two = 'Hello';
console.log('Hello from two', context);
return next();
}, 1000);
}
function three(context, next) {
setTimeout(function() {
context.three = 'Hello';
console.log('Hello from three', context);
}, 1000);
}
chain([ one, two, three ]);
Hello from one
Hello from two
Hello from three
FAQs
Chain your node.js middleware / functions
We found that middleware-chain 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.