
Research
TeamPCP-Linked Supply Chain Attack Hits SAP CAP and Cloud MTA npm Packages
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.
deferred-chain
Advanced tools
A system for abusing callbacks.
An ordinary Node-style long-running function looks something like this:
doSomethingLongRunning (..., cb) {
...
}
When that process is done, cb is fired off, with an error and a data parameter. However, this often means we end up with spaghetti code that looks something like this:
Group.fromId(id, function (err, group) {
if (err)
return dealWithError(err);
group.getOwner(function (err, user) {
if (err)
return dealWithError(err);
user.getGroups(function (err, groups) {
if (err)
return dealWithError(err);
// do something with the groups
});
})
});
It would be much nicer if we could get to that end goal without all the middle-men callbacks getting in the way, like this:
Group.fromId(id).getOwner().getGroups(function (err, groups) {
if (err)
return dealWithError(err);
// do something with the groups
});
We can achieve this by marking our methods as deferrable, and providing a prototype for the expected return value:
const deferrable = require('deferrable');
Group.fromId = deferrable(function(id, cb) {
db.find(..., cb);
}, User.prototype);
FAQs
A system of abusing callbacks
The npm package deferred-chain receives a total of 6 weekly downloads. As such, deferred-chain popularity was classified as not popular.
We found that deferred-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
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.