Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
aws-xray-sdk-koa2
Advanced tools
AWS X-Ray SDK Core (aws-xray-sdk-core) Koa 2.x or greater
The AWS X-Ray Koa package automatically records information for incoming and outgoing requests and responses, via the middleware functions in this package. To configure sampling, dynamic naming, and more see the set up section.
The AWS X-Ray SDK Core has two modes - manual
and automatic
.
Automatic mode uses the cls-hooked
package and automatically
tracks the current segment and subsegment. This is the default mode.
Manual mode requires that you pass around the segment reference.
In automatic mode, you can get the current segment/subsegment at any time: var segment = AWSXRay.getSegment();
In manual mode, you can get the base segment off of the context object: var segment = ctx.segment;
The Koa X-Ray SDK provides one middlewares: xrayKoa.openSegment(<name>)
.
This middleware will wrap all of the defined routes that you'd like to trace.
In automatic mode, the openSegment
middleware must be the last middleware added
before defining routes, otherwise issues with the cls-hooked
context may occur.
var AWSXRay = require('aws-xray-sdk-core');
var xrayKoa = require('aws-xray-sdk-koa2');
var app = new Koa();
//...
app.use(xrayKoa.openSegment('defaultName'));
router.get('/myRoute', (ctx) => {
const segment = AWSXRay.getSegment();
//Do whatever
});
var AWSXRay = require('aws-xray-sdk-core');
var xrayKoa = require('aws-xray-sdk-koa2');
var app = new Koa();
//...
var AWSXRay = require('aws-xray-sdk');
app.use(xrayKoa.openSegment('defaultName')); //Required at the start of your routes
router.get('/myRoute', (ctx) => {
const segment = ctx.segment;
//Do whatever
});
FAQs
AWS X-Ray Middleware for koa (Javascript)
The npm package aws-xray-sdk-koa2 receives a total of 3,729 weekly downloads. As such, aws-xray-sdk-koa2 popularity was classified as popular.
We found that aws-xray-sdk-koa2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.