Skip to content

Commit 338501d

Browse files
committed
docs: fix stale flags, broken snippets, dead links, and outdated descriptions
- fuzz-targets.md: --fuzzFunction -> --fuzzEntryPoint, corpus is positional not a --corpus flag, normalize coverage reporter order - fuzz-settings.md: JAZZER_COVERAGE env -> JAZZER_COVERAGE_REPORTERS, remove incorrect -runs=-1 equivalence claim, fix malformed xmlDictionary and timeout snippets - jest-integration.md: close unclosed code blocks, update stale version pin from 2.1.0 to ^3.0.0 - bug-detectors.md: normalize --disable_bug_detectors to --disableBugDetectors, fix missing spaces before 'in CLI mode' - examples/jest_typescript_integration: runner -> testRunner, fix stale import path, fix trailing commas in JSON, fix title typo - architecture.md: mention ESM loader hook alongside CJS hookRequire - Package READMEs: update jazzer.js-commercial links to jazzer.js, document async fuzzing mode in fuzzer README, add ESM loader path to instrumentor README, fix typos
1 parent a926c97 commit 338501d

13 files changed

Lines changed: 93 additions & 86 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ES modules are supported on Node.js >= 20.6 — use `export function fuzz` in a
119119

120120
## Documentation
121121

122-
Further documentation is available at [docs/readme.md](docs/README.md).
122+
Further documentation is available at [docs/README.md](docs/README.md).
123123

124124
### Demo Video - Introduction to Jazzer.js
125125

docs/architecture.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ The _fuzzing library_ is the main entry point and is used to start fuzzing. It
2525
is invoked with the name of a _fuzz target_ module and possible fuzzer options.
2626
As a first step it loads a
2727
[native plugin](https://nodejs.org/api/addons.html#wrapping-c-objects) Node.js
28-
addon, _fuzzer plugin_, to interact with libFuzzer and registers a `require`
29-
hook, _interceptor_, to instrument subsequently loaded code.
30-
31-
The _interceptor_ transforms code using [Babel](https://babeljs.io/) to provide
32-
feedback to the fuzzer in multiple ways. It extends the loaded code to gather
33-
coverage statistics so that the fuzzer can detect when new code paths are
34-
reached. And it also intercepts comparison functions, like `==` or `!=`, to
35-
detect the parts of the provided input that should be mutated and in what way.
28+
addon, _fuzzer plugin_, to interact with libFuzzer and registers instrumentation
29+
hooks to transform subsequently loaded code.
30+
31+
For CJS modules, a `require` hook (via `istanbul-lib-hook`) intercepts loading.
32+
For ES modules (Node >= 20.6), a loader hook registered via `module.register()`
33+
intercepts `import` statements in a dedicated loader thread.
34+
35+
Both paths use [Babel](https://babeljs.io/) to transform source code, inserting
36+
coverage counters so the fuzzer can detect new code paths, and comparison hooks
37+
(for `==`, `!=`, etc.) so the fuzzer can mutate input toward specific values.
3638
Available feedback methods are defined in libFuzzer's
3739
[hook interface definitions](https://github.com/llvm/llvm-project/blob/main/compiler-rt/include/sanitizer/common_interface_defs.h).
3840

@@ -70,14 +72,14 @@ information to detect progress and comparison hints to improve mutations. These
7072
feedback mechanisms have to be added to the application code without user
7173
intervention.
7274

73-
**Decision**: Use the `istanbul-lib-hook` library to hook into dynamic code
74-
loading and `babel` plugins to extend the loaded code with the required feedback
75-
functionality. Instrumenting the code at such a high level leads to an
76-
independence of the underlying JavaScript engine. Furthermore, it is easily
77-
possible to decide if a loaded module should be instrumented or not.
75+
**Decision**: Use `istanbul-lib-hook` to hook into CJS loading and
76+
`module.register()` to hook into ESM loading, with Babel plugins to insert
77+
feedback instrumentation. Instrumenting at the source level decouples from the
78+
underlying JavaScript engine and allows fine-grained control over which modules
79+
are instrumented.
7880

7981
**Consequences**: Independence of JavaScript engine, fine-grained
80-
instrumentation control
82+
instrumentation control, ESM support on Node >= 20.6.
8183

8284
## Visualization
8385

docs/bug-detectors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ prototype, it will be able also find a way to modify other properties of the
9191
prototype that are not functions. If you find a use case where this assumption
9292
does not hold, feel free to open an issue.
9393
94-
_Disable with:_ `--disableBugDetectors=prototype-pollution`in CLI mode; or when
94+
_Disable with:_ `--disableBugDetectors=prototype-pollution` in CLI mode; or when
9595
using Jest in `.jazzerjsrc.json`:
9696
9797
```json
@@ -104,7 +104,7 @@ Hooks the `eval` and `Function` functions and reports a finding if the fuzzer
104104
was able to pass a special string to `eval` and to the function body of
105105
`Function`.
106106
107-
_Disable with:_ `--disable_bug_detectors=remote-code-execution`in CLI mode; or
107+
_Disable with:_ `--disableBugDetectors=remote-code-execution` in CLI mode; or
108108
when using Jest in `.jazzerjsrc.json`:
109109
110110
```json
@@ -127,8 +127,8 @@ getBugDetectorConfiguration("ssrf")
127127
.addPermittedUDPConnection("localhost", 9090);
128128
```
129129
130-
_Disable with:_ `--disable_bug_detectors=ssrf` in CLI mode; or when using Jest
131-
in `.jazzerjsrc.json`:
130+
_Disable with:_ `--disableBugDetectors=ssrf` in CLI mode; or when using Jest in
131+
`.jazzerjsrc.json`:
132132
133133
```json
134134
{ "disableBugDetectors": ["ssrf"] }

docs/fuzz-settings.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ configured for Jest.
297297
add the following environment variable to the command:
298298

299299
```bash
300-
JAZZER_COVERAGE='["json","lcov"]' npx jazzer my-fuzz-file --coverage
300+
JAZZER_COVERAGE_REPORTERS='["json","lcov"]' npx jazzer my-fuzz-file --coverage
301301
```
302302

303303
_Note:_ Setting this environmental variable in Jest mode has no effect.
@@ -366,11 +366,11 @@ provide them as an array of strings, `Uint8Arrays`, or `Int8Arrays` to the
366366
`dictionaryEntries` option of the `it.fuzz` function:
367367

368368
```javascript
369-
const xmlDictionary = ["IDREF","<![IGNORE[","<![INCLUDE[",<!"];
369+
const xmlDictionary = ["IDREF", "<![IGNORE[", "<![INCLUDE[", "<!"];
370370

371371
it.fuzz("XML parser",
372372
(data) => {...},
373-
{dictionaryEntries: xmlDictionary}
373+
{dictionaryEntries: xmlDictionary});
374374
```
375375

376376
### `disableBugDetectors` : [array\<RegExp\>]
@@ -814,8 +814,7 @@ In _regression_ mode on command line, Jazzer.js runs each input from the seed
814814
and regression corpus directories on the fuzz target once, and then stops. Under
815815
the hood, this option adds `-runs=0` to the option
816816
[`fuzzerOptions`](#fuzzeroptions--arraystring). Setting the fuzzer option to
817-
`-runs=0` (run each input only once) or `-runs=-1` (run each input indefinitely)
818-
can be used to achieve the same behavior.
817+
`-runs=0` (run each input only once) can be used to achieve the same behavior.
819818

820819
**Jest:** Default: `"regression"`.
821820

@@ -954,7 +953,7 @@ example how a timeout of 1 second can be set for the test "My test 1":
954953
```javascript
955954
it.fuzz("My test 1",
956955
(data) => {...},
957-
1000
956+
1000);
958957
```
959958

960959
_Two:_ by providing it as part of an object with options as the third argument

docs/fuzz-targets.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Here we list some of the most important parameters:
234234
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
235235
| `<fuzzTarget>` | Import path to the fuzz target module. |
236236
| `[corpus...]` | Paths to the corpus directories. If not given, no initial seeds are used nor interesting inputs saved. |
237-
| `-f`, `--fuzzFunction` | Name of the fuzz test entry point. It must be an exported function with a single [Buffer](https://nodejs.org/api/buffer.html) parameter. Default is `fuzz`. |
237+
| `-f`, `--fuzzEntryPoint` | Name of the fuzz test entry point. It must be an exported function with a single [Buffer](https://nodejs.org/api/buffer.html) parameter. Default is `fuzz`. |
238238
| `-i`, `--includes` / `-e`, `--excludes` | Part of filepath names to include/exclude in the instrumentation. A tailing `/` should be used to include directories and prevent confusion with filenames. `*` can be used to include all files. Can be specified multiple times. Default will include everything outside the `node_modules` directory. If either of these flags are set the default value for the other is ignored. |
239239
| `--sync` | Enables synchronous fuzzing. **May only be used for entirely synchronous code**. |
240240
| `-h`, `--customHooks` | Filenames with custom hooks. Several hooks per file are possible. See further details in [docs/fuzz-settings.md](fuzz-settings.md#customhooks--arraystring). |
@@ -249,14 +249,14 @@ In the following example, the `--coverage` flag is combined with the mode flag
249249
any fuzzing.
250250

251251
```shell
252-
npx jazzer --mode=regression <fuzzer parameters> --corpus <corpus directories> --coverage -- <libFuzzer parameters>
252+
npx jazzer <fuzzTarget> --mode=regression --coverage <corpus directories> -- <libFuzzer parameters>
253253
```
254254

255255
Alternatively, you can add a new script to your `package.json`:
256256

257257
```json
258258
"scripts": {
259-
"coverage": "jazzer --mode=regression --includes=fileToInstrument --includes=anotherFileToInstrument <fuzzer parameters> --corpus <corpus directories> --coverage -- <libFuzzer parameters>"
259+
"coverage": "jazzer <fuzzTarget> --mode=regression -i fileToInstrument -i anotherFileToInstrument --coverage <corpus directories>"
260260
}
261261
```
262262

@@ -274,6 +274,6 @@ This default directory can be changed by setting the flag
274274
### Coverage reporters
275275

276276
The desired report format can be set by the flag `--coverageReporters`, which by
277-
default is set to `--coverageReporters clover json lcov text`. See
277+
default is set to `--coverageReporters json text lcov clover`. See
278278
[here](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-reports/lib)
279279
for a list of supported coverage reporters.

docs/jest-integration.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ runner.
5353
"coverage": "jest --coverage"
5454
},
5555
"devDependencies": {
56-
"@jazzer.js/jest-runner": "2.1.0",
57-
"jest": "29.3.1"
56+
"@jazzer.js/jest-runner": "^3.0.0",
57+
"jest": "^29.0.0"
5858
},
5959
"jest": {
6060
"projects": [
@@ -188,13 +188,15 @@ const target = require("./target");
188188
const { FuzzedDataProvider } = require("@jazzer.js/core");
189189

190190
describe("My describe", () => {
191-
it.fuzz("My fuzz test", (data) => {
192-
const provider = new FuzzedDataProvider(data);
193-
target.fuzzMeMore(
194-
provider.consumeNumber(),
195-
provider.consumeBoolean(),
196-
provider.consumeRemainingAsString());
197-
});
191+
it.fuzz("My fuzz test", (data) => {
192+
const provider = new FuzzedDataProvider(data);
193+
target.fuzzMeMore(
194+
provider.consumeNumber(),
195+
provider.consumeBoolean(),
196+
provider.consumeRemainingAsString(),
197+
);
198+
});
199+
});
198200
```
199201

200202
For more information on how to use the `FuzzedDataProvider` class, please refer
@@ -211,14 +213,14 @@ possible to use `async/await`, `Promise` and `done callback` based tests.
211213

212214
```javascript
213215
describe("My describe", () => {
214-
it.fuzz("My callback fuzz test", (data, done) => {
215-
target.callbackFuzzMe(data, done);
216-
});
217-
218-
it.fuzz("My async fuzz test", async (data) => {
219-
await target.asyncFuzzMe(data);
220-
});
221-
)};
216+
it.fuzz("My callback fuzz test", (data, done) => {
217+
target.callbackFuzzMe(data, done);
218+
});
219+
220+
it.fuzz("My async fuzz test", async (data) => {
221+
await target.asyncFuzzMe(data);
222+
});
223+
});
222224
```
223225

224226
### TypeScript Jest fuzz tests
@@ -372,7 +374,7 @@ Additional options for coverage report generation are described in the
372374
[fuzz targets documentation](./fuzz-targets.md#coverage-report-generation).
373375
374376
The desired report format can be set by the flag `--coverageReporters`, which by
375-
default is set to `--coverageReporters clover json lcov text`. See
377+
default is set to `--coverageReporters json text lcov clover`. See
376378
[here](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-reports/lib)
377379
for a list of supported coverage reporters.
378380

docs/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To release a new version of Jazzer.js follow the described process:
2121
- An automatic changelog, based on the included merge requests, is added to
2222
the prerelease description
2323
- The prerelease is listed on the
24-
[release page](https://github.com/CodeIntelligenceTesting/jazzer.js-commercial/releases)
24+
[release page](https://github.com/CodeIntelligenceTesting/jazzer.js/releases)
2525
8. Release the prerelease in GitHub
2626
- Adjust the prerelease description to include the highlights of the release
2727
- If you find some problems with the prerelease and want to start over:

examples/jest_typescript_integration/README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Jest Typscript Integration Example
1+
# Jest TypeScript Integration Example
22

33
Detailed documentation on the Jest integration is available in the main
44
[Jazzer.js](https://github.com/CodeIntelligenceTesting/jazzer.js/blob/main/docs/jest-integration.md)
@@ -14,26 +14,28 @@ The example below shows how to configure the Jazzer.js Jest integration in
1414
combination with the normal Jest runner.
1515

1616
```json
17-
"jest": {
18-
"projects": [
19-
{
20-
"displayName": "Jest",
21-
"preset": "ts-jest",
22-
},
23-
{
24-
"displayName": {
25-
"name": "Jazzer.js",
26-
"color": "cyan",
27-
},
28-
"preset": "ts-jest",
29-
"runner": "@jazzer.js/jest-runner",
30-
"testEnvironment": "node",
31-
"testMatch": ["<rootDir>/*.fuzz.[jt]s"],
32-
},
33-
],
34-
"coveragePathIgnorePatterns": ["/node_modules/", "/dist/"],
35-
"modulePathIgnorePatterns": ["/node_modules", "/dist/"],
36-
}
17+
{
18+
"jest": {
19+
"projects": [
20+
{
21+
"displayName": "Jest",
22+
"preset": "ts-jest"
23+
},
24+
{
25+
"displayName": {
26+
"name": "Jazzer.js",
27+
"color": "cyan"
28+
},
29+
"preset": "ts-jest",
30+
"testRunner": "@jazzer.js/jest-runner",
31+
"testEnvironment": "node",
32+
"testMatch": ["<rootDir>/*.fuzz.[jt]s"]
33+
}
34+
],
35+
"coveragePathIgnorePatterns": ["/node_modules/", "/dist/"],
36+
"modulePathIgnorePatterns": ["/node_modules", "/dist/"]
37+
}
38+
}
3739
```
3840

3941
Further configuration can be specified in `.jazzerjsrc`, like in any other
@@ -51,7 +53,7 @@ Write a Jest fuzz test like:
5153

5254
```typescript
5355
// file: jazzerjs.fuzz.ts
54-
import "@jazzer.js/jest-runner/jest-extension";
56+
import "@jazzer.js/jest-runner";
5557
describe("My describe", () => {
5658
it.fuzz("My fuzz test", (data: Buffer) => {
5759
target.fuzzMe(data);

packages/bug-detectors/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# @jazzer.js/bug-detectors
22

33
The `@jazzer.js/bug-detectors` module is used by
4-
[Jazzer.js](https://github.com/CodeIntelligenceTesting/jazzer.js-commercial#readme)
5-
to detect and report bugs in JavaScript code.
4+
[Jazzer.js](https://github.com/CodeIntelligenceTesting/jazzer.js#readme) to
5+
detect and report bugs in JavaScript code.
66

77
## Install
88

@@ -15,5 +15,5 @@ npm install --save-dev @jazzer.js/bug-detectors
1515
## Documentation
1616

1717
- Up-to-date
18-
[information](https://github.com/CodeIntelligenceTesting/jazzer.js-commercial/blob/main/docs/fuzz-settings.md#bug-detectors)
18+
[information](https://github.com/CodeIntelligenceTesting/jazzer.js/blob/main/docs/bug-detectors.md)
1919
about currently available bug detectors

packages/core/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This is the main entry point and all most users have to install as a
44
dev-dependency, so that they can fuzz their projects.
55

6-
The `@jazzer.js/core` module provide a CLI interface via the `jazzer` command.
6+
The `@jazzer.js/core` module provides a CLI interface via the `jazzer` command.
77
It can be used by `npx` or node script command. To display a command
88
documentation use the `--help` flag.
99

@@ -25,5 +25,5 @@ npm install --save-dev @jazzer.js/core
2525
## Documentation
2626

2727
See
28-
[Jazzer.js README](https://github.com/CodeIntelligenceTesting/jazzer.js-commercial#readme)
28+
[Jazzer.js README](https://github.com/CodeIntelligenceTesting/jazzer.js#readme)
2929
for more information.

0 commit comments

Comments
 (0)