
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
console-hijack
Advanced tools
Intercepting and modifying common console printing methods in the browser. Why? To receive callback events when methods like console.log or console.error are called, and to mute native console methods (like log) in production.
NOTE: This module is still under development! Use in production at your own risk!
npm install console-hijack
...Then Include dist/console-hijack.js in your project. See examples for more info.
Including this script on your page automatically hijacks the following console methods: [LOG, INFO, WARN, ERROR, TRACE];
To receive a callback for a given method, simply listen to it:
document.addEventListener('console.log', callback);
console.log('hi mom'); // will trigger callback, and log to console!
The callback function is invoked with a payload that has the following signature:
{
type: [String], // the method called, like 'console.log'
messages: [Array] // an array of all arguments passed - `console.log('hi', 'mom')` becomes `['hi', 'mom']`
}
Set the log level to mute everything below that level. For example, setting the log level to WARN will mute LOG and INFO. The default level is LOG
console.hijack.level = console.hijack.WARN
The console object can be restored by calling console.hijack.stop(). No more events will be fired and the previously intercepted methods will be returned to their original state. Resume hijacking by calling console.hijack.start()
FAQs
Modify native console object to emit events and set verbosity
We found that console-hijack 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.