Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Simple asynchronous middleware pattern.
npm install throwback --save
Compose asynchronous (promise-returning) functions.
const { compose } = require("throwback");
const fn = compose([
async function(ctx, next) {
console.log(1);
try {
await next();
} catch (err) {
console.log("throwback", err);
}
console.log(4);
},
async function(ctx, next) {
console.log(2);
return next();
}
]);
// Callback runs at the end of the stack, before
// the middleware bubbles back to the beginning.
fn({}, function(ctx) {
console.log(3);
ctx.status = 404;
});
Tip: In development (NODE_ENV !== "production"
), compose
will throw errors when you do something unexpected. In production, the faster non-error code paths are used.
Build a micro HTTP server!
const { createServer } = require("http");
const finalhandler = require("finalhandler"); // Example only, not compatible with single `ctx` arg.
const { compose } = require("throwback");
const app = compose([
function({ req, res }, next) {
res.end("Hello world!");
}
]);
createServer(function(req, res) {
return app({ req, res }, finalhandler());
}).listen(3000);
Built for servie
and inspired by koa-compose
.
MIT
FAQs
Simple asynchronous middleware pattern
The npm package throwback receives a total of 0 weekly downloads. As such, throwback popularity was classified as not popular.
We found that throwback 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.