Commit Graph
49414 Commits
Author SHA1 Message Date
Daijiro Wachi ffed2aa208 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-11 17:20:34 +01:00
Yuya Inoue 7667a8fd5b test: deflake test-runner-mock-timers-scheduler
The first test case checked that the mocked `scheduler.wait(4000)`
resolved within 100ms of real wall-clock time. On slow or busy CI
machines the time between `Date.now()` and the promise callback can
exceed 100ms even though the mock works, so the test failed with
"time should be advanced less than the 100ms".

Replace the wall-clock assertion with a deterministic check: after
`tick(4000)`, wait one turn of the event loop and assert the promise
has settled. A real 4000ms timer cannot fire within that window, so
the check still proves the mocked timer was used. This matches how the
other cases in the file verify the mock.

Refs: https://github.com/nodejs/reliability/issues/1354
Refs: https://github.com/nodejs/reliability/issues/1278
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67296
Refs: https://github.com/nodejs/node/actions/runs/42153384377
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-11-11 17:20:33 +01:00
Yuya Inoue b7aab20d60 build: separate host and target Rust artifacts in cross builds
Capture the Rust target and host triples during configure for bundled
Temporal cross builds. Use explicit Cargo targets and separate output
directories so host and target archives do not share a build rule.

If the triples cannot be determined, disable Temporal with a warning
unless it was explicitly enabled.

Fixes: https://github.com/nodejs/node/issues/66897
Refs: https://github.com/nodejs/node/issues/66803
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66823
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-11-11 17:20:33 +01:00
Brad Anderson d02681572b crypto: fix ncrypto provider behavior
Honor requested primality check counts with provider-backed OpenSSL.

Support empty passphrases for encrypted SEC1 PEM output.

Assisted-by: Codex
Signed-off-by: Brad Anderson <brad@sankatygroup.com>
PR-URL: https://github.com/nodejs/node/pull/67039
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-11 17:20:33 +01:00
Trivikram Kamat 8570dfe348 ffi: reject multi-argument buffer fast trampolines
The arm64 and x86_64 SysV emitters convert each buffer argument with a
helper call after loading earlier arguments into their target registers.
The call clobbers those registers, so the target would receive wrong
values for every argument before the buffer.

This is not reachable today: buffer-typed trampolines are generated only
for single-argument signatures. Reject other shapes in the emitters so a
future caller falls back instead of miscompiling.

Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
Assisted-by: claude:opus-5.5
PR-URL: https://github.com/nodejs/node/pull/67046
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-11-11 17:20:33 +01:00
Antoine du Hamel 576eef4d80 tools: use vendored trust store in shell.nix
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67318
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-11-11 17:20:33 +01:00
Matteo Collina 40764cfdbe tls: reject hostnames with forbidden code points
domainToASCII() is implemented with the URL host parser, which stops at
path, query and fragment delimiters and percent-decodes. Passing a
hostname through it can therefore silently shorten the name, so
checkServerIdentity() validates a certificate against a host the
application never asked for: name resolution and SNI use the original
string, while the certificate is matched after normalization. Reject
hostnames containing a WHATWG forbidden host code point before matching.
None of these code points is valid in a DNS hostname, so failing closed
is safe.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67254
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-11 17:20:33 +01:00
Matteo Collina 2bbcfa0718 worker: preload streams into startup snapshot
Worker stdio loads stream after restoring the main-thread context,
initializing its constructors and prototype methods on every startup.
Preload stream during snapshot construction so workers can restore that
initialized state instead. Worker-specific stdio instances and message
ports are still created at runtime.

Verify snapshot membership, stdio methods, and isolation from
parent-thread stream mutations.

Assisted-by: pi
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/66311
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2026-11-11 17:20:33 +01:00
Matteo Collina 9d86291e8b stream: trim webstreams sink wrappers and BYOB transfers
The close and abort methods of an underlying sink and the flush and
cancel methods of a transformer were each wrapped at construction in an
async closure that the controller kept for the stream's lifetime: two
per WritableStream and two per TransformStream, each with its context.
Store these one-shot methods as-is in the controller state next to the
object they belong to, and call them as that object's methods with the
spec's argument list through a promiseCall helper that keeps the
reference implementation's adoption ticks. The per-chunk methods (write,
transform) keep their closures, which make the method a constant for the
optimizing compiler on the hot paths; so does the source's cancel
wrapper, since the readable stream's construction path is sensitive to
any change in its inlining budget.

In the byte controller, the transfer of a pull-into descriptor's buffer
when it is committed is dropped: nothing can reach that buffer any more,
since it was transferred when the descriptor was created and the BYOB
request that exposed it is only ever invalidated together with a
transfer. The transfer of the first pending descriptor's buffer on
enqueue is likewise only needed while a BYOB request exposes it.
Allocating an ArrayBuffer costs about half a microsecond, so those two
transfers were a large part of a BYOB read.

Bytes allocated per stream with user methods: WritableStream 1040 ->
844, TransformStream 1816 -> 1720. The microtask ordering of every user
method call is unchanged.

Benchmark results (20 runs, vs. the previous commit):

    webstreams/readable-read.js type='byob' n=100000           ***   17.14 %  ±1.80%
    webstreams/readable-async-iterator.js type='normal' n=100000        3.79 %  ±4.49%
    webstreams/from.js kind='sync' n=1000000                     *   -2.18 %  ±2.02%
    webstreams/js_transfer.js n=10000 payload='TransformStream'   *   -1.85 %  ±1.58%

The other 42 rows are within their confidence intervals; the two rows at
the 5% level are the expected number of false positives for 46
comparisons.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/66702
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-11-11 17:20:33 +01:00
Matteo Collina 8ffcb3ee55 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-11 17:20:32 +01:00
Matteo Collina d6b8579deb test: deflake test-worker-eventlooputil
worker.performance.eventLoopUtilization() reads the worker's idle time
before the current time. If the parent thread stalls between the two
reads while the worker is idle, the stall is counted as worker active
time in the first sample and is missing from the delta, so the 50ms
spin can be reported as slightly less than 50ms.

Bound that skew by timing the first workerELU() call.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67260
Refs: https://github.com/nodejs/reliability/issues/1482
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-11-11 17:20:32 +01:00
Yuya Inoue 829afea634 build: refresh markdown lint dependencies on lockfile changes
Reinstall markdown lint dependencies when the lockfile changes and
recheck all Markdown files with the updated rules.

Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67185
Refs: https://github.com/nodejs/node/pull/67023
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2026-11-11 17:20:32 +01:00
Yuya Inoue e1ae779fec http2: preserve multiple content-encoding values
Remove content-encoding from the single-value field set so incoming
values are joined in order and outgoing arrays are accepted.

Update the header documentation and add coverage for requests and
responses, including repeated codings and strict validation options.

For repeated fields, the incoming value now includes every coding
instead of only the first. Outgoing arrays no longer throw
ERR_HTTP2_HEADER_SINGLE_VALUE by default.

Fixes: https://github.com/nodejs/node/issues/67151
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67184
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-11 17:20:32 +01:00
Jay 030c9536ab test: skip readFileSync pipe test without proc io
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/67242
Reviewed-By: Stewart X Addison <sxa@redhat.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
2026-11-11 17:20:32 +01:00
Yuya Inoue ace3168084 tools: use ubuntu-latest for public lint-js-and-md jobs
Use ubuntu-latest in public repositories to reduce runtime and
provide more headroom when the ESLint cache cannot be restored.

Keep ubuntu-slim in private repositories to avoid increasing
runner costs.

Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66409
Refs: https://github.com/nodejs/node/issues/64972
Reviewed-By: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2026-11-11 17:20:32 +01:00
Guilherme Araújo 1774391f3e sqlite: add ReadOptionalString helper
Use it for the dbName, table, db, source and target options so they
all treat a missing or undefined value as the default. Also mark
ReadOptionalBool and ReadOptionalString as [[nodiscard]].

Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67042
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-11 17:20:32 +01:00
manjit singh c685695fae doc: clarify process.loadEnvFile variable precedence (#66315)
Signed-off-by: manjit <manjitcse@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67276
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2026-11-11 17:20:32 +01:00
Node.js GitHub Bot 0c0d945a18 deps: update undici to 8.12.4
PR-URL: https://github.com/nodejs/node/pull/67272
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
2026-11-11 17:20:31 +01:00
junyup0503 6c9747ff7b http: emit 'drain' after flushing coalesced chunks
Since chunked writes are coalesced while the message is corked,
write() decides backpressure from the byte length of the buffered
chunks and sets kNeedDrain. When uncork() flushes them, net.Socket
accounts string chunks in UTF-16 code units, so with multi-byte text it
can stay below its own highWaterMark. It then never needs to drain and
never emits 'drain'. If the flushed writes complete asynchronously, the
check at the end of uncork() also runs while bytes are still pending,
so the response stalls with writableNeedDrain === true and
writableLength === 0.

Re-check the drain condition once the flushed data has been written,
unless the message or its socket has been destroyed in the meantime.

Fixes: https://github.com/nodejs/node/issues/66781
Refs: https://github.com/nodejs/node/pull/64987
Assisted-by: AI coding agent
Signed-off-by: junyup0503 <97156898+junyup0503@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/66782
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2026-11-11 17:20:31 +01:00
Antoine du Hamel 7b5b6fb2a3 test: fix test-config-json-schema with --openssl-use-def-ca-store
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67200
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-11-11 17:20:31 +01:00
npm CLI robot 4cc7d1bea6 deps: upgrade npm to 12.2.2
PR-URL: https://github.com/nodejs/node/pull/67265
Reviewed-By: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-11-11 17:20:31 +01:00
Qingyu Wang 58eb15cd6b stream: fix pipeTo assert when writer is released during microtask
pipeTo defers each slow-path write to a microtask so it does not run
synchronously during enqueue(). A race allows the pipe to shut down and
release its writer after the write is scheduled but before it runs. The
deferred write then hits an ERR_INTERNAL_ASSERTION because
writer[[stream]] is undefined.

Skip the deferred write when shutdown has already started.

Fixes: https://github.com/nodejs/node/issues/63732
Signed-off-by: Qingyu Wang <wangqingyu.c0l1n@bytedance.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/63733
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-11 17:20:31 +01:00
Aviv Keller 8163152f5d test: use experimental flags in wpt tests
Signed-off-by: avivkeller <me@aviv.sh>
PR-URL: https://github.com/nodejs/node/pull/67258
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-11 17:20:31 +01:00
Filip Skokan e858561f1a test: use valid PBKDF2 inputs in domain test
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67250
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-11 17:20:31 +01:00
Guilherme Araújo 0b223c67ec sqlite: use 64-bit result APIs for UDF return values
JSValueToSQLiteResult() passed the size_t length of returned
ArrayBuffers and ArrayBufferViews to sqlite3_result_blob(), which
takes an int. Buffers larger than INT_MAX bytes were narrowed,
yielding silently truncated blobs or bogus empty text values.

Use sqlite3_result_blob64() and sqlite3_result_text64(), matching
Statement::BindValue(), so oversized values are rejected with
SQLITE_TOOBIG.

Assisted-by: Claude Code
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67089
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-11 17:20:31 +01:00
Christian Aurich Zanettini Martins 819d9fdce6 watch: track all dependencies of an owner
filterFile() reads #ownerDependencies with the dependency path, but
writes the set back keyed by the owner, so each call starts a fresh set
and overwrites the previous one. An owner keeps only the last
dependency registered for it.

unfilterFilesOwnedBy() walks that set to release an owner's
dependencies, so every other one stays in #filteredFiles and
#dependencyOwners. Under `node --test --watch` a restart re-reports the
modules the test still loads, which hides it for those, but a
dependency it stopped requiring is never reported again and keeps
re-running the test.

Read #ownerDependencies with the key it is written with, and collapse
the repeated #dependencyOwners lookup in the loop, which now runs once
per dependency rather than once per owner.

Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66139
Refs: https://github.com/nodejs/node/pull/45214
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-11-11 17:20:30 +01:00
Antoine du Hamel 02f6efa9ed doc: fix security pre-alert template
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67240
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-11-11 17:20:30 +01:00
Filip Skokan d9292c4a93 build: sync Torque outputs with V8
15.2 removed the per-source .inc files and replaced bit-fields.h with
bit-field-asserts.cc.

Refs: https://github.com/nodejs/node/pull/65161
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67238
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2026-11-11 17:20:30 +01:00
Matteo Collina 0c4d131adf crypto: prevent stale OpenSSL errors
Clear errors raised by key comparison, SPKAC parsing, and JWK
import. Ensure TLS and private-key parsing only inspect errors
from their own OpenSSL calls.

Assisted-by: Codex
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67225
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-11 17:20:30 +01:00
Trivikram Kamat a1bdd2dbbd ffi: reject signature conflicts from getFunctions getters
A signature getter could request an earlier symbol with a different
signature, making getFunctions() return a wrapper with that signature.
Recheck pending functions before caching them, and throw on a mismatch.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: claude:opus-5.5
PR-URL: https://github.com/nodejs/node/pull/67194
Fixes: https://github.com/nodejs/node/issues/67192
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-11-11 17:20:30 +01:00
Orgad Shaneh 2360d3860e dns: coalesce identical concurrent lookup() requests
When multiple callers issue dns.lookup() for the same (hostname, family,
hints, order) concurrently, only one getaddrinfo call is now dispatched
to the libuv threadpool.  All callers share the result.

getaddrinfo is a blocking call that runs on the libuv threadpool (capped
at 4 threads by default, with a slow I/O concurrency limit of 2).  When
DNS resolution is slow - e.g. ~10-20 s per call due to a misbehaving
resolver - identical requests queue behind each other, causing timeouts
that grow linearly with the number of concurrent callers:

  Before: 100 parallel lookup('host') -> 50 batches × 10 s = 500+ s
  After:  100 parallel lookup('host') -> 1 getaddrinfo  call = ~10 s

This is particularly severe on WSL, where the DNS relay rewrites QNAMEs
in responses (appending the search domain), causing glibc to discard
them as non-matching and wait for a 5s timeout per retry.

The coalescing is keyed on (hostname, family, hints, order) so lookups
with different options still get separate getaddrinfo calls.  Each
caller independently post-processes the shared raw result (applying the
'all' flag, constructing address objects, etc.).

Signed-off-by: Orgad Shaneh <orgad.shaneh@audiocodes.com>
Fixes: https://github.com/nodejs/node/issues/62503
PR-URL: https://github.com/nodejs/node/pull/62599
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-11 17:20:30 +01:00
Paul Bouchon 96384231d5 doc: fix execFile/execFileSync shell option docs
The `shell` option for `execFile()` and `execFileSync()` was described
as running `command` inside a shell, but those functions take a `file`
argument, not `command`. The text was copied from `exec()`/`spawn()`.

The note under `execFile()` also read "Since a shell is not spawned,
behaviors such as I/O redirection and file globbing are not supported",
which contradicts the preceding sentence that the same options as
`exec()` (including `shell`) are supported. Change "Since" to "If" so it
only applies when no shell is spawned.

Fixes: https://github.com/nodejs/node/issues/32524
Signed-off-by: Paul Bouchon <mail@bitpshr.net>
PR-URL: https://github.com/nodejs/node/pull/64437
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-11 17:20:30 +01:00
Filip Skokan edb6ab2fcc tools: warn when undici WPT report is missing
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67229
Refs: https://github.com/nodejs/undici/pull/6152
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-11-11 17:20:30 +01:00
Matteo Collina 91a070d1d7 http2: handle errors on compat push response streams
`response.createPushResponse()` wrapped the pushed stream in an
`Http2ServerResponse` without attaching an 'error' listener. Request
streams get one from `Http2ServerRequest`, but pushed streams have no
request, so a peer refusing the push with a non-clean RST_STREAM code
(e.g. REFUSED_STREAM) before the response finished emitted an unhandled
'error' on `response.stream` unless the application listened on it.

Attach `onStreamError` to the pushed stream before invoking the
callback, and make `onStreamError` tolerate the `null` request that
core sets on every stream.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67053
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-11 17:20:30 +01:00
Roberto Bianchi 236355a392 querystring: precompute Latin-1 escapes
Reuse precomputed escapes for Latin-1 characters instead of joining
two byte escapes on every occurrence. This reduces repeated work
when querystring and URLSearchParams serialize these characters.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
PR-URL: https://github.com/nodejs/node/pull/66756
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-11 17:20:29 +01:00
Guilherme Araújo 6b8a90d41d http: batch body spans per parser execute
Buffer body spans in on_body() and deliver them to JS once per
execute() call instead of once per chunk. A body sent as many small
chunks no longer costs one C++ to JS call and Buffer per chunk.

Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67187
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-11 17:20:29 +01:00
Yuya Inoue 9fca7e78bd build: use a single producer for shared generated files
Cross builds instantiate several shared generation actions in both
toolsets, producing duplicate output rules that Ninja rejects.

Register these actions once in the target toolset and explicitly share
them with host consumers. Keep generator executables in the host toolset
for cross builds.

Refs: https://github.com/nodejs/node/issues/66803
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66804
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-11-11 17:20:29 +01:00
Livia Medeiros 1cc7ddc89f lib: replace Kahan summation with MathSumPrecise
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67222
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2026-11-11 17:20:29 +01:00
Yagiz Nizipli 8ed89aad0b test: cover crypto digest and HMAC caches
Check that HMAC instances duplicated from the same cached context stay
independent when their updates are interleaved, and that warmed digest
and HMAC caches follow FIPS mode changes without breaking an HMAC that
is already in progress.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Assisted-by: Grok
PR-URL: https://github.com/nodejs/node/pull/67109
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-11 17:20:29 +01:00
Yagiz Nizipli 33d28a1fed crypto: reuse HMAC contexts in createHmac()
Every HMAC context was created with EVP_MAC_fetch() and keyed with the
digest passed by name, so the provider fetched the digest again on
each init. Both lookups go through OpenSSL's method store.

Keep an HMAC context without a key for each digest in the
per-Environment digest cache, and duplicate it in createHmac(). A
duplicated context already has its digest, so keying it with the same
digest no longer fetches anything.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Assisted-by: Grok
PR-URL: https://github.com/nodejs/node/pull/67109
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-11 17:20:29 +01:00
Yagiz Nizipli b9248dc829 crypto: skip clearing empty OpenSSL error queues
ClearErrorOnReturn calls ERR_clear_error() when it is created and
again when it goes out of scope. That function resets all 16 slots of
the thread's error queue, including two free() calls per slot, even
when the queue is empty, which is almost always the case. Check for a
queued error first, which costs a fraction of that.

ClearErrorOnReturn guards most crypto operations, including every
CryptoJob, so this applies to all of them.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Assisted-by: Grok
PR-URL: https://github.com/nodejs/node/pull/67109
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-11 17:20:29 +01:00
Yagiz Nizipli 216f1238cd crypto: cache digests for synchronous operations
createHmac(), createSign(), createVerify() and the synchronous
one-shot sign, verify, HKDF and PBKDF2 functions looked up their
digest with Digest::FromName(). That returns OpenSSL's legacy EVP_MD,
so every EVP_DigestInit_ex() and HMAC init had to fetch the provider
implementation again through the method store.

Look these digests up through the per-Environment cache that
createHash() and crypto.hash() already use. Jobs on the thread pool
keep using Digest::FromName(): with the cache, Web Crypto digest and
HMAC throughput went down, because workers that finish sooner have to
be woken up for each new job more often.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Assisted-by: Grok
PR-URL: https://github.com/nodejs/node/pull/67109
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-11 17:20:29 +01:00
Joyee Cheung 464ab31405 src: do not enable the inspector during snapshot building
V8 no longer allows attaching a debuger or setting a debug context ID
during snapshot building. Avoid enabling the inspector in this case,
and reject the inspector options when the user-land --build-snapshot
is used.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/8679045
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67154
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
2026-11-11 17:20:29 +01:00
Stefan Stojanovic 823549f0da build,win: minify pgo training build
Signed-off-by: StefanStojanovic <stefan.stojanovic@janeasystems.com>
PR-URL: https://github.com/nodejs/node/pull/67214
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-11-11 17:20:28 +01:00
Roberto Bianchi e2bf68811e url: use indexed appends in search params getAll
Use indexed writes when collecting matching parameter values.
This improves getAll throughput without changing result order.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
PR-URL: https://github.com/nodejs/node/pull/66872
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-11 17:20:28 +01:00
Shelley Vohr 5848a08450 build: sort the ICU source lists
configure.py lists the ICU source files in the order os.walk() returns
them, which depends on the file system. That order ends up in
icu_config.gypi and in the generated build files, so it differs between
machines.

Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67206
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-11 17:20:28 +01:00
Damiano Mazzella e64878bd2b ffi: support function calls from pointers
Add getFunctionFromPointer() to create callables from native addresses
with explicit signatures.

Reuse function preparation without populating named symbol caches.
Keep the associated library alive and invalidate pointer callables
when it is closed.

Add coverage for conversions, vtables, permissions and garbage
collection, and document pointer lifetime requirements.

Assisted-by: GitHub Copilot
Signed-off-by: Damiano Mazzella <damianomazzella@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66458
Fixes: https://github.com/nodejs/node/issues/66272
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-11 17:20:28 +01:00
Yuya Inoue ce1da53916 doc: document C++ formatting in the pull request guide
Document formatter setup and usage separately from make lint so
contributors can catch C/C++ formatting issues before CI runs.

Refs: https://github.com/nodejs/node/pull/66834#issuecomment-6583209249
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67205
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2026-11-11 17:20:28 +01:00
Yuya Inoue 8d45d5b69e http2: exclude queued data from response memory checks
Allow clients to receive responses when queued request data exceeds
maxSessionMemory, while preserving limits on received headers.

Fixes: https://github.com/nodejs/node/issues/66739
Refs: https://github.com/nodejs/node/pull/67113
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67114
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-11 17:20:28 +01:00
Filip Skokan 5991efaf17 crypto: skip DH checks for recognized groups
Explicit DH parameters are recognized as named groups during OpenSSL
provider import, but DHPointer::check() only skips primality checks for
groups constructed by name. This makes createDiffieHellman() block for
seconds on standard MODP groups.

Query the imported key's group name to restore the legacy DH_check()
shortcut without changing key generation. Add a deterministic regression
test with randomness disabled and cover explicit and padded parameters
through the JavaScript API.

Fixes: https://github.com/nodejs/node/issues/67067
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67071
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-11-11 17:20:28 +01:00