Sample audits · Workstation audits, October 2026

Node.js API documentation, part 1 of 2

The first half of the Node.js v24 API reference, addons to module.

Summary card for this audit: 15 findings after review, 0 High, 5 Medium, 8 Low, 2 Info

Corrected 16 November 2026: on re-checking, finding 3 was shown wrong and moved to excluded. Before: 0 High, 5 Medium, 9 Low, 2 Info, 0 excluded on review. Now: 0 High, 5 Medium, 8 Low, 2 Info, 1 excluded on review. Only these moves change the figures above; the re-check of the other findings is in the section below.

AuditedNode.js API reference v24.22.1, addons to module (32 pages), pages fetched 21 October 2026
Date22 October 2026
How it ranlocal run on our workstation, full audit, Standard review
Verdict after reviewPass with notes (Fail if a High finding remains after review, otherwise Pass with notes)

Related: Node.js API documentation, part 2 of 2 (October 2026) · cloudflare/security-audit-skill (October 2026)

0
High after review
5
Medium after review
8
Low after review
2
Info after review
1
excluded on review

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.

#FindingStatus todayRating at audit → now
1Server sample answers with a request value and no content typeStill presentInfo → Info
2Http2 secure server timeout default contradicts the rest of the pageStill presentLow → Low
3Minimum for maxHeaderListPairs differs between the three option listsWrong at audit (excluded)Low → excluded
4Stray semicolon in an event headingStill presentInfo → Info
5Load-hook sample throws away its own source rewriteAlready in an open Node.js pull requestMedium → Medium
6Synchronous import-map hook sample calls readFileSync on the promises moduleAlready in an open Node.js pull requestMedium → Medium
7WebAssembly text sample exports an identifier it never definedStill presentMedium → Medium
8Suggested replacement for util.isDate() is never trueStill presentMedium → Medium
9Config-file example contains a key the page says is forbiddenStill presentMedium → Medium
10traceCallback example uses names that are never definedStill presentLow → Low
11Wasm import example names index.js but runs index.mjsStill presentLow → Low
12Proxy examples pass a callback to fetch()Still presentLow → Low
13Environment-file page claims a file can be sourced by a shellStill presentLow → Low
14keepAliveTimeout default stated twice with different valuesFixed on main onlyLow → Low
15crypto.verify gives the wrong default PSS salt lengthStill presentLow → Info
16File-handle sample closes a handle that may be undefinedStill presentLow → Low

The full record of this re-check: github.com/ondrejdvorak78/nodejs-v24-api-docs-errors.

How to read this page

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. 5 findings were first rated Medium or High; 5 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 (5)

5. Medium Load-hook sample throws away its own source rewrite
First rating: Medium · Reviewed rating: Medium · Review: confirmed
Location: module.md:1039
From the report
Evidence
source: source.replace(/foo/g, 'bar'),
    ...result,
Why it matters

The spread of result comes after the rewritten source, so result.source from nextLoad overwrites it and the documented 'foo' to 'bar' replacement never happens. Reach: any developer copying the synchronous registerHooks load-hook example to transform module source gets unmodified source and no error.

Suggested fix, not tested

Spread first and override after: return { ...result, source: source.replace(/foo/g, 'bar') };

6. Medium Synchronous import-map hook sample calls readFileSync on the promises module
First rating: Medium · Reviewed rating: Medium · Review: confirmed
Location: module.md:1813
From the report
Evidence
import fs from 'node:fs/promises';
...
const { imports } = JSON.parse(fs.readFileSync('import-map.json', 'utf-8'));
Why it matters

node:fs/promises has no readFileSync, so the sample throws TypeError: fs.readFileSync is not a function on every run, before any hook is registered (import at line 1810). Reach: any developer following the Synchronous version of the import-maps example.

Suggested fix, not tested

Import from 'node:fs' (or import { readFileSync } from 'node:fs').

7. Medium WebAssembly text sample exports an identifier it never defined
First rating: Medium · Reviewed rating: Medium · Review: confirmed
Location: esm.md:805
From the report
Evidence
(func $getLength (param $str externref) (result i32)
...
(export "getLength" (func $get_length))
Why it matters

The function is declared as $getLength (line 799) but exported through $get_length, so the module does not assemble. The following import examples (lines 810 and 834) cannot be reproduced. Reach: a developer building string-len.wasm from the page.

Suggested fix, not tested

Export the declared name: (export "getLength" (func $getLength)).

8. Medium Suggested replacement for util.isDate() is never true
First rating: Medium · Reviewed rating: Medium · Review: confirmed
Location: deprecations.md:1147
From the report
Evidence
`Date.prototype.toString.call(arg) === '[object Date]' && !isNaN(arg)`.
Why it matters

Date.prototype.toString returns the formatted date string, never '[object Date]', so the expression is false for every valid Date. The page presents it as the stronger approach to replace the removed util.isDate(). Reach: a developer migrating off util.isDate() who follows this advice silently stops matching dates.

Suggested fix, not tested

Use Object.prototype.toString.call(arg) === '[object Date]' && !isNaN(arg), or arg instanceof Date alone.

9. Medium Config-file example contains a key the page says is forbidden
First rating: Medium · Reviewed rating: Medium · Review: confirmed
Location: cli.md:1033
From the report
Evidence
"nodeOptions": { ... "watch-preserve-output": true }, ... "watch": { "watch-preserve-output": true }
Why it matters

The only full example puts watch-preserve-output in both nodeOptions (line 1027) and watch (line 1033), while the same page says 'Keys cannot be duplicated within the same or different namespaces' and that the parser throws on invalid keys. Reach: a developer who copies the sample configuration file for --experimental-config-file hits the documented error.

Suggested fix, not tested

Keep the key in one namespace only and make the equivalent command line match.

Low after review (8)

2. Low Http2 secure server timeout default contradicts the rest of the page
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: http2.md:2743
From the report
Evidence
* `msecs` {number} **Default:** `120000` (2 minutes)
Why it matters

server.setTimeout() on the secure server states 120000 ms, while server.timeout on the same page (line 2766) and the changelog note (line 2681) say the default is 0 (no timeout). The same stale figure appears in https.md line 225, against https.md line 241. The correct value is stated nearby, so a reader is misled only if they read the one entry.

Suggested fix, not tested

State 0 (no timeout) in both setTimeout entries.

10. Low traceCallback example uses names that are never defined
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: diagnostics_channel.md:916
From the report
Evidence
channels.traceCallback((arg1, callback) => {
  callback(null, 'result');
}, 1, { some: 'thing' }, thisArg, arg1, callback);
Why it matters

thisArg, arg1 and callback are not declared at the call site, so the sample throws ReferenceError if copied as written. It reads as an illustrative skeleton, which keeps it at LOW.

Suggested fix, not tested

Declare the values or pass literals, for example traceCallback(fn, 1, ctx, undefined, 'arg', (err, res) => {}).

11. Low Wasm import example names index.js but runs index.mjs
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: esm.md:845
From the report
Evidence
For example, an `index.js` containing: ... node index.mjs
Why it matters

The prose says to create index.js, the command runs index.mjs. A reader sees the mismatch at once and the fix is trivial.

Suggested fix, not tested

Use one file name in the prose and the command.

12. Low Proxy examples pass a callback to fetch()
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: http.md:4602
From the report
Evidence
fetch('https://www.example.com', (res) => {
  // This request will be proxied if HTTPS_PROXY or https_proxy is set
});
Why it matters

fetch() takes (url, init) and never calls a callback; the same pattern repeats at lines 4621, 4645 and 4664. The request is still proxied, so the effect is a misleading sample, not a failure.

Suggested fix, not tested

Show const res = await fetch('https://www.example.com');

13. Low Environment-file page claims a file can be sourced by a shell
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: environment_variables.md:131
From the report
Evidence
This is useful so that the file can be sourced, without modifications, in shell terminals.
...
export MY_VAR = my variable
Why it matters

The page's own examples use spaces around = and unquoted multi-word values, which a POSIX shell rejects. The statement is about the optional export prefix, not a step to follow, so impact is limited.

Suggested fix, not tested

Show export MY_VAR='my variable' or note that Node accepts forms a shell does not.

14. Low keepAliveTimeout default stated twice with different values
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: http.md:3749
From the report
Evidence
**Default:** `65000`.   (against line 1993: Default: `5000`)
Why it matters

The createServer option says 65000, the server.keepAliveTimeout entry says 5000. The same page holds both figures; https.md line 251 repeats 5000.

Suggested fix, not tested

State one default in both places.

15. Low crypto.verify gives the wrong default PSS salt length
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: crypto.md:6800
From the report
Evidence
`crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the maximum permissible value.
Why it matters

The verify.verify entry (line 2925) gives RSA_PSS_SALTLEN_AUTO as the default for verification; crypto.verify states the signing default instead. The class entry states the correct behaviour.

Suggested fix, not tested

State RSA_PSS_SALTLEN_AUTO as the default in crypto.verify.

16. Low File-handle sample closes a handle that may be undefined
First rating: Low · Reviewed rating: Low · Review: confirmed
Location: fs.md:9213
From the report
Evidence
let file;
try {
  file = await open('/open/some/file.txt', 'r');
...
} finally {
  await file.close();
Why it matters

If open() rejects, file is undefined and the finally block throws a TypeError that hides the original error. Other samples on the page use file?.close().

Suggested fix, not tested

Use await file?.close();

Info after review (2)

1. Info Server sample answers with a request value and no content type
First rating: Low · Reviewed rating: Info · Review: rated too high
Location: async_hooks.md:725
From the report
Evidence
executionAsyncResource()[sym] = { state: req.url };
  setTimeout(function() {
    res.end(JSON.stringify(executionAsyncResource()[sym]));
Why it matters

The sample writes a value taken from the request URL into the response body without setting a Content-Type or a nosniff header (the same sample is repeated near line 751). The value is JSON-encoded and browsers percent-encode URLs, so a copied sample is not shown to be exploitable; it is a hardening gap in sample code that readers copy.

Suggested fix, not tested

Add res.setHeader('Content-Type', 'application/json') and X-Content-Type-Options: nosniff to both copies of the sample.

4. Info Stray semicolon in an event heading
First rating: Info · Reviewed rating: Info · Review: confirmed
Location: inspector.md:261
From the report
Evidence
#### Event: `<inspector-protocol-method>`;
Why it matters

The callback-API copy of the heading ends with a semicolon; the promise-API copy at line 82 does not.

Suggested fix, not tested

Remove the trailing semicolon.

Excluded on review (1)

Findings the review showed to be wrong or a repeat of another finding. They are not counted above.

Want this for your code?

Upload a ZIP or link a public GitHub repo, pick the areas and the depth, and get findings by severity with fixes.