Skip to content

Commit dfa08a7

Browse files
author
0xricksanchez
committed
init
1 parent 3abfcbe commit dfa08a7

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

examples/node-jsonwebtoken/fuzz.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// The code in this file is based on the examples available in JSFuzz:
2+
// https://gitlab.com/gitlab-org/security-products/analyzers/fuzzers/jsfuzz/-/blob/34a694a8c73bfe0895c4e24784ba5b6dfe964b94/examples/xml/fuzz.js
3+
// The original code is available under the Apache License 2.0.
4+
5+
// eslint-disable-next-line @typescript-eslint/no-var-requires
6+
const jwt = require("jsonwebtoken");
7+
8+
/**
9+
* @param { Buffer } data
10+
*/
11+
module.exports.fuzz = async function (data) {
12+
try {
13+
} catch (error) {
14+
if (!ignoredError(error)) throw error;
15+
}
16+
};
17+
18+
function ignoredError(error) {
19+
return !!ignored.find((message) => error.message.startsWith(message));
20+
}
21+
22+
const ignored = ["Unencoded"];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "jwt-fuzz",
3+
"version": "1.0.0",
4+
"main": "fuzz.js",
5+
"license": "ISC",
6+
"dependencies": {
7+
"jsonwebtoken": "8.5.1"
8+
},
9+
"scripts": {
10+
"fuzz": "jazzer fuzz -i node-jsonwebtoken -e nothing",
11+
"dryRun": "jazzer fuzz -i node-jsonwebtoken -e nothing -- -runs=100 -seed=123456789"
12+
},
13+
"devDependencies": {
14+
"@jazzer.js/core": "file:../../packages/core"
15+
}
16+
}

0 commit comments

Comments
 (0)