
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
@purinton/signals
Advanced tools
Graceful shutdown signal handler utility for Node.js (ESM and CommonJS)

Graceful shutdown signal handler utility for Node.js (ESM and CommonJS)
SIGTERM, SIGINT, SIGHUP)npm install @purinton/signals
import log from '@purinton/log';
import registerSignals from '@purinton/signals'; // Default export
// or: import { registerSignals } from '@purinton/signals';
const { shutdown, getShuttingDown } = registerSignals({ log });
const log = require('@purinton/log');
const registerSignals = require('@purinton/signals'); // Default export
// or: const { registerSignals } = require('@purinton/signals');
const { shutdown, getShuttingDown } = registerSignals({ log });
You can call registerSignals multiple times to add async shutdown hooks. All hooks will be run (in order of registration) when a signal is received or the process exits (via exit or beforeExit).
// Simulate a resource that needs cleanup (e.g., database connection)
const fakeDb = {
close: async () => {
return new Promise(resolve => setTimeout(() => {
log.info('Fake DB connection closed');
resolve();
}, 100));
}
};
// Register signal handlers
registerSignals({ log });
// Add shutdown hook for closing the fake DB connection
registerSignals({
log,
shutdownHook: async (signal) => {
await fakeDb.close();
log.info(`Cleanup complete on ${signal}`);
}
});
Note: Both the default export and named export
registerSignalsare available in both ESM and CommonJS.
Registers shutdown handlers for the specified signals and allows registering async shutdown hooks.
processObj (default: process): The process object to attach handlers to.log (default: @purinton/log): Logger for output. Should have debug, info, warn, and error methods.signals (default: [ 'SIGTERM', 'SIGINT', 'SIGHUP' ]): Array of signals to listen for.shutdownHook (optional): An async function to run during shutdown. You can call registerSignals multiple times to add multiple hooks.An object with:
shutdown(signal: string): Promise<void> — Manually trigger shutdown logic.getShuttingDown(): boolean — Returns whether shutdown is in progress.Shutdown hooks will run on signal,
process.exit, orbeforeExit.
Type definitions are included:
import registerSignals, { RegisterSignalsOptions } from '@purinton/signals';
// Optionally provide options
const options: RegisterSignalsOptions = {
processObj: process, // optional, defaults to process
log: myLogger, // optional, defaults to @purinton/log
signals: ['SIGTERM', 'SIGINT', 'SIGHUP'], // optional, defaults as shown
shutdownHook: async (signal) => { /* ... */ } // optional
};
const { shutdown, getShuttingDown } = registerSignals(options);
// Types:
// interface RegisterSignalsOptions {
// processObj?: NodeJS.Process;
// log?: typeof log;
// signals?: string[];
// shutdownHook?: (signal: string) => Promise<void>;
// }
//
// function registerSignals(options?: RegisterSignalsOptions): {
// shutdown: (signal: string) => Promise<void>;
// getShuttingDown: () => boolean;
// };
For help, questions, or to chat with the author and community, visit:
FAQs
Graceful shutdown signal handler utility for Node.js (ESM and CommonJS)
We found that @purinton/signals demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.