
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.
It is tool to perform fuzz testing. Sometimes it's hard to understand if your function would crash if you pass null or undefined or any unusual value into it. To check that you're doing right you can use this package for stress testing your functions and APIs under different payloads.
First of all you need to install package like:
npm i fuzzing -SD
To start fuzzing follow few steps:
errors or warnings produced after function execution - output typesimport {fuzz} from 'fuzzing';
/**
* Let's assume that you want to test your perfectly written sum function to find some bugs or unexpected behaviours
*/
function sum(arr) {
return arr.reduce((accumulator, item) => accumulator + item, 0);
}
const errors = fuzz(sum) // pick function you want to fuzz
.numberArray() // select preset of input values
.errors(); // choose output type
// print result to see what's going on
console.log(errors);
// it would give you array of executed tests
// showing your input values, test results and stack trace in case of any error
/*
Array [
Object {
"description": "SUCCESS: Function returned result is OK and no errors happened",
"input": Array [
2.718281828459045,
3.141592653589793,
0.6931471805599453,
2.302585092994046,
1.4426950408889634,
0.4342944819032518,
0.7071067811865476,
1.4142135623730951,
],
"result": 12.853916621954687,
"type": "success",
},
Object {
"description": "WARNING: Function returned result might be nullable or dangerous in some way",
"input": Array [
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
13,
],
"result": NaN,
"type": "warning",
},
Object {
"description": "WARNING: Function returned result might be nullable or dangerous in some way",
"input": Array [
0,
1,
-1,
5e-324,
1.7976931348623157e+308,
NaN,
-Infinity,
Infinity,
],
"result": NaN,
"type": "warning",
},
Object {
"description": "FAILED: Function execution failed, check error stack trace",
"error": [TypeError: Cannot read property 'length' of undefined],
"input": undefined,
"type": "error",
},
Object {
"description": "FAILED: Function execution failed, check error stack trace",
"error": [TypeError: Cannot read property 'length' of null],
"input": null,
"type": "error",
},
]
*/
To start fuzzing functions which expects multiple arguments you should import preset const which contains all the presets.
import {fuzz, preset} from 'fuzzing';
function multiply(a, b) {
return a * b;
}
const warnings = fuzz(multiply)
.under(preset.number(), preset.number()) // select presets for each function argument
.errors();
console.log(warnings);
The same way you can use fuzzing to call API endpoint with different payloads to test the behavior of your web server.
import {fuzz} from 'fuzzing';
/**
* For example you want to ping github
*/
function pingGithub(url) {
return fetch('https://github.io/' + url, { mode: 'no-cors' });
}
const errors = await fuzz(pingGithub)
.string()
.errors();
console.log(errors);
// OR
fuzz(pingGithub)
.string()
.errors()
.then(console.log);
Available sets of parameters:
boolean - Booleannumber - Numberstring - Stringobject - ObjectbooleanArray - Array of a booleansnumberArray - Array of a numbersstringArray - Array of stringsobjectArray - Array of objectsall - All the data setsAvailable types of output are available as array of result items:
successes - for passed testswarnings - for tests resulted with tricky or danger returned valueerrors - for failed testsall - for all testsFeel free to give a valuable feedback ā¤ļø Igor Golopolosov
FAQs
Tool set for fuzz testing š°
We found that fuzzing 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.