Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
The extremly well-known parallel execution of tasks, but with a cargo, a shared object where tasks can store data. It's like a cargo ship, cranes (tasks) storing cargo (data). Each task writing to the shared object.
It's very useful when you need to call a bunch of functions in parallel and store the results in a common place.
var cranes = [
function (cargo, done) {
cargo.a = 1;
done();
},
function (cargo, done) {
cargo.b = 2;
done();
},
function (cargo, done) {
cargo.c = 3;
done();
}
];
ship.load(cranes, function (err, cargo) {
// cargo { a: 1, b: 2, c: 3 }
});
It's basically the same behaviour as the async.parallel()
but with a sightly! and slightly different interface.
module.load(cranes[, cargo], callback) : undefined
Executes all tasks in parallel.
cranes
is an array of functions to run in parallel. Each function has the signature function(cargo, done)
, where cargo
is the shared object and done
the function to call when the task finishes. As usual, pass an error to done()
to abort the execution of the tasks. This is the error returned by the load()
function. Because aborting asynchronous parallel tasks is not possible once they begin, the callback is guaranteed to be called only once with the first error occurred.
A cargo
can be passed from outside. Use the second parameter to initialize the cargo with data.
var cranes = [
function (cargo, done) {
cargo.b = 2;
done();
},
function (cargo, done) {
cargo.c = 3;
done();
}
];
ship.load(cranes, { a: 1 }, function (err, cargo) {
// cargo { a: 1, b: 2, c: 3 }
});
FAQs
Parallel execution of tasks with a shared namespace
We found that cargo-ship 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.