
Research
Namastex.ai npm Packages Hit with TeamPCP-Style CanisterWorm Malware
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.
@leisurelink/domain-correlation
Advanced tools
- creates/sets a correlation id against a domain-context.
you can manually annotate the correlation where you need, but this library provides overload stratgies for:
a domain-context must exist for correlation to function, for example:
var domainCorrelation = require('domain-correlation');
var express = require('express');
var app = express();
var domainContext = domainCorrelation.domainContext;
app.use(domainContext.middleware);
app.use(function(req, res, next) {
console.log('correlation id for this request', domainCorrelation.getId());
next();
});
if you have a structured logger, you can use the method above in your log formatter.
if you use console.log simply to stdout/err, we have a convenience method to overload/decorate the stream.write method:
domainCorrelation.decorateStream(process.stdout);
domainCorrelation.decorateStream(process.stderr);
// or simply
domainCorrelation.decorateStream.patchStdOutErr();
this will cause every line output to be prepended as such:
cid:112316050941ILOQ3mg GET /v1/ping 200 106 - 15.427 ms
you can customize the formatting by overloading methods provided (see source)
the key to correlation id's is that they can possibly span multiple microservices and/or 3rd party service calls and still provide a unified "transaction log" even though they are all decoupled.
for internal microservices, you can share the correlation id between services on each request, say setting the 'x-correlation-id' http header. however you may use the same header to allow callers of your api to convey their own correlation id. at this point the difference is the source or trust. it may be later in your middleware chain that you can verify the identify of the caller and choose to simply trust+set the correlation id, or relate the 3rd party correlation id to the one already established. in the trust scenario, it's possible that things have been logged against a generated correlation id before you were able to trust/set... in each case you want to log these associations.
for example:
// this adds the correlation id to every line printed to stdout/stderr
domainCorrelation.decorateStream.patchStdOutErr();
// eventing decouples logging
domainCorrelation.onSetId(function(newId, oldId) {
if (!oldId) { return; }
console.log('oldCid:'+oldId);
// this would log:
// cid:b oldCid:a
});
domainCorrelation.onRelatedId(function(id) {
console.log('relatedCid:'+id);
// this would log:
// cid:a relatedCid:b
});
// this should always be your first middleware
app.use(domainContext.middleware);
// this will auto-set the response correlation header
// when res.writeHead is called
app.use(domainCorrelation.http.middleware);
app.use(function(req, res, next) {
console.log('something before we validate our caller');
// this would log:
// cid:a something before we...
next();
});
app.use(function validateUser(req, res, next) {
if (!userValid(req)) {
next(new UserInvalid());
}
var headerCorrelationId = req.headers['x-correlation-id'];
if (isTrustedCaller(req)) {
// if we trust the correlation id is from another
// internal service, set/replace it. (see onSetId above)
domainCorrelation.setId(headerCorrelationId);
} else {
// otherwise log it as a related id (see onRelatedId above)
domainCorrelation.relatedId(headerCorrelationId);
}
});
// or throughout your chain, you can log any third party id's
app.use(function performSome3rdPartyCall(req, res, next) {
make3rdPartyHttpRequest(function(httpResponse) {
var thirdPartyCorrelationId = httpResponse.headers['x-transaction-id'];
domainCorrelation.relatedId(thirdPartyCorrelationId);
});
});
FAQs
- creates/sets a correlation id against a domain-context.
The npm package @leisurelink/domain-correlation receives a total of 4 weekly downloads. As such, @leisurelink/domain-correlation popularity was classified as not popular.
We found that @leisurelink/domain-correlation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 24 open source maintainers 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
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.