
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Born out of frustration at certain libraries returning "errors" that were actually strings (sometimes plain and sometimes as JSON blobs) or vanilla objects, this library takes just about anything passed to it and turns it into something that is instanceof Error.
Because hey, better late than never.
example.js:
var pinocchio = require('./');
var str, json, halfJson, obj;
//
// It works on strings!
//
str = 'That\'s not an error!';
console.log(pinocchio(str));
//
// It's smart about JSON strings...
//
json = JSON.stringify({
code: 200,
message: 'a JSON string with a message'
});
console.log(pinocchio(json));
//
// ...and handles some embedded JSON strings too
//
halfJson = 'I\'M HELPING!! ' + JSON.stringify({ payload: 'ponyyyyyy' });
console.log(pinocchio(halfJson));
//
// Of course, it can also handle vanilla objects
//
obj = { code: 404, message: 'not_found'};
//
// We can also get a little passive-aggressive here (or clarify what the code
// is doing, either way)
//
console.log(pinocchio.isARealError(obj));
log.log:
josh@onix:~/dev/pinocchio$ node example.js
{ [Error: That's not an error!] fails: [ 'is a string' ] }
{ [Error: a JSON string with a message]
code: 200,
fails: [ 'is a string', 'is a JSON-encoded string' ] }
{ [Error: I'M HELPING!! {"payload":"ponyyyyyy"}]
payload: 'ponyyyyyy',
fails: [ 'is a string', 'is a string with a JSON fragment inside it' ] }
{ [Error: not_found] code: 404, fails: [ 'is a non-error object' ] }
MIT
FAQs
my error handling library
We found that pinocchio 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.