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.
http-close-channel
Advanced tools
Express middleware for managing and closing HTTP channels. This middleware sends HTTP Connection Close
headers to prompt the client to close the socket connection. This is useful for the following cases:
The middleware takes the following options:
option | type | description | default | from version |
---|---|---|---|---|
gracefulShutdown | Boolean | Enable closing sockets after the app receives a SIGTERM signal | false | 1.0.0 |
maxRequests | Integer | Set the number of requests per socket connection before the middleware will close the socket | 100 | 1.0.0 |
logger | Object | A logger object (see example below) | null no logging | 1.0.0 |
The middleware can be added to an express app with the following steps...
npm install http-close-channel --save
// include the middleware
const httpCloseChannel = require('http-close-channel');
// create the app object
const app = express();
// add the middleware to the apps stack...
app.use(httpCloseChannel({
maxRequests: 50,
gracefulShutdown: true,
}));
The middleware will make standard logging calls (e.g., logger.info(...)
, logger.warn(...)
). This option has been tested with a bunyan logger. For example:
const bunyan = require('bunyan');
// create the app object
const app = express();
// create a bunyan based app logger
const loggerConfig = {
name: 'k8s-test-utils',
streams: [
{
level: 'debug',
type: 'stream',
stream: process.stdout,
},
],
};
const appLogger = bunyan.createLogger(loggerConfig);
// pass the logger to the middleware
app.use(httpCloseChannel({
logger: appLogger,
}));
FAQs
Express middleware for managing and closing HTTP channels
We found that http-close-channel 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.