Commit Graph
49555 Commits
Author SHA1 Message Date
Bryan English 656d78d2cd 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-19 15:44:10 +01:00
James M Snell 081f642b83 fs: use GetAsyncReqWrap() in the remaining async/sync bindings
Replace the repeated `if (argc > N) { req = GetReqWrap(args, N);
CHECK_NOT_NULL(req); ...` prologue of the fs bindings that select the
asynchronous path by argument count with GetAsyncReqWrap().

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67497
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-19 15:44:10 +01:00
James M Snell 84b846ae46 fs: check permissions once in bindings with async and sync paths
Eleven fs bindings (stat, statfs, link, rename, unlink, realpath,
readdir, copyFile, chown, lchown, mkdtemp) repeated every permission
check in both the asynchronous and the synchronous branch, differing
only in whether the denial is reported through the request or thrown.
Obtain the request wrap up front with a new GetAsyncReqWrap() helper
and perform each check once with FS_THROW_IF_INSUFFICIENT_PERMISSIONS(),
which picks the reporting style based on whether the call is async.

How permission denials are reported is unchanged.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67497
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-19 15:44:10 +01:00
James M Snell 0258befb4a src: share snapshot Serialize()/Deserialize() logic for binding data
Eleven snapshotable binding data classes implemented Deserialize() with
the same sequence of opening a handle scope, looking up the Realm, and
recreating the binding data on the holder, and six of them implemented
Serialize() by handing over the InternalFieldInfo allocated in
PrepareForSerialization(). Add Realm::DeserializeBindingData() and
TakeInternalFieldInfo() helpers and use them.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67497
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-19 15:44:10 +01:00
James M Snell 92a0cc4a62 dns: share reply parsing skeleton between record parsers
The MX, CAA, TLSA, TXT, SRV, and NAPTR reply parsers each repeated the
same structure: lazily create the record dictionary template, parse the
reply, iterate the answer section filtering by record type, build and
append each record, and report ENODATA when nothing matched. Factor
that into GetRecordTemplate(), ForEachAnswer(), and AppendRecord()
helpers so each parser only contains its record-specific extraction.

Behavior is unchanged, including TLSA results being indexed by answer
position and never reporting ENODATA.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67497
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-19 15:44:10 +01:00
James M Snell d070e62c09 crypto: add TicketHmacCtx alias for TLS ticket key callbacks
The SecureContext ticket key callback signatures repeated the same
backend-specific preprocessor block to select between EVP_MAC_CTX and
HMAC_CTX. Define the type once as TicketHmacCtx and use it instead.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:10 +01:00
James M Snell 9121206dd0 crypto: share digest length handling between HashInit overloads
The two Hash::HashInit() overloads duplicated the logic that
determines the digest length and validates the requested XOF output
length after the digest context is initialized. Move it into a shared
FinishHashInit() helper.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell 8dc536f7eb buffer: share search range logic between indexOf implementations
IndexOfString() and IndexOfBuffer() duplicated the computation of the
search range and the early returns for empty needles, empty haystacks,
and out-of-range offsets. Move it into a shared
GetIndexOfSearchRange() helper.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell 6d694041e7 url: share URLPattern exec() and test() argument parsing
URLPattern::Exec() and URLPattern::Test() duplicated the parsing of the
input and baseURL arguments. Move it into a shared
ParseURLPatternMatchArgs() helper.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell 79a8d334f1 sqlite: share SQLTagStore statement preparation
SQLTagStore::Run(), Iterate(), Get(), and All() each duplicated the
database state checks, statement preparation, and parameter binding.
Move them into a shared PrepareForExecution() helper.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell 5ad0b32169 stream: deduplicate string chunk encoding in web stream adapters
The Writable and Duplex adapters created from web streams duplicated
the logic that encodes string chunks as a Uint8Array before writing
them to the WritableStream. Move it into a shared encodeStringChunk()
helper.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell a2049085ba util: share helpers between debounce() and throttle()
util.debounce() and util.throttle() duplicated the construction of the
AbortError used for cancel()/abort, and the property definitions for
the returned function's control methods, state getters, length, and
name. Move both into internal/util/wrapped_function.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell d605804cb6 http: share insecureHTTPParser/httpValidation option handling
ClientRequest and Server duplicated the validation of the
insecureHTTPParser and httpValidation options, including the check
that they are mutually exclusive. Move it into a shared
setHttpParserOptions() helper in internal/http.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell ded11f3c27 crypto: deduplicate WebCrypto SPKI/PKCS#8 exporter lookup
exportKeySpki() and exportKeyPkcs8() contained identical switch
statements mapping the algorithm name to its export function. Move
the lookup into a shared getAsymmetricKeyExporter() helper.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
James M Snell 3bda549c05 crypto: share asymmetric WebCrypto key import logic
The RSA, EC, CFRG, ML-DSA, and ML-KEM importKey implementations each
duplicated the handling of the 'KeyObjectHandle', 'spki', and 'pkcs8'
formats. Move it into a shared importAsymmetricKeyHandle() helper in
webcrypto_util, with an optional hook that ML-DSA and ML-KEM use to
reject PKCS#8 keys without a seed.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67495
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-11-19 15:44:09 +01:00
Yuya Inoue 99f0fc42e9 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-19 15:44:09 +01:00
Christian Aurich Zanettini Martins ef7b49853a test: deflake test-process-timeout-blocked
The fixtures that exit while a Worker is blocked created their file in
an 'exit' listener, before the process actually starts exiting, e.g.
while an uncaught error is still being formatted. If the deadline
expired in between, the main thread handled the timeout and the test
failed instead of retrying. The main thread cannot do that once it is
exiting, so retry when it did, and drop the 'exit' listeners.

Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67481
Refs: https://github.com/nodejs/reliability/issues/1724
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-19 15:42:21 +01:00
Jacky Zhao 4d330e28e4 module: store source map mappings in a typed array
SourceMap kept one six-element array per mapping segment. Bundled
applications have millions of segments, and with --enable-source-maps
a parsed map lives for the life of the process: a 63 MB source map with
2.9 million segments retained about 290 MiB of heap.

Store the segments in a single Int32Array, six fields per segment, and
resolve source URLs and names through per-map tables. Segments are
counted before parsing so storage is allocated once, and sorting is
skipped when the mappings are already in order. The public API and the
objects returned by findEntry() and findOrigin() are unchanged.

Signed-off-by: Jacky Zhao <j.zhao2k19@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66261
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-19 15:42:21 +01:00
Ulises Gascon f53eeb214f tools: check notarization status when verifying macOS binaries
Signed-off-by: Ulises Gascon <UlisesGascon@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/67541
Reviewed-By: Stewart X Addison <sxa@redhat.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-19 15:42:21 +01:00
Gabe De Mesa f173879f53 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-19 15:42:20 +01:00
Ved Chaudhari cf06c8d50b util: fix debounce/throttle abort listener leak
debounce() and throttle() added an abort listener to the signal when
they were created and never removed it, so a long-lived signal kept
every debounced or throttled function, and its data, in memory.

Only listen for abort while calls are pending. Calls made after the
signal is aborted still reject, since each call checks signal.aborted.

Assisted-by: a closed-source coding agent
Signed-off-by: vedchaudhari <vedc2853@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66839
Refs: https://github.com/nodejs/node/pull/65899
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-11-19 15:42:20 +01:00
Joyee Cheung 72859e1f20 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-19 15:42:20 +01:00
Joyee Cheung 4ad00d1994 tools: add a workflow to send reminder about v8 backports
This workflow detects whether the PR is a V8 backport and remind
the author to wait for the next V8 major upgrade unless they can
justify the fast-tracking following the documented criteria.
It also checks if the v8_embedder_string is properly bumped.
To avoid the noise, it also allows the use of a label
`v8-backport-to-main` added at PR open time to surpress the check.

Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67436
Fixes: https://github.com/nodejs/node/issues/66393
Refs: https://github.com/nodejs/node/pull/66710
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-19 15:42:20 +01:00
emyeiandTim Perry 67ae162800 http: forward-port the pending-read fix for CVE-2026-105481
The Agent data guard only runs once the event loop polls for I/O. Data
that reaches an idle kept-alive socket's OS buffer right before that
poll can be handed to the next request as if it were that request's
own response (response-queue poisoning).

Commit 0683ee5f ("http: ensure agent data guard works without I/O",
CVE-2026-105481) fixed this by checking the OS directly via a new
LibuvStreamWrap::HasPendingRead before reusing a free socket. It
landed in lib/_http_agent.js on the release branches (shipped in
v26.12.1) but was never forward-ported after PR #58535 moved the Agent
implementation to lib/internal/http/agent.js on main five days
earlier. As a result, main (and any v27 nightly built from it) lost
the protection even though every supported release line (22.x/24.x/
26.x) still has it.

This restores the complete fix on main:
- lib/internal/http/agent.js: re-add the hasPendingRead() helper and
  its two call sites (the free socket handed to a queued request, and
  the free-pool socket selected in addRequest), ported 1:1 to the
  current structure of the file.
- lib/internal/tls/wrap.js, src/stream_wrap.cc/.h: unchanged from the
  original fix, which already applies cleanly on main.
- test/parallel/test-http-agent-free-socket-pending-read.js: restore
  the regression test covering both assignment paths, so the fix
  cannot be silently dropped again by a future refactor.

Fixes: https://hackerone.com/reports/4038361
CVE-ID: CVE-2026-105481

Co-authored-by: Tim Perry <pimterry@gmail.com>
Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67073
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-19 15:42:20 +01:00
Ilyas Shabi 94e1e1ddfb 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-19 15:42:20 +01:00
Node.js GitHub Bot 645be14fcb deps: update zlib to 1.4-ec453dc
PR-URL: https://github.com/nodejs/node/pull/67475
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-19 15:42:20 +01:00
Node.js GitHub Bot de52e06e41 deps: update libffi to 3.8.1
PR-URL: https://github.com/nodejs/node/pull/67476
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-11-19 15:42:20 +01:00
Node.js GitHub Bot a8944e6405 deps: update googletest to e882c36410197464e3429546e6a7d5e217bde51e
PR-URL: https://github.com/nodejs/node/pull/67477
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-19 15:42:20 +01:00
Node.js GitHub Bot 41c0b95607 tools: update nixpkgs-unstable to 2074cc672349f14240fb7ea90d509e0b643
PR-URL: https://github.com/nodejs/node/pull/67478
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-11-19 15:42:19 +01:00
Node.js GitHub Bot 00fec20b5a deps: patch V8 to 15.6.75.60
Refs: https://github.com/v8/v8/compare/15.6.75.50...15.6.75.60
PR-URL: https://github.com/nodejs/node/pull/67479
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-11-19 15:42:19 +01:00
Matteo Collina e6eb31804e http2: do not end compat requests reset before END_STREAM
When the peer reset a stream before sending END_STREAM, the compat
`Http2ServerRequest` still pushed EOF from its 'close' handler, so it
emitted 'end' for a truncated body (on main even after 'error' and
'close'). Unlike http1, where an aborted `IncomingMessage` is destroyed
and never emits 'end', applications listening for 'end' then processed
the partial body as if it were complete.

Record in `onStreamClose()` that the peer closed the stream before
END_STREAM, since `destroy()` ends the readable side afterwards, and
destroy the request instead of ending it in that case. Requests whose
body was complete before the reset still end normally.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67061
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-19 15:42:19 +01:00
Joyee Cheung 6cd8f45028 build: fix GCC warnings when building V8 with gnu++20
This silences the following warning from GCC:

- deps/v8/src/base/flags.h: call to non-constexpr function
  `std::__atomic_base<unsigned char>::operator unsigned char() const`
  in the defaulted `constexpr Flags::operator==` when instantiated
  with `std::atomic<uint8_t>` storage [-Winvalid-constexpr]
- deps/v8/include/v8-wasm.h: call to non-constexpr function
  `std::unique_ptr<const unsigned char[]>::get() const` in
  `constexpr OwnedBuffer::as_span()` [-Winvalid-constexpr]
- deps/v8/src/execution/simulator.h: ‘nodebug’ attribute directive
  ignored [-Wattributes]

Also move -fvisibility-inlines-hidden from cflags to cflags_cc in
tools/v8_gypfiles/v8.gyp to fix the following warning.

  cc1: warning: command-line option '-fvisibility-inlines-hidden' is
  valid for C++/ObjC++ but not for C

Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67279
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Stewart X Addison <sxa@redhat.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-19 15:42:19 +01:00
Matteo Collina 52c421872a stream: use distinct webstreams brand checks
The brand checks were closures returned by one isBrandCheck() factory.
Closures of the same function literal share their feedback vector, so
the kState and kType loads in every check saw all the stream classes
and went megamorphic. Declare each check as its own function.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67433
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-11-19 15:42:19 +01:00
Marten Richter a4d6596b44 quic: create gen. getWriter for stream/iter
The get writer method of QuicStream is mostly
generell enough to be usuable in other contexts.
This PR is an attempt to move the code out
of the QuicStream object to be usuable in other
parts of node.js.

Fixes #66508

Signed-off-by: Marten Richter <marten.richter@freenet.de>
PR-URL: https://github.com/nodejs/node/pull/66513
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-19 15:42:19 +01:00
Tim Perry 8eae7e4a11 quic: fix edge cases where stream FIN would be lost
Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66759
Reviewed-By: Efe Karasakal <hi@efe.dev>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-19 15:42:19 +01:00
Tim Perry 73f7796c35 quic: fix per-session SSL leak
Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66730
Reviewed-By: Efe Karasakal <hi@efe.dev>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-19 15:42:15 +01:00
James M Snell ee149feeee 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-19 15:42:15 +01:00
Aliaksandranddevholic22 3156f855c0 test_runner: remove failure attribute from JUnit reporter
This commit aligns the Node.js test runner's JUnit XML output with the
official JUnit specification by removing the non-standard failure
attribute from elements.

Signed-off-by: Aliaksandr <42497203+AlexCannonball@users.noreply.github.com>
Co-authored-by: devholic22 <hyunjoon.tech@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66072
Fixes: https://github.com/nodejs/node/issues/59593
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-11-19 15:42:15 +01:00
Ved Chaudhari 9a8fe74549 buffer: stop clamping indexOf byteOffset to int32
bidirectionalIndexOf() clamped byteOffset to the int32 range, so on
buffers larger than 2 GiB an offset above 2 ** 31 - 1 started the
search at 2 ** 31 - 1 instead. indexOf() and includes() could then
match before the requested offset, and lastIndexOf() missed matches.
Offsets below -(2 ** 31) were clamped the same way.

The binding already takes an int64 offset, so clamp to the safe
integer range instead. This still keeps Infinity and other values
that int64 can't represent from reaching the binding.

Fixes: https://github.com/nodejs/node/issues/67008
Refs: https://github.com/nodejs/node/pull/66325
Assisted-by: claude:opus-5.5
Signed-off-by: vedchaudhari <vedc2853@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67009
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2026-11-19 15:42:15 +01:00
sangwook 7be00a936d 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-19 15:42:15 +01:00
Roberto Bianchi 4df7015560 util: use indexed writes in Set and Map inspection
Avoid the cost of primordial push calls for each formatted entry.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
PR-URL: https://github.com/nodejs/node/pull/67295
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-19 15:42:14 +01:00
LiviaMedeiros 189e0f1d21 test: remove unnecessary imports for TextDecoder and 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-19 15:42:14 +01:00
LiviaMedeiros 472f4b45a5 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-19 15:42:14 +01:00
LiviaMedeiros 922140626b 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-19 15:42:14 +01:00
LiviaMedeiros 5e297a0843 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-19 15:42:14 +01:00
Matteo Collina add0fde1d1 tls: normalize session buffer views
Client sessions can be supplied as ArrayBuffer views, but session state
checks only recognize Buffers. Normalize views to Buffers before
applying those checks, preserving their byte offset and length.

This hardens session reuse handling and keeps tagged sessions reusable
when stored as typed arrays.

Assisted-by: Codex
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67251
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-19 15:42:14 +01:00
Roberto Bianchi f82c9d3200 lib: use indexed appends for dependent signals
Avoid a primordial push call for each dependent signal.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
PR-URL: https://github.com/nodejs/node/pull/67299
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-19 15:42:14 +01:00
Hilary Asogwa f4bdf9bdcf url: validate href setter receiver first
Validate the URL receiver before converting the assigned href value.

Fixes: https://github.com/nodejs/node/issues/67344
Signed-off-by: dansatch <dansatch98@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67350
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-19 15:42:14 +01:00
Gürgün Dayıoğlu 399228bd0f fs,path: fix glob globstar section bounds
The last start index of each globstar-delimited body section was
computed from the non-globstar prefix counts in reverse order. When
sections have different lengths, the bound is too tight, so paths
such as `a/b/c/d/e` failed to match `**/a/b/c/**/d/**`. This affected
`path.matchesGlob()` and `exclude` patterns in `fs.glob()`.

Compute the bound from the number of non-globstar parts in the
section and every section after it.

Signed-off-by: Gürgün Dayıoğlu <hey@gurgun.day>
PR-URL: https://github.com/nodejs/node/pull/66738
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Efe Karasakal <hi@efe.dev>
2026-11-19 15:42:14 +01:00
Livia Medeiros 50aa231615 util: use Map.prototype.getOrInsert() in circular reference formatting
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67451
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2026-11-19 15:42:14 +01:00