File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
examples/node-jsonwebtoken Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
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" ] ;
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments