Commit Graph
9337 Commits
Author SHA1 Message Date
jakecastelliandMikhail Leliakin 6d426a0494 http2: add missing setHeaders
Make it possible to invoke response.setHeaders() on the
Http2ServerResponse object, matching the http.OutgoingMessage API.

Fixes: https://github.com/nodejs/node/issues/51573
Refs: https://github.com/nodejs/node/pull/51576
Signed-off-by: jakecastelli <38635403+jakecastelli@users.noreply.github.com>
Signed-off-by: Mikhail Leliakin <leliakin@canva.com>
Co-authored-by: Mikhail Leliakin <leliakin@canva.com>
Assisted-by: Cursor
PR-URL: https://github.com/nodejs/node/pull/67597
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-21 15:21:55 +00:00
Ethan Arrowood 17dab26e13 doc,test: clarify http1 insecure validation
The httpValidation docs said 'insecure' disables all header value
validation. That wasn't entirely true. It only did so for incomming
messages (which are parsed with all --insecure-http-parser leniency
flags). Outgoing header values are still validaed as in 'relaxed'
mode. This comes from the design in https://github.com/nodejs/node/pull/61597

This change corrects the docs and adds some tests to assert the
expected behavior

Refs: https://github.com/nodejs/node/pull/61597
Refs: https://github.com/nodejs/node/pull/63571
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ethan Arrowood <ethan@arrowood.dev>
PR-URL: https://github.com/nodejs/node/pull/67560
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-20 21:17:28 +00:00
Rafael Gonzaga 3fda34e186 fs: do not disable fd-based APIs in permission audit mode
Refs: https://github.com/nodejs/node/pull/65659
Refs: https://github.com/nodejs/node/issues/65419
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/66726
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-11-20 19:25:20 +00:00
Shelley Vohr dcaf43a167 module: disable the compile cache while V8 coverage is collected
V8 cannot collect block coverage for functions that are deserialized
from the code cache, so it only reports how many times each of them
ran. With a warm compile cache, branches that never ran inside those
functions are reported as covered, and tools that merge reports from
several processes can report functions that ran as never run.

The documentation recommended turning the cache off by hand. Do it
automatically when coverage collection starts with the process, through
NODE_V8_COVERAGE or --experimental-test-coverage.

The compile cache tests stop propagating NODE_V8_COVERAGE to the
processes they spawn, so that they keep working when the test suite
itself runs with coverage.

Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67120
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-20 14:59:50 +00:00
Paolo Insogna 50ba1ec6c2 worker: add diagnostic channel 'worker_threads.main.registry'
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
Assisted-By: OpenAI:GPT-6.1 Sol <openai/gpt-6.1-sol>
PR-URL: https://github.com/nodejs/node/pull/67311
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-20 06:53:49 +00:00
Filip Skokan 3c26849e17 doc: clarify crypto and Web Crypto options
Document which digest and MAC options apply and how output lengths
work. Clarify signature contexts and distinguish required parameters
from optional defaults in Web Crypto.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67565
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-11-19 23:37:32 +00:00
Marten Richter 3521a6e311 quic: add option waitUntilAvailable to creating streams
We add an option to createBidirectionalStream and
createUnidirectionalStream to fail immediately,
if the flow control's stream budget does not
allow stream creation.
The behavior matches W3C webtransport's behavior.

Fixes #65321

Signed-off-by: Marten Richter <marten.richter@freenet.de>
PR-URL: https://github.com/nodejs/node/pull/65331
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-19 19:14:32 +00:00
Vlad Frangu 42800b60d3 os: expose guessFileDescriptorType
Exposes the internal `guessHandleType` function as
`guessFileDescriptorType`, which can be used to see if a handle has a
specific type, regardless of the OS it is on.

This helps out with detecting, for example, if standard input is piped
into the process, instead of relying on file system calls.

Refs: https://github.com/nodejs/node/issues/57603
Signed-off-by: Vlad Frangu <me@vladfrangu.dev>
PR-URL: https://github.com/nodejs/node/pull/58060
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Aviv Keller <me@aviv.sh>
2026-11-19 10:46:13 -07:00
Yuya Inoue f442b5a232 http2: add callback to informational header methods
In the HTTP/1 server, writeContinue(), writeEarlyHints() and
writeInformation() accept a callback that is called once the response
has been written to the socket. The HTTP/2 compat versions did not, so
code moving to the compat API had its callback ignored.

Accept an optional callback in http2stream.additionalHeaders() and in
the three compat methods. The request for the HEADERS frame is tracked
until nghttp2 serializes the frame, and completed together with the
write to the underlying stream that carries it.

Signed-off-by: inoway46 <inoueyuya416@gmail.com>
Assisted-by: claude:opus-5.5
PR-URL: https://github.com/nodejs/node/pull/67470
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-19 16:39:21 +00:00
Michaël ZassoandJoyee Cheung 697c575af4 src,test: use non-deprecated v8::FunctionCallbackInfo::DataV2 API
Co-Authored-By: Joyee Cheung <joyeec9h3@gmail.com>
Signed-Off-By: Michaël Zasso <targos@protonmail.com>
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: https://github.com/nodejs/node/pull/67070
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2026-11-19 10:34:49 -05:00
Matteo Collina c47b8d8781 url: restrict option copying in urlToHttpOptions to URL instances
Only spread own enumerable properties for URL instances created by this
realm's URL constructor. Duck-typed objects accepted by isURL() can no
longer smuggle connection options (socketPath, method, headers, agent)
into a request.

This fixes a footgun where a hostname-validated http.request() could be
redirected to a Unix socket (e.g. the Docker daemon) via a URL-shaped
object, bypassing hostname-based SSRF checks. Extending a genuine URL
object with extra options is preserved.

Refs: https://github.com/nodejs/node/pull/46989
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67454
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-11-19 08:20:21 +00:00
Tim Perry b7df44bf9c tls: docs-deprecate TLS renegotiation, add allowRenegotiation opt-in
For now this changes very little, but offers an option to directly
control whether this is supported. In future, this will default to
'false' (disabling by default) and eventually be mostly removed,
except opt-in client support for accepting renegotiation requests
from servers.

Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67532
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-18 22:39:56 +00:00
Christian Aurich Zanettini Martins d15ad82c29 quic: validate maxPayloadSize range
The maxPayloadSize option was copied into ngtcp2's
max_tx_udp_payload_size unchecked. ngtcp2 requires 1200 to 65527 and
only asserts it, so in a release build 0 gave the congestion controller
an empty initial window and the process died with SIGFPE in
ngtcp2_cc_cubic_init() when the connection was created. Values from 1
to 1199 were accepted and the session was destroyed before it opened.

Reject values outside that range when the session options are parsed,
for both connect() and listen().

Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67531
Refs: https://github.com/nodejs/node/pull/65827
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-18 21:16:54 +00:00
Matteo Collina 273f2176a3 sea: add source maps for SEA with VFS
SEA binaries built with "useVfs" can now load source maps from the
bundled assets (or the "vfsArchive" archive) and apply them to stack
traces and error output, because fs reads are routed through the virtual
file system mounted by the SEA.

Add two tests covering the inline-assets and zip-archive VFS paths, each
asserting that findSourceMap() resolves against the mount point and that
a thrown error's frame and source line are remapped to the original
source. Also document how to enable and bundle source maps in a SEA.

Signed-off-by: Matteo Collina <matteo.collina@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67503
Reviewed-By: Philipp Dunkel <pip@pipobscure.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-18 13:18:32 +00:00
James M Snell d77ed7854e fs: move DEP0187 to End-of-Life
Passing an invalid argument type to fs.existsSync() now throws
ERR_INVALID_ARG_TYPE instead of returning false. Other invalid paths,
such as strings containing null bytes or non-file: URLs, continue to
return false.

This has been a runtime deprecation since v24.0.0.

Refs: https://github.com/nodejs/node/pull/55753
Refs: https://github.com/nodejs/node/pull/55892
Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67494
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
2026-11-18 12:02:29 +00:00
Moshe Atlow 20a93ab52b test_runner: scope rerun ids to the entry file
With process isolation, the `--test-rerun-failures` state file is
written by the parent process, which numbered tests sharing a location
across all test files, while each child process numbers them within
its own file. A test defined in a helper used by several test files
was therefore looked up in a slot belonging to another file, and a
failing test could be replayed as passed without running.

Prefix the identifier of a test defined outside of its entry file with
the entry file when tests run in per-file child processes, and build
the identifier with the same helper on both sides.

Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/67512
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2026-11-18 09:39:47 +00:00
Efe Karasakal 3e797cbda2 quic: handle application-specific no-error codes
Signed-off-by: Efe Karasakal <hi@efe.dev>
PR-URL: https://github.com/nodejs/node/pull/67094
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-18 07:50:23 +00:00
sophia f551bb51c7 doc: clarify cumulative output limits for zlib streams
Clarify in `doc/api/zlib.md` that `maxOutputLength` bounds single-call
convenience methods (`zlib.gunzip()`, `zlib.brotliDecompress()`,
`zlib.zstdDecompress()`, and `*Sync` variants) rather than cumulative
decoded output across `create*Decompress()` streams, and add a
`stream/promises` `pipeline()` example enforcing a cumulative byte
limit.

Signed-off-by: Sophia Boettcher <93076268+sboettch@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/67373
Refs: https://github.com/nodejs/node/blob/main/doc/api/zlib.md
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-11-18 06:45:20 +00:00
Bryan English 7fa06d4717 http2: allow client request header injection via diagnostics_channel
The http2.client.stream.created and http2.client.stream.start channels
publish the stream's sentHeaders object, but by that point the request
headers have already been serialized in ClientHttp2Session#request().
Mutating the published object has no effect on the wire, so tracing
instrumentation has no way to add context headers such as traceparent to
outgoing HTTP/2 client requests.

Add a new http2.client.request.headers channel, published when
ClientHttp2Session#request() is called, before the headers are validated
and serialized. Subscribers receive a shallow copy of the headers object
passed by the caller and can mutate it in place to add or modify request
headers. When request() is called without headers, a fresh object is
published so subscribers can still inject headers. The caller's own
headers object and its sensitiveHeaders list are never modified, so
header objects can be safely reused or forwarded across requests.
Injected headers go through the same validation as headers passed
directly to request().

The existing created and start channels are unchanged.

Assisted-by: pi
Signed-off-by: Bryan English <bryan@bryanenglish.com>
PR-URL: https://github.com/nodejs/node/pull/67069
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-17 20:38:06 +00:00
Yuya Inoue 4415e2fc77 doc: fix http response.writeInformation() signature
The second argument is always treated as `headers`, so `callback`
cannot be passed without it.

Signed-off-by: inoway46 <inoueyuya416@gmail.com>
Assisted-by: Claude Code
PR-URL: https://github.com/nodejs/node/pull/67492
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-17 16:58:17 +00:00
James M Snell 1727b138f9 esm: move DEP0155 and DEP0166 to End-of-Life
Package "exports" subpaths ending in "/" now throw
ERR_INVALID_MODULE_SPECIFIER instead of emitting DEP0155, matching
the existing "imports" behavior and the documented resolution
algorithm.

"imports" and "exports" targets containing empty segments (double,
leading, or trailing slashes after the initial "./") now throw
ERR_INVALID_PACKAGE_TARGET, and pattern matches containing empty
segments now throw ERR_INVALID_MODULE_SPECIFIER, instead of emitting
DEP0166.

The isPathMap parameter, which only served to suppress DEP0166 for
trailing slash pattern resolutions, is removed.

DEP0155 has been a runtime deprecation since v17.0.0, DEP0166 since
v19.0.0.

Refs: https://github.com/nodejs/node/pull/40117
Refs: https://github.com/nodejs/node/pull/44495
Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67488
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-17 16:41:10 +00:00
James M Snell 6c835918fb crypto: move DEP0179 and DEP0181 to End-of-Life
Calling the Hash or Hmac constructors directly, with or without new,
now throws ERR_ILLEGAL_CONSTRUCTOR. Instances must be created with
crypto.createHash() and crypto.createHmac().

The classes remain exported from node:crypto so that instanceof checks
continue to work. Internally, instances are constructed through a
private symbol, and the createHash() and createHmac() factories now
live alongside the classes in internal/crypto/hash.

Both have been runtime deprecations since v22.0.0.

Refs: https://github.com/nodejs/node/pull/51880
Refs: https://github.com/nodejs/node/pull/52071
Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67490
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-17 16:40:55 +00:00
Gabe De Mesa cdc1dacdd5 http2: enforce maxSessionMemory for client requests
The documentation for `maxSessionMemory` says new streams are rejected
while the limit is exceeded. That was only enforced for streams opened
by the peer (`Http2Session::CanAddStream()`). `session.request()` went
straight to `nghttp2_submit_request()`, so a client whose socket
stopped draining could keep queuing requests in nghttp2 without bound.

Check the session memory before submitting a request. If it is over
the limit, reject only that request with the new
`ERR_HTTP2_SESSION_MEMORY_EXCEEDED` error. Nothing is sent to the peer,
so the request can be retried, and the session stays usable. As with
response headers, request bodies queued for flow control are not
counted, so large uploads do not block unrelated requests on the same
session.

Refs: https://github.com/nodejs/undici/issues/6181
Assisted-by: a closed-source coding agent
Signed-off-by: Gabe De Mesa <gdemesa@opengov.com>
PR-URL: https://github.com/nodejs/node/pull/67361
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-17 13:26:40 +00:00
Joyee Cheung 1c40cface6 inspector: support attaching to a running process in probe mode
Probe mode currently only launches a new process from the entry point
script. This change lets it attach to an already-running process, so a
long-lived application can be inspected without restarting it.

Running `node inspect --probe` without specifying an entry point script
instructs Node.js to attach to a running Node.js process and probe.
The way attaching is done is specified through command line arguments:

- `--pid <pid>` activates the target's inspector (if it's not already
  activated) and connects to it.
- `--host <host>` and `--port <port>` specify an address where an
  inspector is listening. The host defaults to 127.0.0.1 and the
  port defaults to 9229.

When the session ends, probe mode resumes and detaches instead of
killing a process it does not own. The report now includes a top-level
`target` field describing what was probed, and each probe contains a
`locations` field about where it bound.

An attach session ends when a probe reaches `--max-hit`
(reported as `completed`), when the target finishes on its
own (`completed`, or `miss` with the pending probes, and the target is
then allowed to exit), or when `--timeout` fires (reported as
`timeout`, the probing process exit with 0 and reports the hits recorded
so far).

`--timeout` now is also applied to the startup phase in both modes, so
a target that never responds before the breakpoints are bound is
reported as an error instead of hanging.

Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67201
Reviewed-By: Jan Martin <jan.krems@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-17 09:51:42 +00:00
Ilyas Shabi 6a536f95f7 diagnostics_channel: add threadpool work event
Signed-off-by: ishabi <ilyasshabi94@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65982
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
2026-11-17 09:00:19 +00:00
James M Snell 428dd86489 src: warn when heap would exceed pointer compression limit
In builds without pointer compression, emit a process warning with
the code HEAP_EXCEEDS_POINTER_COMPRESSION_LIMIT when the heap that
survives a full garbage collection suggests that it would not fit in
the 4 GiB cage that limits the heap of each isolate when pointer
compression is enabled.

Pointer compression shrinks a heap by at most half, and by about 40%
in practice, so the warning says the heap is likely to exceed the
limit from 6.5 GiB, and that it will exceed the limit from 8 GiB.

The check runs in a GC epilogue callback for mark-compact GCs only,
is done at most once per Environment, and unregisters itself after
the warning has been scheduled. The warning can be silenced with
--disable-warning=HEAP_EXCEEDS_POINTER_COMPRESSION_LIMIT.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67468
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-16 15:54:47 +00:00
sangwook c48b26c95d test_runner: add tags and workerId to SuiteContext
TestContext exposes tags and workerId, but SuiteContext does not, so a
describe() callback cannot read the suite's tags, including the ones
inherited from ancestor suites. Expose both on SuiteContext as well.

Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67312
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-11-16 09:47:39 +00:00
LiviaMedeiros 329497afb5 doc: swap util.TextDecoder and util.TextEncoder with globals
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67461
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-16 08:51:58 +08:00
LiviaMedeiros 1260eeea40 doc: use global TextDecoder and TextEncoder instead of util
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67461
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-16 08:51:57 +08:00
LiviaMedeiros 8dbdd03581 doc: deprecate util.TextDecoder and util.TextEncoder
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67461
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-16 08:51:57 +08:00
Hamza Kargin 537a20c113 fs: respect setDefaultHighWaterMark in ReadStream
ReadStream ignored stream.setDefaultHighWaterMark() and always used
64 KiB. Use the user-set value when there is one, and keep 64 KiB
otherwise so Windows does not drop to the 16 KiB stream default.

Fixes: https://github.com/nodejs/node/issues/66937
Signed-off-by: Hamza Kargın <hamzakargin@outlook.com>
PR-URL: https://github.com/nodejs/node/pull/66956
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-15 09:43:51 +00:00
Geoffrey Booth cb05e4d0c2 module: remove async module customization hooks
Remove `module.register()` (DEP0205), the `--experimental-loader` and
`--loader` flags, and the machinery that supported them: the loader
hooks worker thread, the hooks proxy, the async module customization
hook chains for resolving and loading, the internal worker class used to
run the loader thread, and the asynchronous module job linking. Module
customization is now provided only by `module.registerHooks()`, which
runs synchronously on the thread that loads the modules.

As the loader thread no longer exists, the ES module loader always loads
and links modules synchronously, so the code that handled promises and
the re-invented `require()` for imported CommonJS customized by the
async module customization hooks is removed too. `import()` still defers
evaluation of the module to a later microtask, as before.

`worker_threads.isInternalThread` is kept for compatibility and is now
always `false`; removing it is left for a future semver-major change.

The `ERR_ASYNC_LOADER_REQUEST_NEVER_SETTLED` and
`ERR_LOADER_CHAIN_INCOMPLETE` error codes are no longer used and are
documented as removed.

Tests that exist only to exercise the async module customization hooks
are removed.

Assisted-by: Claude
Signed-off-by: Geoffrey Booth <webadmin@geoffreybooth.com>
PR-URL: https://github.com/nodejs/node/pull/67090
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-11-14 21:51:46 +00:00
Filip Skokan bd08ba304e crypto: throw on X509Certificate operation errors
X509Certificate can report failed operations as missing fields or
negative checks. Invalid validity times return "Bad time value" or
Invalid Date, making relational date comparisons return false.

Throw when required fields cannot be converted, certificate encoding or
fingerprint calculation fails, or a present AIA or EKU extension cannot
be decoded. Apply this to getters and explicit toLegacyObject() calls.
Report failed or unsupported private-key comparisons as exceptions.

For verify(), return true for 1 and false for 0. Also return false for a
wrong key type or invalid unused bits in the signature BIT STRING.
Throw for other negative results.

Use the existing conversion behavior for legacy TLS certificate objects,
which are also constructed internally during handshakes. Formatting
unrelated metadata must not cause an uncaught exception or reject an
otherwise valid connection.

Fixes: https://github.com/nodejs/node/issues/67285
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67408
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-14 18:00:51 +00:00
Trevor Burnham b5e3a61db3 doc: explain how sqlite binds numbers and BigInts
A JavaScript number is always bound with sqlite3_bind_double(), so it is
written as REAL even when it has no fractional part. A BigInt is bound
with sqlite3_bind_int64() and is the way to write an INTEGER. The type
conversion table listed number under both INTEGER and REAL without
saying which applies when, so the rule had to be discovered by
experiment.

Column type affinity hides this most of the time, which is why the cases
it does not cover are surprising. Comparing against a TEXT column is the
worst of them: the number 3 compares as '3.0' and silently fails to
match a stored '3', with no error to point at the cause. Document the
rule, the reason for it, and that case, and remove number from the
table's INTEGER row. Point the virtual table section's link at the new
text.

better-sqlite3 binds numbers the same way and has fielded the same
question repeatedly (WiseLibs/better-sqlite3#165, #627, #897, #1144,
#1313), each time closed as working as intended.

Fixes: https://github.com/nodejs/node/issues/63826
Refs: https://github.com/WiseLibs/better-sqlite3/issues/627
Assisted-by: Claude Opus 5.5
Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67424
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
2026-11-14 01:37:10 +00:00
Sarthak Ahuja 11d74515f2 doc: document invalid X509Certificate validity times
When a certificate's notBefore or notAfter time cannot be parsed,
validFrom and validTo return the string 'Bad time value', and
validFromDate and validToDate return an invalid Date. Relational
comparisons with an invalid Date are always false, so a naive expiry
check can treat such a certificate as valid. Document the current
behavior and tell callers to reject invalid dates first.

Signed-off-by: Sarthak Ahuja <39986642+SarthakAhuja@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/67406
Refs: https://github.com/nodejs/node/issues/67285
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-13 09:18:44 +00:00
James M Snell c905bedc90 lib: avoid dead code elimination with node:bench
Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-13 03:50:53 +00:00
James M Snell e256fcb78b lib: add gc options to node:bench
Adds option post-warmup and pre-sample gc options
to node:bench

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-13 03:50:52 +00:00
James M Snell e3499df9b4 lib: default bench operations to 1
b.end(N) ... N defaults to 1
b.report(...) operations defaults to 1

Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-13 03:50:51 +00:00
James M Snell 7a38815076 lib: update node:bench reporters to include sys info
Signed-off-by: James M Snell <jasnell@gmail.com>
Assisted-by: Opencode
PR-URL: https://github.com/nodejs/node/pull/66664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-13 03:50:49 +00:00
Manjeet Singh 4ad8171344 doc: explain fallback arrays in package exports targets
The "exports" field type lists `string[]`, but the packages
documentation never describes how an array of targets is resolved.
Document that items are tried in order, that only invalid targets and
unmatched conditions are skipped, and that a missing file does not
cause the next item to be tried.

Fixes: https://github.com/nodejs/node/issues/58600
Signed-off-by: Manjeet Singh <024manjeetsingh@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67393
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-11-12 21:07:25 +00:00
Node.js GitHub Bot 4f23168685 2026-11-12, Version 27.0.0-alpha.0.1.0 (Alpha)
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) https://github.com/nodejs/node/pull/66639
crypto:
  * (SEMVER-MINOR) make X.509 inspection guards explicit (Filip Skokan) https://github.com/nodejs/node/pull/67245
  * (SEMVER-MINOR) add X.509 generation with CSR support (Filip Skokan) https://github.com/nodejs/node/pull/67245
dns:
  * (SEMVER-MINOR) coalesce identical concurrent lookup() requests (Orgad Shaneh) https://github.com/nodejs/node/pull/62599
doc:
  * add efekrskl to collaborators (Efe Karasakal) https://github.com/nodejs/node/pull/67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) https://github.com/nodejs/node/pull/67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) https://github.com/nodejs/node/pull/67377
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) https://github.com/nodejs/node/pull/67187
sea:
  * (SEMVER-MINOR) generate a compile cache for the VFS modules (Matteo Collina) https://github.com/nodejs/node/pull/66768
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) https://github.com/nodejs/node/pull/66311

PR-URL: https://github.com/nodejs/node/pull/67415
2026-11-12 14:31:58 +01:00
Robert I Nilsson 8aa19d23d1 doc: document this binding in TLS callbacks
Document that `this` is bound to the `tls.TLSSocket` instance
when `SNICallback` and `ALPNCallback` are invoked.

Signed-off-by: Robert I Nilsson <robert.i.nilsson@callclue.com>
PR-URL: https://github.com/nodejs/node/pull/66682
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-12 11:25:07 +01:00
Matteo Collina 3f3c59317e http2: charge inbound DATA retained by streams to maxSessionMemory
Inbound DATA frames delivered to JS while a stream is paused are
retained in the stream's readable buffer until the application reads
them. These were not counted against the session's maxSessionMemory, so
a peer could send many tiny DATA frames on a stream the application is
not draining and make the session retain an unbounded amount of memory,
in proportion to the number of frames rather than the bytes sent.

Charge each such DATA chunk (plus a per-chunk overhead comparable to the
Buffer view bookkeeping) against maxSessionMemory, and release it when
the stream resumes reading (ReadStart) or is destroyed (RemoveStream).
Add connection-level backpressure so the session stops reading from the
socket once it can no longer afford the inbound queued data, resuming
when the application consumes it.

Refs: https://hackerone.com/reports/4089663
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs-private/node-private/pull/1000
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
CVE-ID: CVE-2026-123868
2026-11-11 17:33:39 +01:00
Manjeet Singh 1b99d7cd8c sea: mount the SEA VFS in workers at layer 0
A single executable application built with "useVfs" mounted the VFS
serving its "assets" in the main thread only, at a mount point numbered
in mount order, so a worker started from a script among the assets
could not load it. On Windows this failed as an invalid package.json
at \.\nul\package.json, because paths under the NUL device open it.

"useVfs" is the --vfs-load of a single executable application: its
"assets" or its "vfsArchive" archive are the source, and its "main" is
the entry point. Mount it at layer 0, the mount point reserved for the
--vfs-load source, whichever provider serves it, and mount it in
workers too, as was already done for an archive. Other mounts are
numbered from 1, as everywhere else.

To keep layer 0 free, reject --vfs-load in every single executable
application rather than only in one built with "vfsArchive": its entry
point is fixed, and resolving modules against its files is what
"useVfs" already does. --build-sea refuses it in "execArgv", and the
executable at startup when it comes from --node-options or from the
execArgv of a worker.

A worker started from a path into a VFS that is not mounted in it, such
as one mounted with vfs.mount() in its parent, now fails with
ERR_VFS_NOT_MOUNTED.

Fixes: https://github.com/nodejs/node/issues/67223
Assisted-by: a coding agent
Signed-off-by: Manjeet Singh <024manjeetsingh@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67239
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Philipp Dunkel <pip@pipobscure.com>
2026-11-11 11:07:06 +00:00
Filip Skokan dc6b82046c crypto: remove the FIPS provider name check
FIPS-capable providers can use names other than fips. Remove the
named-provider lookup and explicit self-test from the startup flags,
leaving algorithm availability checks to each operation.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67358
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-11 10:56:08 +00:00
Filip Skokan 5498ee6eb5 crypto: add X.509 generation with CSR support
Expose callback-based generateX509Certificate() and synchronous
generateX509CertificateSync(), producing X509Certificate objects for
self-signed and issuer-signed X.509 v3 certificates. Accept grouped
distinguished names or exact subject DER, public keys, serial numbers,
validity dates, and an explicit signing digest. Reuse crypto.sign() key
inputs and RSA options, including OpenSSL STORE-backed keys.

A PKCS#10 request can supply the subject and public key instead.
Require a synchronous selectExtensions callback to accept, replace, or
amend the requested extensions. Verify the request signature before
signing the certificate, in the selected sync or async mode.

Provide typed Basic Constraints, Key Usage, Extended Key Usage, SAN,
SKI, and AKI, plus arbitrary raw extensions. Add none implicitly and
leave raw extension semantics to the caller. Copy mutable inputs
before queueing asynchronous work. Certificate trust and CA
authorization remain the caller's responsibility.

Fixes: https://github.com/nodejs/node/issues/51169
Assisted-by: Codex
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67245
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-11 10:46:21 +00:00
Aviv Keller 77e63793ad lib: enable web worker api by default
Signed-off-by: avivkeller <me@aviv.sh>
PR-URL: https://github.com/nodejs/node/pull/65323
Refs: https://github.com/nodejs/node/pull/64894
Refs: https://github.com/nodejs/node/issues/43583
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-11 08:27:59 +00:00
Fuma ab11f834fc doc: update readable.read() for v26 one-chunk behaviour
Signed-off-by: Fuma2514 <fuma2514@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/67341
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-10 21:45:18 +00:00
Daijiro Wachi 6e4ea3d74d doc: fix process import in test runner workerId example
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67316
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-11-09 21:38:04 +00:00
Matteo Collina 5d59de845c sea: generate a compile cache for the VFS modules
"useCodeCache" was rejected together with "useVfs" because the SEA code
cache is only consumed by the embedder compile paths, while a main
script in the VFS runs through the regular loaders and a main-only cache
would not cover the modules it depends on anyway.

Compile every JavaScript (and, with --strip-types, TypeScript) module in
the VFS when the preparation blob is generated, without executing them,
through a portable CompileCacheHandler keyed by the path relative to the
mount point. The entries are serialized in the cache file layout and
embedded as reserved node:sea:compile-cache/<key> assets, which the SEA
provider hides from the mount. Modules that fail to compile are skipped.

CompileCacheHandler gains a key root for portable caches and in-memory
serialization of its entries, shared with Persist(). The build runs in a
Node.js instance whose environment ignores NODE_COMPILE_CACHE.

Reading the embedded entries at startup is left to a follow-up.

Tests skip up front when building a single executable application on
Windows without signtool, so the async VFS code cache test is skipped
cleanly instead of failing on an unmatched mustCall.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
Assisted-by: pi
PR-URL: https://github.com/nodejs/node/pull/66768
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-11-09 06:27:20 +00:00