
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Wraps visionmedia/debug to execute a function on demand based on the DEBUG env variable
npm install --save-dev debug-fn
A logger is created in the same way as debug, the difference is that the logger receives a function instead of multiple arguments, the function will be called based on debug rules (which checks the value of the DEBUG env variable)
// file example.js
import debugFn from 'debug-fn'
const logger = debugFn('app')
logger(function (log) {
log('hello')
})
Running example.js
with the DEBUG env set to app
$ DEBUG=app node example.js
app hello! +0ms
Running example.js
without the DEBUG env doesn't log anything
$ node example.js
NOTE: you could also use this.log
inside logger's function argument (which is
the same as the log
argument)
// file example.js
import debugFn from 'debug-fn'
const logger = debugFn('app')
logger(function () {
this.log('hello')
})
If you want to overwrite debug's custom logger, the logger instance is stored in
logger.logger
e.g.
// logger.logger is the result of calling `debug('app')`
logger.logger.log = function () {
// custom logic to handle the output
}
Imagine you have a cpu expensive operation that you only want to be executed when DEBUG is set, debug can't do that out of the box, this wrapper allows you to do that by wrapping your cpu expensive operation in a function
MIT © Mauricio Poppe
FAQs
Wraps visionmedia/debug to execute a function on demand
We found that debug-fn 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.