
Corrected 16 November 2026: on re-checking, finding 17 was shown wrong and moved to excluded. Before: 0 High, 11 Medium, 17 Low, 7 Info, 0 excluded on review. Now: 0 High, 10 Medium, 17 Low, 7 Info, 1 excluded on review. Only these moves change the figures above; the re-check of the other findings is in the section below.
| Audited | Node.js API reference v24.22.1, modules to zlib (36 pages), pages fetched 21 October 2026 |
|---|---|
| Date | 22 October 2026 |
| How it ran | local run on our workstation, full audit, Standard review |
| Verdict after review | Pass with notes (Fail if a High finding remains after review, otherwise Pass with notes) |
Related: Node.js API documentation, part 1 of 2 (October 2026) · cloudflare/security-audit-skill (October 2026)
Re-checked 16 November 2026
Every finding of this audit was checked again against today's documentation. Status: Still present = the error is in the current v24 documentation and on main; Fixed on main only = corrected on main, still in the v24 documentation; Already in an open Node.js pull request = still present, and an open pull request makes the fix; Wrong at audit (excluded) = the finding was wrong when we made it and is now listed as excluded; Could not check = the page could not be compared.
Examples were run on Node v24.15.0; documentation compared on v24.22.3 and main.
| # | Finding | Status today | Rating at audit → now |
|---|---|---|---|
| 1 | HTTP server sample echoes a parse error without setting a content type | Still present | Low → Low |
| 2 | URL-building sample trusts forwarded-host headers | Still present | Info → Info |
| 3 | Legacy URL escaping example names the wrong encoding for the slash | Still present | Low → Low |
| 4 | Handle-scope loop sample leaves the scope open on its error exit | Still present | Low → Low |
| 5 | HTTP server sample buffers the whole request body with no size limit | Still present | Info → Info |
| 6 | Streamed decompression sample has no output cap | Still present | Info → Info |
| 7 | Header-parsing sample grows its buffer without a limit | Still present | Info → Info |
| 8 | Example writes helper files into the script directory without checking for existing files | Still present | Info → Info |
| 9 | NAPI_MODULE_INIT example does not compile | Still present | Medium → Medium |
| 10 | napi_define_properties walkthrough does not compile | Still present | Medium → Medium |
| 11 | REPL examples open an unauthenticated code-execution socket on every interface | Still present | Low → Low |
| 12 | REPL client example throws on every normal exit | Still present | Medium → Medium |
| 13 | Single-executable tutorial builds one file name and then signs and runs another | Fixed on main only | Medium → Medium |
| 14 | Readable.filter, map, forEach and toArray examples destructure an array result as an object | Still present | Medium → Medium |
| 15 | Whole-file read example joins Buffer chunks as strings | Still present | Medium → Medium |
| 16 | stream/iter duplex() echo example reads the wrong end of the pair | Fixed on main only | Medium → Medium |
| 17 | Dependency-timing examples print 'undefined' as the module name | Wrong at audit (excluded) | Medium → excluded |
| 18 | Microtask-queue fix snippet uses names the example does not define | Still present | Low → Low |
| 19 | TLS setup commands produce PKCS#12 files that the samples read as PEM, and the two samples overwrite each other's files | Still present | Medium → Medium |
| 20 | Custom test reporter never completes the transform for event types it does not list | Still present | Medium → Medium |
| 21 | KmacParams documents its algorithm member as 'algorithm' while every sibling class uses 'name' | Still present | Medium → Medium |
| 22 | TLS client example turns hostname verification off | Still present | Low → Low |
| 23 | TLS session-resumption sample stores sessions in an object that is never pruned | Still present | Low → Low |
| 24 | BlockList.PRIVATE_RANGES is described as covering all non-routable ranges | Still present | Low → Low |
| 25 | Native API signature uses a finalizer type that the page never defines | Still present | Low → Info |
| 26 | Windows build step installs a deprecated package | Still present | Low → Low |
| 27 | Key-derivation sample defaults to 1000 PBKDF2 iterations | Still present | Low → Low |
| 28 | addAbortSignal examples use names that are never imported | Still present | Low → Low |
| 29 | Mocked-timer interval example asserts values the iterator does not yield | Still present | Low → Medium |
| 30 | quic.listen() example omits the sni option the page calls required | Could not check | Low → not re-rated |
| 31 | Malformed typedef in the error-info structure listing | Still present | Low → Info |
| 32 | package.json samples start with a // comment line | Still present | Info → Info |
| 33 | Parameter description gives the wrong unit for a UTF-8 string length | Still present | Low → Low |
| 34 | Stream consumer example prints 76 bytes for a 27-byte payload | Still present | Info → Low |
| 35 | Embedded-addon sample writes to a predictable shared path and loads it | Still present | Low → Low |
The full record of this re-check: github.com/ondrejdvorak78/nodejs-v24-api-docs-errors.
Each finding keeps the number it has in the audit report. The rating shown first is the one after review; the first automated rating is listed with it. 13 findings were first rated Medium or High; 10 of them are Medium or High after review. Text marked "From the report" is quoted from the audit report; fixes are suggestions and were not tested. Locations are paths inside the fetched copy of the documentation.
Medium after review (10)
n-api.md:2142From the report
napi_status result;
status = napi_create_int64(env, 42, &answer);
The variable is declared as result but used as status. An addon author who copies the example from the module-registration section gets a compile error every time.
Declare napi_status status;.
n-api.md:4548From the report
napi_status status = napi_status_generic_failure;
...
{ "bar", NULL, NULL, NULL, NULL, barValue, napi_writable | napi_configurable, NULL }
}
The enumerator is napi_generic_failure, so the first line fails, and the descriptor array at line 4566 has no closing semicolon. Anyone copying the multi-property example gets compile errors. The attributes also omit napi_enumerable although the JavaScript equivalent shown sets enumerable: true.
Use napi_generic_failure, end the array with };, and add napi_enumerable to match the JavaScript counterpart.
repl.md:1057From the report
sock.on('close', () => {
process.stdin.setRawMode(false);
process.stdin.pause();
sock.removeListener('close', done);
done is not defined, so closing the socket (the .exit command, Ctrl+D, or server shutdown) raises a ReferenceError. The same code is at line 1089. Anyone who runs the documented client and ends a session sees the crash.
Remove the removeListener line, or name the handler and pass that reference.
single-executable-applications.md:137From the report
cp $(command -v node) hello ... codesign --sign - sea ... $ ./sea world
Steps 4 to 6 create and inject into hello or hello.exe. Steps 7 and 8 sign and run sea or sea.exe, which do not exist, so signing and running fail on a normal path. Step 6 also says the blob was created in step 1 (line 98), but step 3 creates it.
Use one name through steps 7 and 8 (hello, hello.exe) and correct the step reference.
stream.md:2276From the report
const { address } = await resolver.resolve4(domain, { ttl: true });
return address.ttl > 60;
With ttl: true, resolve4 resolves to an array of { address, ttl } records, so address is undefined and address.ttl throws a TypeError on the first element. The map, forEach and toArray examples (lines 2336 and 2383) repeat the destructuring and return undefined. Anyone running the examples gets a failing stream or empty output.
Read the array, for example const [{ ttl }] = await resolver.resolve4(domain, { ttl: true }); return ttl > 60;, and return the records in the other examples.
stream.md:1625From the report
chunks.push(chunk);
...
const content = chunks.join('');
Without setEncoding, the chunks are Buffers and join('') converts each one separately. A multi-byte UTF-8 character split across two chunks turns into replacement characters, so non-ASCII content longer than one chunk is silently corrupted. The page presents this as the way to read a whole file.
Use Buffer.concat(chunks).toString('utf8') or call readable.setEncoding('utf8') first.
stream_iter.md:879From the report
for await (const chunks of server.readable) { await server.writer.writev(chunks); }
...
console.log(await text(server.readable)); // handled by echo
The page says data written to one channel's writer appears in the other channel's readable. The echo loop already consumes server.readable, and its output goes to client.readable. The final line starts a second consumer on server.readable and never ends server.writer, so a developer who runs it gets an empty result, an error or a hang instead of the echoed text. The CommonJS copy has the same flaw.
Read the echo with text(client.readable) and call await server.writer.end() after the loop.
tls.md:2354From the report
openssl pkcs12 -certpbe AES-256-CBC -export -out client-cert.pem \
-inkey server-key.pem -in server-cert.pem
pkcs12 -export writes a binary PKCS#12 bundle, but the samples read the file with readFileSync and pass it as ca (PEM expected). The tls.connect() section repeats the pattern at line 1925. Both pages also write the same file names, so following one overwrites what the other needs. A developer who follows the commands cannot get the echo example to verify its peer.
Generate every certificate once as PEM, pass the peer's PEM certificate as ca, use pfx only where a PKCS#12 file is consumed, and use distinct file names per example.
test.md:1443From the report
transform(event, encoding, callback) {
switch (event.type) {
case 'test:dequeue':
callback(null, `test ${event.data.name} dequeued`);
The switch (lines 1443 to 1478, with the CommonJS copy below) has no default branch. The page documents further event types such as test:complete, test:log, test:summary and test:interrupted. For those, callback is never called, the Transform waits forever, and later events produce no output. A developer who copies the reporter loses test output after the first unlisted event.
Add a default: callback(); branch so every event completes.
webcrypto.md:2404From the report
#### `kmacParams.algorithm`
* Type: {string} Must be `'KMAC128'` or `'KMAC256'`.
kmacImportParams.name (line 2336) and kmacKeyGenParams.name (line 2386) use name, and sign() and verify() take an Algorithm dictionary whose identifying member is name. A developer who passes { algorithm: 'KMAC128', ... } as documented supplies no name, and the call is rejected.
Document the member as kmacParams.name.
Low after review (17)
stream.md:439From the report
res.statusCode = 400;
return res.end(`error: ${er.message}`);
The JSON.parse error message quotes part of the request body, and the response carries no Content-Type, so a browser may sniff it as HTML. Whoever copies the sample into a public endpoint reflects attacker-chosen text.
Set Content-Type: text/plain; charset=utf-8 and X-Content-Type-Options: nosniff before writing the message, or return a fixed message.
url.md:2037From the report
The ASCII
forward slash (`/`) character is encoded as `%3C`.
%3C is the encoding of <, and / is not in the escaped set listed just above, so the sentence is false. A reader who relies on it expects a slash to be rewritten when it is left alone.
Replace the example with a character that is in the listed set (for instance < becomes %3C) or delete the slash sentence.
n-api.md:1587From the report
status = napi_get_element(env, object, i, &result);
if (status != napi_ok) {
break;
}
The break skips napi_close_handle_scope, while the same page says every scope must be closed before the native method returns. A native addon author who copies the loop leaks the scope on the error path.
Close the scope before each break or move the close into a common exit path.
repl.md:927From the report
net.createServer((socket) => { ... repl.start({ prompt: 'Node.js via TCP socket> ', useGlobal: true, input: socket, output: socket }) ... }).listen(5001);
The same pattern appears at lines 971, 1011 (.listen(1337)) and 1033. listen is given no host, so the server accepts connections from any network, and each connection gets a REPL with the process's full privileges. The only security warning on the page belongs to the later curl example. A developer who copies an example into a long-running service (the page suggests exactly that) exposes remote code execution.
Bind the examples to 127.0.0.1 or to a Unix socket in a private directory, and put the same production warning next to each network REPL example.
vm.md:2330From the report
setImmediate(() => {
vm.runInContext('', context);
});
The example above it imports only createContext and runInContext and names the context inner_context. The corrective snippet uses vm and context, so a developer who pastes it gets an uncaught ReferenceError inside the callback and the described hang is not fixed.
Write runInContext('', inner_context) and show the snippet inside the complete example.
tls.md:1865From the report
// Necessary only if the server's cert isn't for "localhost".
checkServerIdentity: () => { return null; },
The same code is at line 1897. The example's certificate is for localhost, so the override is not needed, and the pinned ca limits the damage. A reader who copies the client and swaps in public CAs ends up with a client that accepts any valid certificate for any host.
Remove the override from the sample, or show it wrapping tls.checkServerIdentity and say it is for local demos only.
tls.md:745From the report
const tlsSessionStore = {};
server.on('newSession', (id, data, cb) => {
tlsSessionStore[id.toString('hex')] = data;
Entries are added for every new session and never removed, even after the documented session timeout. The surrounding text points to a shared cache for clusters but does not warn that this store is unbounded.
Could be higher if: the page presents the sample as production-ready: the store then grows with every full handshake and a remote client can drive memory use.
Show a store with expiry or a size bound, or label the object as illustrative only.
net.md:253From the report
populate a blocklist with all non-routable address ranges.
The page then lists the included ranges, so the exact set is visible, but the sentence overstates it for security use.
Could be higher if: readers build an outbound filter from it: ranges such as 0.0.0.0/8, 100.64.0.0/10 and the IPv6 unspecified address are not in the list that follows, so a filter built from it is not a complete denylist.
Reword to 'the RFC 1918, loopback and link-local ranges listed below' and note that it is not a complete denylist.
n-api.md:2586From the report
node_api_noenv_finalize finalize_cb,
The page documents napi_finalize and node_api_basic_finalize only; this name appears once.
Could be higher if: the real header has no such type: copying the signature would then fail to compile.
Define the type or use a documented one.
n-api.md:183From the report
npm install --global windows-build-tools
The recommended toolchain package is deprecated; readers may get stale tooling.
Could be higher if: the package no longer installs on current Windows and Node.js versions, which would make the step fail for every Windows reader.
Point to the Visual Studio Build Tools workload or the Node.js installer's optional tools.
webcrypto.md:399From the report
async function pbkdf2(pass, salt, iterations = 1000, length = 256) {
The same page's other sample uses 100_000 iterations. A reader who copies the helper and relies on its default derives keys that are cheap to guess offline.
Raise the default to current guidance or remove it so callers must choose, with a note on cost.
stream.md:3553From the report
const read = addAbortSignal(
controller.signal,
fs.createReadStream(('object.json')),
The three samples call addAbortSignal and finished without importing them, and the third uses ReadableStream without an import, so they raise a ReferenceError as written. The section heading makes the intent clear, so this is an omission.
Add the require or import lines to each sample.
test.md:3240From the report
for await (const time of nodeTimersPromises.setInterval(interval, startedAt)) { times.push(time); ...
assert.strictEqual(timeResults[it - 1], startedAt + (interval * it));
The iterator yields the value it was given, not an advancing time, and only setInterval is mocked. The test title also says 'five times' while three iterations run.
Could be higher if: the mocked setInterval yields the supplied start value on every iteration, as the timers page documents for the real one: the assertion at line 3240 then fails on its first comparison.
Assert the yielded values as they are, or mock Date as well, and fix the title.
quic.md:510From the report
const endpoint = await listen((session) => {
// ... handle the session
});
The page says (line 3348) that sni is required for server sessions. The snippet is minimal and the requirement is stated on the same page, so this is an omission.
Add an sni entry to the example or mark it as incomplete.
n-api.md:1075From the report
typedef struct napi_extended_error_info {
...
};
The typedef has no type name after the closing brace, so it declares nothing usable as napi_extended_error_info.
End the declaration with } napi_extended_error_info;.
n-api.md:3349From the report
* `[in] length`: The length of the string in two-byte code units, or
`NAPI_AUTO_LENGTH` if it is null-terminated.
The parameter belongs to the UTF-8 variant, where the length is in bytes.
Could be higher if: A caller who passes a UTF-16 code-unit count for non-ASCII text would get a truncated key; that would raise this to MEDIUM.
Say 'length of the string in bytes'.
single-executable-applications.md:503From the report
const addonPath = path.join(os.tmpdir(), 'myaddon.node');
fs.writeFileSync(addonPath, new Uint8Array(getRawAsset('myaddon.node')));
The file name in the shared temp directory is fixed and the file is then loaded as native code.
Could be higher if: on multi-user hosts: another local user can pre-create or link the fixed path and obtain code execution as the application user.
Create a private directory with fs.mkdtempSync and write the addon there.
Info after review (7)
url.md:1930From the report
const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com';
return new URL(`${proto}://${host}${req.url || '/'}`);
The sample builds an absolute URL from client-controllable headers. The following paragraph says it assumes a trusting reverse proxy, so the risk is limited to readers who copy the code without that assumption.
Take the host from configuration or an allowlist in the sample, and show the forwarded-header form only next to a check of the scheme and host values.
stream.md:425From the report
req.on('data', (chunk) => {
body += chunk;
});
The sample is the page's main HTTP server example. Node applies no body limit, so a copied endpoint lets any client send a body as large as memory allows before JSON.parse runs.
Track the received length, answer 413 and destroy the request past a limit, and say in the text that the sample has no cap.
zlib.md:300From the report
case 'br':
pipeline(response, zlib.createBrotliDecompress(), output, onError);
The client sample decompresses a network response into output with no limit on decompressed size. A hostile server can send a small compressed body that expands enormously. The maxOutputLength option protects only the convenience methods.
Show a counting transform that aborts the pipeline past a limit, or state that the sample is unbounded.
stream.md:1919From the report
// Still reading the header.
header += str;
If the delimiter never arrives, the sample keeps appending untrusted input to header. A reader who copies it into a server parses arbitrarily long input.
Cap the header length, call the callback with an error and destroy the stream when no delimiter is found within the cap.
vm.md:2412From the report
writeFileSync(resolve(import.meta.dirname, 'test.mjs'),
'export const filename = "./test.json";');
Running the sample silently overwrites any existing test.mjs or test.json next to the script.
Write the helper files into a fresh directory from fs.mkdtempSync, or use the wx flag.
packages.md:458From the report
// package.json
{
"name": "my-package",
Pasted into a real package.json, the comment makes the file invalid JSON.
Move the file name into the code fence label or a heading.
webstreams.md:1636From the report
const readable = Readable.from(dataArray);
...
// Prints: from readable: 76
Readable.from iterates a Uint8Array element by element, so the printed 76 is the length of the decimal digits of each byte, not the data size. The sibling examples print 27. The printed value is accurate, but the example looks like a correct way to turn bytes into a stream and teaches a pattern that corrupts data.
Use Readable.from([dataArray]) or a Buffer and print 27.
Excluded on review (1)
Findings the review showed to be wrong or a repeat of another finding. They are not counted above.
- 17. Dependency-timing examples print 'undefined' as the module name (wrong): timerify() copies the call arguments onto the entry, so entry[0] does print the module name.