🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
build(docker): rebuild Red Hat's nodejs:24 RPMs with Node 24.22.1 security fixes (#19405)
Steffen Reutherf0f65b838a33
diff --git a/.codespellrc b/.codespellrcindex 6fcafd986c..b43b9e8cb3 100644--- a/.codespellrc+++ b/.codespellrc@@ -1,4 +1,4 @@[codespell]skip = .git,*.pdf,*.svg,package-lock.json,*.prisma,pnpm-lock.yaml,./worker/src/__tests__/chatml/framework-traces-ignore-words-list = afterall,vertx,notIn,alue,allTime,rouge,froms+ignore-words-list = afterall,vertx,notIn,alue,allTime,rouge,froms,gagediff --git a/.github/workflows/nodejs-rpm.yml b/.github/workflows/nodejs-rpm.ymlnew file mode 100644index 0000000000..0b9d943086--- /dev/null+++ b/.github/workflows/nodejs-rpm.yml@@ -0,0 +1,143 @@+name: Build nodejs RPM++# TEMPORARY(node-24.22.1-security): builds Red Hat's nodejs:24 RPMs with fixes+# from Node 24.22.1 (scripts/docker/nodejs-rpm/) and publishes them as a multi-arch image for+# web/Dockerfile and worker/Dockerfile. Delete together with that directory.+#+# Pull requests build and verify without publishing. Pushes to main and manual+# runs publish ghcr.io/langfuse/langfuse-nodejs-rpm; pin the digest from the+# job summary in both Dockerfiles' NODEJS_RPM_IMAGE.++on:+ workflow_dispatch:+ pull_request:+ paths:+ - scripts/docker/nodejs-rpm/**+ - .github/workflows/nodejs-rpm.yml+ push:+ branches:+ - main+ paths:+ - scripts/docker/nodejs-rpm/**+ - .github/workflows/nodejs-rpm.yml++permissions: {}++concurrency:+ group: nodejs-rpm-${{ github.ref }}+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}++env:+ IMAGE: ghcr.io/langfuse/langfuse-nodejs-rpm+ TAG: 24.21.0-1.lf1++jobs:+ build:+ name: build (${{ matrix.platform_tag }})+ # A cold build compiles Node and V8 and runs the spec's %check suite.+ timeout-minutes: 240+ runs-on: ${{ matrix.runner }}+ permissions:+ contents: read+ packages: write+ strategy:+ fail-fast: false+ matrix:+ include:+ - platform: linux/amd64+ platform_tag: amd64+ runner: blacksmith-32vcpu-ubuntu-2404+ - platform: linux/arm64+ platform_tag: arm64+ runner: blacksmith-32vcpu-ubuntu-2404-arm+ steps:+ - name: Checkout+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false+ - name: Log in to the GitHub Container registry+ if: github.event_name != 'pull_request'+ uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}+ - name: Setup Blacksmith Builder+ uses: useblacksmith/setup-docker-builder@1e75355f81cbb3f93cba1eb5dd5e5b05110ca8f9 # v2.0.1+ with:+ cache-key: langfuse/nodejs-rpm-${{ matrix.platform_tag }}+ - name: Build, verify and push by digest (${{ matrix.platform_tag }})+ id: build+ uses: useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2.2.0+ with:+ context: scripts/docker/nodejs-rpm+ platforms: ${{ matrix.platform }}+ # ~1.5 GB RAM per compile job; leaves headroom on 32 vCPU / 64 GB.+ build-args: |+ NODE_BUILD_JOBS=24+ outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || format('type=image,name={0},push-by-digest=true,name-canonical=true,push=true', env.IMAGE) }}+ provenance: false+ sbom: false+ - name: Record pushed digest+ if: github.event_name != 'pull_request'+ env:+ DIGEST: ${{ steps.build.outputs.digest }}+ PLATFORM_TAG: ${{ matrix.platform_tag }}+ run: |+ if [ -z "$DIGEST" ]; then+ echo "Missing digest output" >&2+ exit 1+ fi+ mkdir -p "$RUNNER_TEMP/digests"+ echo "$DIGEST" > "$RUNNER_TEMP/digests/${PLATFORM_TAG}.txt"+ - name: Upload digest+ if: github.event_name != 'pull_request'+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ with:+ name: nodejs-rpm-digest-${{ matrix.platform_tag }}+ path: ${{ runner.temp }}/digests/${{ matrix.platform_tag }}.txt+ if-no-files-found: error+ retention-days: 7++ publish:+ needs: build+ if: github.event_name != 'pull_request'+ runs-on: blacksmith-4vcpu-ubuntu-2404+ timeout-minutes: 10+ permissions:+ contents: read+ packages: write+ steps:+ - name: Log in to the GitHub Container registry+ uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}+ - name: Download digests+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1+ with:+ pattern: nodejs-rpm-digest-*+ merge-multiple: true+ path: ${{ runner.temp }}/digests+ - name: Publish multi-platform manifest+ run: |+ sources=()+ for digest_file in "$RUNNER_TEMP"/digests/*.txt; do+ sources+=("${IMAGE}@$(cat "$digest_file")")+ done+ if [ "${#sources[@]}" -ne 2 ]; then+ echo "Expected amd64 and arm64 digests, got ${#sources[@]}" >&2+ exit 1+ fi+ docker buildx imagetools create -t "${IMAGE}:${TAG}" "${sources[@]}"+ digest="$(docker buildx imagetools inspect "${IMAGE}:${TAG}" --format '{{json .Manifest}}' | jq -r .digest)"+ {+ echo "## nodejs RPM image"+ echo+ echo "Pin in web/Dockerfile and worker/Dockerfile:"+ echo+ echo '```dockerfile'+ echo "ARG NODEJS_RPM_IMAGE=${IMAGE}:${TAG}@${digest}"+ echo '```'+ } >> "$GITHUB_STEP_SUMMARY"diff --git a/scripts/docker/nodejs-rpm/0002-deps-brotli-CVE-2026-111497-block-switch.patch b/scripts/docker/nodejs-rpm/0002-deps-brotli-CVE-2026-111497-block-switch.patchnew file mode 100644index 0000000000..c9adb0a9e0--- /dev/null+++ b/scripts/docker/nodejs-rpm/0002-deps-brotli-CVE-2026-111497-block-switch.patch@@ -0,0 +1,237 @@+From 49dff6f57aa72cbbe13e480cd41ff4e46837c8fc Mon Sep 17 00:00:00 2001+From: Evgenii Kliuchnikov <[email protected]>+Date: Fri, 27 Feb 2026 05:10:32 -0800+Subject: [PATCH] deps: brotli: cherry-pick 0ed4268a4401abcb44720963++Original commit message:++ Detect and report invalid stream earlier.++ PiperOrigin-RevId: 876198329++PR-URL: https://github.com/nodejs-private/node-private/pull/1002+Reviewed-By: Matteo Collina <[email protected]>+CVE-ID: CVE-2026-111497+---+ deps/brotli/c/dec/decode.c | 87 ++++++++++++++++++---------+ deps/brotli/c/include/brotli/decode.h | 4 +-+ 2 files changed, 59 insertions(+), 32 deletions(-)++diff --git a/deps/brotli/c/dec/decode.c b/deps/brotli/c/dec/decode.c+index e87e7f5ea0f9..19c7e0283faa 100644+--- a/deps/brotli/c/dec/decode.c++++ b/deps/brotli/c/dec/decode.c+@@ -1176,7 +1176,7 @@ static BrotliDecoderErrorCode DecodeContextMap(brotli_reg_t context_map_size,++ /* Decodes a command or literal and updates block type ring-buffer.+ Reads 3..54 bits. */+-static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(++static BROTLI_INLINE BrotliDecoderErrorCode DecodeBlockTypeAndLength(+ int safe, BrotliDecoderState* s, int tree_type) {+ brotli_reg_t max_block_type = s->num_block_types[tree_type];+ const HuffmanCode* type_tree = &s->block_type_trees[+@@ -1187,7 +1187,7 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(+ brotli_reg_t* ringbuffer = &s->block_type_rb[tree_type * 2];+ brotli_reg_t block_type;+ if (max_block_type <= 1) {+- return BROTLI_FALSE;++ return BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH;+ }++ /* Read 0..15 + 3..39 bits. */+@@ -1197,11 +1197,13 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(+ } else {+ BrotliBitReaderState memento;+ BrotliBitReaderSaveState(br, &memento);+- if (!SafeReadSymbol(type_tree, br, &block_type)) return BROTLI_FALSE;++ if (!SafeReadSymbol(type_tree, br, &block_type)) {++ return BROTLI_DECODER_NEEDS_MORE_INPUT;++ }+ if (!SafeReadBlockLength(s, &s->block_length[tree_type], len_tree, br)) {+ s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;+ BrotliBitReaderRestoreState(br, &memento);+- return BROTLI_FALSE;++ return BROTLI_DECODER_NEEDS_MORE_INPUT;+ }+ }++@@ -1217,7 +1219,7 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(+ }+ ringbuffer[0] = ringbuffer[1];+ ringbuffer[1] = block_type;+- return BROTLI_TRUE;++ return BROTLI_DECODER_SUCCESS;+ }++ static BROTLI_INLINE void DetectTrivialLiteralBlockTypes(+@@ -1254,59 +1256,65 @@ static BROTLI_INLINE void PrepareLiteralDecoding(BrotliDecoderState* s) {++ /* Decodes the block type and updates the state for literal context.+ Reads 3..54 bits. */+-static BROTLI_INLINE BROTLI_BOOL DecodeLiteralBlockSwitchInternal(++static BROTLI_INLINE BrotliDecoderErrorCode DecodeLiteralBlockSwitchInternal(+ int safe, BrotliDecoderState* s) {+- if (!DecodeBlockTypeAndLength(safe, s, 0)) {+- return BROTLI_FALSE;++ BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 0);++ if (result != BROTLI_DECODER_SUCCESS) {++ return result;+ }+ PrepareLiteralDecoding(s);+- return BROTLI_TRUE;++ return BROTLI_DECODER_SUCCESS;+ }++-static void BROTLI_NOINLINE DecodeLiteralBlockSwitch(BrotliDecoderState* s) {+- DecodeLiteralBlockSwitchInternal(0, s);++static BROTLI_NOINLINE BrotliDecoderErrorCode++DecodeLiteralBlockSwitch(BrotliDecoderState* s) {++ return DecodeLiteralBlockSwitchInternal(0, s);+ }++-static BROTLI_BOOL BROTLI_NOINLINE SafeDecodeLiteralBlockSwitch(++static BROTLI_NOINLINE BrotliDecoderErrorCode SafeDecodeLiteralBlockSwitch(+ BrotliDecoderState* s) {+ return DecodeLiteralBlockSwitchInternal(1, s);+ }++ /* Block switch for insert/copy length.+ Reads 3..54 bits. */+-static BROTLI_INLINE BROTLI_BOOL DecodeCommandBlockSwitchInternal(++static BROTLI_INLINE BrotliDecoderErrorCode DecodeCommandBlockSwitchInternal(+ int safe, BrotliDecoderState* s) {+- if (!DecodeBlockTypeAndLength(safe, s, 1)) {+- return BROTLI_FALSE;++ BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 1);++ if (result != BROTLI_DECODER_SUCCESS) {++ return result;+ }+ s->htree_command = s->insert_copy_hgroup.htrees[s->block_type_rb[3]];+- return BROTLI_TRUE;++ return BROTLI_DECODER_SUCCESS;+ }++-static void BROTLI_NOINLINE DecodeCommandBlockSwitch(BrotliDecoderState* s) {+- DecodeCommandBlockSwitchInternal(0, s);++static BROTLI_NOINLINE BrotliDecoderErrorCode++DecodeCommandBlockSwitch(BrotliDecoderState* s) {++ return DecodeCommandBlockSwitchInternal(0, s);+ }++-static BROTLI_BOOL BROTLI_NOINLINE SafeDecodeCommandBlockSwitch(+- BrotliDecoderState* s) {++static BROTLI_NOINLINE BrotliDecoderErrorCode++SafeDecodeCommandBlockSwitch(BrotliDecoderState* s) {+ return DecodeCommandBlockSwitchInternal(1, s);+ }++ /* Block switch for distance codes.+ Reads 3..54 bits. */+-static BROTLI_INLINE BROTLI_BOOL DecodeDistanceBlockSwitchInternal(++static BROTLI_INLINE BrotliDecoderErrorCode DecodeDistanceBlockSwitchInternal(+ int safe, BrotliDecoderState* s) {+- if (!DecodeBlockTypeAndLength(safe, s, 2)) {+- return BROTLI_FALSE;++ BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 2);++ if (result != BROTLI_DECODER_SUCCESS) {++ return result;+ }+ s->dist_context_map_slice = s->dist_context_map ++ (s->block_type_rb[5] << BROTLI_DISTANCE_CONTEXT_BITS);+ s->dist_htree_index = s->dist_context_map_slice[s->distance_context];+- return BROTLI_TRUE;++ return BROTLI_DECODER_SUCCESS;+ }++-static void BROTLI_NOINLINE DecodeDistanceBlockSwitch(BrotliDecoderState* s) {+- DecodeDistanceBlockSwitchInternal(0, s);++static BROTLI_NOINLINE BrotliDecoderErrorCode++DecodeDistanceBlockSwitch(BrotliDecoderState* s) {++ return DecodeDistanceBlockSwitchInternal(0, s);+ }++ static BROTLI_BOOL BROTLI_NOINLINE SafeDecodeDistanceBlockSwitch(+@@ -1940,6 +1948,9 @@ static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(+ return BrotliCheckInputAmount(br);+ }+++/* NB: METHOD should return BROTLI_FALSE only in case there is not enough input;++ in case of "unsafe" execution, when input is guaranteed to be sufficient,++ result is ignored. */+ #define BROTLI_SAFE(METHOD) \+ { \+ if (safe) { \+@@ -1952,6 +1963,22 @@ static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(+ } \+ }+++/* NB: METHOD should return BROTLI_DECODER_SUCCESS, BROTLI_DECODER_ERROR_*, or++ BROTLI_DECODER_NEEDS_MORE_INPUT; the later two break the processing. */++#define BROTLI_SAFE_WITH_STATUS(METHOD) \++ { \++ BrotliDecoderErrorCode status; \++ if (safe) { \++ status = Safe##METHOD; \++ } else { \++ status = METHOD; \++ } \++ if (status != BROTLI_DECODER_SUCCESS) { \++ result = status; \++ goto saveStateAndReturn; \++ } \++ }+++ static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(+ int safe, BrotliDecoderState* s) {+ int pos = s->pos;+@@ -1991,7 +2018,7 @@ static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(+ goto saveStateAndReturn;+ }+ if (BROTLI_PREDICT_FALSE(s->block_length[1] == 0)) {+- BROTLI_SAFE(DecodeCommandBlockSwitch(s));++ BROTLI_SAFE_WITH_STATUS(DecodeCommandBlockSwitch(s));+ goto CommandBegin;+ }+ /* Read the insert/copy length in the command. */+@@ -2136,7 +2163,7 @@ static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(+ } else {+ /* Read distance code in the command, unless it was implicitly zero. */+ if (BROTLI_PREDICT_FALSE(s->block_length[2] == 0)) {+- BROTLI_SAFE(DecodeDistanceBlockSwitch(s));++ BROTLI_SAFE_WITH_STATUS(DecodeDistanceBlockSwitch(s));+ }+ BROTLI_SAFE(ReadDistance(s, br));+ }+@@ -2330,7 +2357,7 @@ static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(+ }++ NextLiteralBlock:+- BROTLI_SAFE(DecodeLiteralBlockSwitch(s));++ BROTLI_SAFE_WITH_STATUS(DecodeLiteralBlockSwitch(s));+ goto CommandInner;++ saveStateAndReturn:+@@ -2552,6 +2579,8 @@ BrotliDecoderResult BrotliDecoderDecompressStream(+ if (result != BROTLI_DECODER_SUCCESS) {+ break;+ }++ BROTLI_DCHECK(s->meta_block_remaining_len <=++ (int)BROTLI_BLOCK_SIZE_CAP);+ BROTLI_LOG_UINT(s->is_last_metablock);+ BROTLI_LOG_UINT(s->meta_block_remaining_len);+ BROTLI_LOG_UINT(s->is_metadata);+diff --git a/deps/brotli/c/include/brotli/decode.h b/deps/brotli/c/include/brotli/decode.h+index 8d436db733c9..10d01e3658b5 100644+--- a/deps/brotli/c/include/brotli/decode.h++++ b/deps/brotli/c/include/brotli/decode.h+@@ -85,9 +85,7 @@ typedef enum {+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_1, -14) SEPARATOR \+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_2, -15) SEPARATOR \+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, DISTANCE, -16) SEPARATOR \+- \+- /* -17 code is reserved */ \+- \++ BROTLI_ERROR_CODE(_ERROR_FORMAT_, BLOCK_SWITCH, -17) SEPARATOR \+ BROTLI_ERROR_CODE(_ERROR_, COMPOUND_DICTIONARY, -18) SEPARATOR \+ BROTLI_ERROR_CODE(_ERROR_, DICTIONARY_NOT_SET, -19) SEPARATOR \+ BROTLI_ERROR_CODE(_ERROR_, INVALID_ARGUMENTS, -20) SEPARATOR \diff --git a/scripts/docker/nodejs-rpm/0003-tls-CVE-2026-105483-ip-normalization-regression.patch b/scripts/docker/nodejs-rpm/0003-tls-CVE-2026-105483-ip-normalization-regression.patchnew file mode 100644index 0000000000..23e99a023e--- /dev/null+++ b/scripts/docker/nodejs-rpm/0003-tls-CVE-2026-105483-ip-normalization-regression.patch@@ -0,0 +1,113 @@+From de49c913f232fd9c216bf164818c87c0cb645b7b Mon Sep 17 00:00:00 2001+From: James M Snell <[email protected]>+Date: Sat, 19 Sep 2026 20:56:11 +0000+Subject: [PATCH] tls: fix ip normalization regression+MIME-Version: 1.0+Content-Type: text/plain; charset=UTF-8+Content-Transfer-Encoding: 8bit++The regression is a low-severity bug that's not easy to+exploit. Basically it just means the hostname check can+be bypassed.++Signed-off-by: James M Snell <[email protected]>+PR-URL: https://github.com/nodejs-private/node-private/pull/985+Reviewed-By: Robert Nagy <[email protected]>+Reviewed-By: Rich Trott <[email protected]>+Reviewed-By: Ulises Gascón <[email protected]>+CVE-ID: CVE-2026-105483+---+ lib/tls.js | 26 ++++++++----+ .../test-tls-check-server-identity.js | 41 ++++++++++++++++++++ 2 files changed, 60 insertions(+), 7 deletions(-)++diff --git a/lib/tls.js b/lib/tls.js+index a1d978c50f27..42562108eaa7 100644+--- a/lib/tls.js++++ b/lib/tls.js+@@ -456,14 +456,26 @@ exports.checkServerIdentity = function checkServerIdentity(hostname, cert) {+ let valid = false;+ let reason = 'Unknown reason';++- // An IP literal must not be IDNA-normalized: domainToASCII() returns '' for+- // an IPv6 literal (it is not a domain), so matching against the normalized+- // host would skip IP-SAN matching for IPv6 entirely. Match IP hosts against+- // the original hostname (net.isIP() rejects non-ASCII, so there is no IDNA+- // confusion to guard against here); the normalized form is kept for the+- // DNS-name path below.++ // Decide whether the host is an IP address by checking both forms of it,++ // because neither form is enough on its own:++ //++ // - The original hostname is needed for IPv6. domainToASCII() returns '' for++ // an IPv6 literal such as '::1' (it is not a domain).++ // - The normalized hostname is needed for hosts that net.isIP() rejects but++ // that normalize to an IPv4 address: '\uFF11\uFF12\uFF17.0.0.1' (fullwidth++ // digits), '127\u30020.0.1' (ideographic full stop) and '127.1' all become++ // '127.0.0.1'. The resolver treats them as that address too, so they must++ // be matched against IP SANs. Letting them fall through to the DNS-name++ // path would match an IP address against DNS names and the CN instead.++ let ip = '';+ if (net.isIP(hostname)) {+- valid = ips.includes(canonicalizeIP(hostname));++ ip = hostname;++ } else if (net.isIP(hostnameASCIIWithoutFQDN)) {++ ip = hostnameASCIIWithoutFQDN;++ }++++ if (ip) {++ valid = ips.includes(canonicalizeIP(ip));+ if (!valid) {+ reason =+ `IP: ${hostname} is not in the cert's list: ` + ips.join(', ');+diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js+index e21f39ccc763..61a2513f81d7 100644+--- a/test/parallel/test-tls-check-server-identity.js++++ b/test/parallel/test-tls-check-server-identity.js+@@ -394,6 +394,47 @@ const tests = [+ },+ error: 'IP: 127.0.0.1 is not in the cert\'s list: '+ },++ // A host that net.isIP() rejects but that normalizes to an IPv4 address is++ // an IP address, not a DNS name: it is matched against "IP Address:" SANs,++ // never against DNS names or the CN.++ {++ host: '\uFF11\uFF12\uFF17.0.0.1', // "127.0.0.1" with fullwidth digits.++ cert: { subjectaltname: 'DNS:127.0.0.1', subject: {} },++ error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: '++ },++ {++ host: '\uFF11\uFF12\uFF17.0.0.1',++ cert: { subjectaltname: 'DNS:*.0.0.1', subject: {} },++ error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: '++ },++ {++ host: '\uFF11\uFF12\uFF17.0.0.1',++ cert: { subject: { CN: '127.0.0.1' } },++ error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: '++ },++ {++ host: '\uFF11\uFF12\uFF17.0.0.1',++ cert: { subjectaltname: 'IP Address:127.0.0.1', subject: {} }++ },++ {++ host: '\uFF11\uFF12\uFF17.0.0.1',++ cert: { subjectaltname: 'IP Address:127.0.0.2', subject: {} },++ error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: 127.0.0.2'++ },++ {++ host: '127\u30020.0.1', // "127.0.0.1" with an ideographic full stop.++ cert: { subjectaltname: 'DNS:127.0.0.1', subject: {} },++ error: 'IP: 127\u30020.0.1 is not in the cert\'s list: '++ },++ {++ host: '127.1',++ cert: { subjectaltname: 'DNS:127.0.0.1', subject: {} },++ error: 'IP: 127.1 is not in the cert\'s list: '++ },++ {++ host: '127.1',++ cert: { subjectaltname: 'IP Address:127.0.0.1', subject: {} }++ },+ {+ host: 'localhost', cert: {+ subjectaltname: 'DNS:a.com',diff --git a/scripts/docker/nodejs-rpm/0004-tls-CVE-2026-106069-reject-non-canonical-ip.patch b/scripts/docker/nodejs-rpm/0004-tls-CVE-2026-106069-reject-non-canonical-ip.patchnew file mode 100644index 0000000000..9d90c564d0--- /dev/null+++ b/scripts/docker/nodejs-rpm/0004-tls-CVE-2026-106069-reject-non-canonical-ip.patch@@ -0,0 +1,288 @@+From 935918e3427911f2bef315638d68308dfecc61ba Mon Sep 17 00:00:00 2001+From: Matteo Collina <[email protected]>+Date: Tue, 15 Sep 2026 10:58:38 +0200+Subject: [PATCH] tls: reject non-canonical IP addresses++TLS identity checks normalized non-canonical numeric hosts before+matching certificates. Platform resolvers can interpret the original+host as a different address.++Reject hosts that become IP addresses only after domainToASCII()+normalization.++Assisted-by: Pi+Signed-off-by: Matteo Collina <[email protected]>+PR-URL: https://github.com/nodejs-private/node-private/pull/982+Reviewed-By: Antoine du Hamel <[email protected]>+CVE-ID: CVE-2026-106069+---+ lib/tls.js | 38 +++++------+ test/fixtures/keys/Makefile | 24 ++++++++ .../keys/non-canonical-ip-dns-cert.pem | 19 +++++++ .../keys/non-canonical-ip-dns-key.pem | 5 +++ .../test-tls-check-server-identity.js | 67 +++++++++----------+ .../test-tls-connect-non-canonical-ip.js | 33 ++++++++++ 6 files changed, 131 insertions(+), 55 deletions(-)+ create mode 100644 test/fixtures/keys/non-canonical-ip-dns-cert.pem+ create mode 100644 test/fixtures/keys/non-canonical-ip-dns-key.pem+ create mode 100644 test/parallel/test-tls-connect-non-canonical-ip.js++diff --git a/lib/tls.js b/lib/tls.js+index 42562108eaa7..ba395be5eb33 100644+--- a/lib/tls.js++++ b/lib/tls.js+@@ -439,6 +439,8 @@ exports.checkServerIdentity = function checkServerIdentity(hostname, cert) {+ // Remove trailing dots for error messages and matching.+ hostname = unfqdn(hostname);+ const hostnameASCIIWithoutFQDN = unfqdn(hostnameASCII);++ const hostnameIsIP = net.isIP(hostname);++ const hostnameASCIIIsIP = net.isIP(hostnameASCIIWithoutFQDN);++ if (altNames) {+ const splitAltNames = altNames.includes('"') ?+@@ -453,29 +455,25 @@ exports.checkServerIdentity = function checkServerIdentity(hostname, cert) {+ });+ }+++ // Non-canonical IP address spellings can be interpreted differently by++ // domainToASCII() and the operating system resolver. Reject them instead of++ // validating a certificate against an address that may not be the peer.++ if (!hostnameIsIP && hostnameASCIIIsIP) {++ return new ERR_TLS_CERT_ALTNAME_INVALID(++ 'Host is a non-canonical IP address', hostname, cert);++ }+++ let valid = false;+ let reason = 'Unknown reason';++- // Decide whether the host is an IP address by checking both forms of it,+- // because neither form is enough on its own:+- //+- // - The original hostname is needed for IPv6. domainToASCII() returns '' for+- // an IPv6 literal such as '::1' (it is not a domain).+- // - The normalized hostname is needed for hosts that net.isIP() rejects but+- // that normalize to an IPv4 address: '\uFF11\uFF12\uFF17.0.0.1' (fullwidth+- // digits), '127\u30020.0.1' (ideographic full stop) and '127.1' all become+- // '127.0.0.1'. The resolver treats them as that address too, so they must+- // be matched against IP SANs. Letting them fall through to the DNS-name+- // path would match an IP address against DNS names and the CN instead.+- let ip = '';+- if (net.isIP(hostname)) {+- ip = hostname;+- } else if (net.isIP(hostnameASCIIWithoutFQDN)) {+- ip = hostnameASCIIWithoutFQDN;+- }+-+- if (ip) {+- valid = ips.includes(canonicalizeIP(ip));++ // An IP literal must not be IDNA-normalized: domainToASCII() returns '' for++ // an IPv6 literal (it is not a domain), so matching against the normalized++ // host would skip IP-SAN matching for IPv6 entirely. Match IP hosts against++ // the original hostname (net.isIP() rejects non-ASCII, so there is no IDNA++ // confusion to guard against here); the normalized form is kept for the++ // DNS-name path below.++ if (hostnameIsIP) {++ valid = ips.includes(canonicalizeIP(hostname));+ if (!valid) {+ reason =+ `IP: ${hostname} is not in the cert's list: ` + ips.join(', ');+diff --git a/test/fixtures/keys/Makefile b/test/fixtures/keys/Makefile+index ac3a01780c7f..c633b12fd7b6 100644+--- a/test/fixtures/keys/Makefile++++ b/test/fixtures/keys/Makefile+@@ -105,6 +105,8 @@ all: \+ incorrect_san_correct_subject-key.pem \+ irrelevant_san_correct_subject-cert.pem \+ irrelevant_san_correct_subject-key.pem \++ non-canonical-ip-dns-cert.pem \++ non-canonical-ip-dns-key.pem \+ ml_dsa_44_private.pem \+ ml_dsa_44_private_seed_only.pem \+ ml_dsa_44_private_priv_only.pem \+@@ -1258,6 +1260,28 @@ irrelevant_san_correct_subject-cert.pem: irrelevant_san_correct_subject-key.pem+ irrelevant_san_correct_subject-key.pem:+ openssl ecparam -name prime256v1 -genkey -noout -out irrelevant_san_correct_subject-key.pem+++non-canonical-ip-dns-cert.pem: non-canonical-ip-dns-key.pem ca1-cert.pem ca1-key.pem++ openssl req -new \++ -key non-canonical-ip-dns-key.pem \++ -out non-canonical-ip-dns-cert.csr \++ -sha256 \++ -subj "/CN=Example Operator" \++ -addext "subjectAltName = DNS:87.0.0.1"++ openssl x509 -req \++ -in non-canonical-ip-dns-cert.csr \++ -CA ca1-cert.pem \++ -CAkey ca1-key.pem \++ -passin "pass:password" \++ -set_serial 0x1001 \++ -out non-canonical-ip-dns-cert.pem \++ -days 99999 \++ -copy_extensions copy \++ -sha256++ rm non-canonical-ip-dns-cert.csr++++non-canonical-ip-dns-key.pem:++ openssl ecparam -name prime256v1 -genkey -noout -out non-canonical-ip-dns-key.pem+++ clean:+ rm -f *.pfx *.pem *.srl ca2-database.txt ca2-crl-agent3-database.txt* ca2-crl-agent3.cnf ca2-serial fake-startcom-root-serial *.print *.old fake-startcom-root-issued-certs/*.pem+ @> fake-startcom-root-database.txt+diff --git a/test/fixtures/keys/non-canonical-ip-dns-cert.pem b/test/fixtures/keys/non-canonical-ip-dns-cert.pem+new file mode 100644+index 000000000000..8d074ee5e159+--- /dev/null++++ b/test/fixtures/keys/non-canonical-ip-dns-cert.pem+@@ -0,0 +1,19 @@++-----BEGIN CERTIFICATE-----++MIIDJDCCAgygAwIBAgICEAEwDQYJKoZIhvcNAQELBQAwejELMAkGA1UEBhMCVVMx++CzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEPMA0GA1UECgwGSm95ZW50MRAwDgYD++VQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTExIDAeBgkqhkiG9w0BCQEWEXJ5QHRp++bnljbG91ZHMub3JnMCAXDTI2MDkxNTA4MjM0MloYDzIzMDAwNjMwMDgyMzQyWjAb++MRkwFwYDVQQDDBBFeGFtcGxlIE9wZXJhdG9yMFkwEwYHKoZIzj0CAQYIKoZIzj0D++AQcDQgAEtZoLwubUMsMLAtfUgQc7W5WzBW9Y1nq9DTma/F5tUnS7E9nZdnaFd5bj++hofRf5qjd5FyduDgJU0ABKYHVph8/KOB2zCB2DATBgNVHREEDDAKggg4Ny4wLjAu++MTAdBgNVHQ4EFgQUUlN/+oxGG+tfBUkKQX1RBmAl0DwwgaEGA1UdIwSBmTCBlqF+++pHwwejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEPMA0G++A1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTExIDAe++BgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnghRKsWyN/Wp9DS38q9+cSw6S++xq0CKTANBgkqhkiG9w0BAQsFAAOCAQEApYHYIBczeRxLk1RO1uQICIXtiO1stPu+++Q7PuFAJsv3n8+jp93kBXQn/p7HsstEC0xZfgJ5AFepkBL+r4Nf6rj7+owhDCDpSI++2zV62t8Rmh7gbSj2C6O7vUMowXK0RrLlAl9kWJBGAlQ9huLDdtPrbcv6LBEnuTZ2++B/hJ02I2dVALwuei41R1Omd/mAn1dWozXqlRgF39EUUXWXK/Fd/d44J2cpokLxfs++3OcMrXWY0dXUdPLCvmOB97egcnpy7APOVDXCRmYEzJktiaESkCgeoXMxXPE6oexz++OFzMLtMAAPCh3orw06x9kfaZ/BXecWSbtsza8odbQlaQx9ZBBn8eew==++-----END CERTIFICATE-----+diff --git a/test/fixtures/keys/non-canonical-ip-dns-key.pem b/test/fixtures/keys/non-canonical-ip-dns-key.pem+new file mode 100644+index 000000000000..a33bd0e27706+--- /dev/null++++ b/test/fixtures/keys/non-canonical-ip-dns-key.pem+@@ -0,0 +1,5 @@++-----BEGIN EC PRIVATE KEY-----++MHcCAQEEICA0HmHFMqxNucO30myyMnWxrGy6kXnfP2hNyOhOvylJoAoGCCqGSM49++AwEHoUQDQgAEtZoLwubUMsMLAtfUgQc7W5WzBW9Y1nq9DTma/F5tUnS7E9nZdnaF++d5bjhofRf5qjd5FyduDgJU0ABKYHVph8/A==++-----END EC PRIVATE KEY-----+diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js+index 61a2513f81d7..2097081816ee 100644+--- a/test/parallel/test-tls-check-server-identity.js++++ b/test/parallel/test-tls-check-server-identity.js+@@ -394,46 +394,43 @@ const tests = [+ },+ error: 'IP: 127.0.0.1 is not in the cert\'s list: '+ },+- // A host that net.isIP() rejects but that normalizes to an IPv4 address is+- // an IP address, not a DNS name: it is matched against "IP Address:" SANs,+- // never against DNS names or the CN.+- {+- host: '\uFF11\uFF12\uFF17.0.0.1', // "127.0.0.1" with fullwidth digits.+- cert: { subjectaltname: 'DNS:127.0.0.1', subject: {} },+- error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: '+- },+- {+- host: '\uFF11\uFF12\uFF17.0.0.1',+- cert: { subjectaltname: 'DNS:*.0.0.1', subject: {} },+- error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: '+- },+- {+- host: '\uFF11\uFF12\uFF17.0.0.1',+- cert: { subject: { CN: '127.0.0.1' } },+- error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: '+- },+- {+- host: '\uFF11\uFF12\uFF17.0.0.1',+- cert: { subjectaltname: 'IP Address:127.0.0.1', subject: {} }+- },+- {+- host: '\uFF11\uFF12\uFF17.0.0.1',+- cert: { subjectaltname: 'IP Address:127.0.0.2', subject: {} },+- error: 'IP: \uFF11\uFF12\uFF17.0.0.1 is not in the cert\'s list: 127.0.0.2'+- },++ // Non-canonical IP addresses are rejected instead of being matched against++ // an address produced by domainToASCII().++ ...[++ ['0127.0.0.1', '87.0.0.1'],++ ['0177.0.0.1', '127.0.0.1'],++ ['0x7f.0.0.1', '127.0.0.1'],++ ['2130706433', '127.0.0.1'],++ ['127.1', '127.0.0.1'],++ ['\uFF11\uFF12\uFF17.0.0.1', '127.0.0.1'], // Fullwidth digits.++ ['127\u30020.0.1', '127.0.0.1'], // Ideographic full stop.++ ].map(([host, normalized]) => ({++ host,++ cert: {++ subjectaltname: `DNS:${normalized}`,++ subject: {},++ },++ error: 'Host is a non-canonical IP address',++ })),+ {+- host: '127\u30020.0.1', // "127.0.0.1" with an ideographic full stop.+- cert: { subjectaltname: 'DNS:127.0.0.1', subject: {} },+- error: 'IP: 127\u30020.0.1 is not in the cert\'s list: '++ host: '0127.0.0.1', cert: {++ subjectaltname: 'IP Address:87.0.0.1',++ subject: { CN: '87.0.0.1' },++ },++ error: 'Host is a non-canonical IP address',+ },+ {+- host: '127.1',+- cert: { subjectaltname: 'DNS:127.0.0.1', subject: {} },+- error: 'IP: 127.1 is not in the cert\'s list: '++ host: '0127.0.0.1', cert: {++ subjectaltname: 'IP Address:87.0.0.1',++ subject: { CN: 'Example Operator' },++ },++ error: 'Host is a non-canonical IP address',+ },+ {+- host: '127.1',+- cert: { subjectaltname: 'IP Address:127.0.0.1', subject: {} }++ host: '1.2.3.example', cert: {++ subjectaltname: 'DNS:1.2.3.example',++ subject: {},++ },+ },+ {+ host: 'localhost', cert: {+diff --git a/test/parallel/test-tls-connect-non-canonical-ip.js b/test/parallel/test-tls-connect-non-canonical-ip.js+new file mode 100644+index 000000000000..27a924ada519+--- /dev/null++++ b/test/parallel/test-tls-connect-non-canonical-ip.js+@@ -0,0 +1,33 @@++'use strict';++++const common = require('../common');++if (!common.hasCrypto)++ common.skip('missing crypto');++++const assert = require('assert');++const tls = require('tls');++const fixtures = require('../common/fixtures');++++const key = fixtures.readKey('non-canonical-ip-dns-key.pem');++const cert = fixtures.readKey('non-canonical-ip-dns-cert.pem');++const ca = fixtures.readKey('ca1-cert.pem');++const server = tls.createServer({ key, cert }, (socket) => socket.end());++++server.listen(0, '127.0.0.1', common.mustCall(() => {++ const client = tls.connect({++ host: '0127.0.0.1',++ port: server.address().port,++ ca,++ rejectUnauthorized: true,++ lookup: common.mustCall((hostname, options, callback) => {++ assert.strictEqual(hostname, '0127.0.0.1');++ assert.strictEqual(options.all, true);++ callback(null, [{ address: '127.0.0.1', family: 4 }]);++ }),++ }, common.mustNotCall());++++ client.on('error', common.mustCall((error) => {++ assert.strictEqual(error.code, 'ERR_TLS_CERT_ALTNAME_INVALID');++ server.close();++ }));++}));diff --git a/scripts/docker/nodejs-rpm/0005-dns-CVE-2026-105482-reject-null-bytes.patch b/scripts/docker/nodejs-rpm/0005-dns-CVE-2026-105482-reject-null-bytes.patchnew file mode 100644index 0000000000..690d2dc31b--- /dev/null+++ b/scripts/docker/nodejs-rpm/0005-dns-CVE-2026-105482-reject-null-bytes.patch@@ -0,0 +1,189 @@+From 843a1627dce1d1cbb7cf91489a89dbf837044b3f Mon Sep 17 00:00:00 2001+From: James M Snell <[email protected]>+Date: Fri, 18 Sep 2026 21:58:43 +0000+Subject: [PATCH] dns: validate resolve inputs for null bytes++Signed-off-by: James M Snell <[email protected]>+Assisted-by: Opencode+PR-URL: https://github.com/nodejs-private/node-private/pull/984+Reviewed-By: Antoine du Hamel <[email protected]>+CVE-ID: CVE-2026-105482+---+ lib/internal/dns/callback_resolver.js | 4 +-+ lib/internal/dns/promises.js | 2 +-+ lib/internal/dns/utils.js | 5 +-+ test/parallel/test-dns-resolve-null-bytes.js | 75 +++++++++++++++++++++ test/parallel/test-dns-setlocaladdress.js | 21 +++++++ 5 files changed, 102 insertions(+), 5 deletions(-)+ create mode 100644 test/parallel/test-dns-resolve-null-bytes.js++diff --git a/lib/internal/dns/callback_resolver.js b/lib/internal/dns/callback_resolver.js+index f634f452e913..68822ea291b6 100644+--- a/lib/internal/dns/callback_resolver.js++++ b/lib/internal/dns/callback_resolver.js+@@ -20,7 +20,7 @@ const {++ const {+ validateFunction,+- validateString,++ validateStringWithoutNullBytes,+ } = require('internal/validators');++ const {+@@ -59,7 +59,7 @@ function resolver(bindingName) {+ callback = arguments[2];+ }++- validateString(name, 'name');++ validateStringWithoutNullBytes(name, 'name');+ validateFunction(callback, 'callback');++ const req = new QueryReqWrap();+diff --git a/lib/internal/dns/promises.js b/lib/internal/dns/promises.js+index 0a67e2e196f4..90c8b9811dfb 100644+--- a/lib/internal/dns/promises.js++++ b/lib/internal/dns/promises.js+@@ -340,7 +340,7 @@ function createResolverPromise(resolver, bindingName, hostname, ttl) {++ function resolver(bindingName) {+ function query(name, options) {+- validateString(name, 'name');++ validateStringWithoutNullBytes(name, 'name');++ const ttl = !!(options?.ttl);+ return createResolverPromise(this, bindingName, name, ttl);+diff --git a/lib/internal/dns/utils.js b/lib/internal/dns/utils.js+index 09e554ff5af3..4b78ed91fb2f 100644+--- a/lib/internal/dns/utils.js++++ b/lib/internal/dns/utils.js+@@ -26,6 +26,7 @@ const {+ validateOneOf,+ validatePort,+ validateString,++ validateStringWithoutNullBytes,+ validateUint32,+ } = require('internal/validators');+ let binding;+@@ -178,10 +179,10 @@ class ResolverBase {+++ setLocalAddress(ipv4, ipv6) {+- validateString(ipv4, 'ipv4');++ validateStringWithoutNullBytes(ipv4, 'ipv4');++ if (ipv6 !== undefined) {+- validateString(ipv6, 'ipv6');++ validateStringWithoutNullBytes(ipv6, 'ipv6');+ }++ this._handle.setLocalAddress(ipv4, ipv6);+diff --git a/test/parallel/test-dns-resolve-null-bytes.js b/test/parallel/test-dns-resolve-null-bytes.js+new file mode 100644+index 000000000000..ef091d06a0d4+--- /dev/null++++ b/test/parallel/test-dns-resolve-null-bytes.js+@@ -0,0 +1,75 @@++'use strict';++const common = require('../common');++++// Names containing null bytes must be rejected by the resolver methods.++// c-ares receives the name as a C string, so everything after the first++// null byte would otherwise be silently dropped, e.g. resolving++// 'example.com\0.trusted.corp' would actually query 'example.com'.++++const assert = require('assert');++const dns = require('dns');++const dnsPromises = dns.promises;++++const name = 'example.com\u0000.trusted.corp';++const ip = '127.0.0.1\u0000.trusted.corp';++++const err = {++ code: 'ERR_INVALID_ARG_VALUE',++ name: 'TypeError',++ message: /^The argument 'name' must be a string without null bytes\. Received /,++};++++const methods = [++ 'resolve',++ 'resolve4',++ 'resolve6',++ 'resolveAny',++ 'resolveCaa',++ 'resolveCname',++ 'resolveMx',++ 'resolveNaptr',++ 'resolveNs',++ 'resolvePtr',++ 'resolveSoa',++ 'resolveSrv',++ 'resolveTlsa',++ 'resolveTxt',++];++++const rrtypes = [++ 'A',++ 'AAAA',++ 'ANY',++ 'CAA',++ 'CNAME',++ 'MX',++ 'NAPTR',++ 'NS',++ 'PTR',++ 'SOA',++ 'SRV',++ 'TLSA',++ 'TXT',++];++++// Callback-based API: the default resolver and a Resolver instance.++for (const resolver of [dns, new dns.Resolver()]) {++ for (const method of methods) {++ assert.throws(() => resolver[method](name, common.mustNotCall()), err);++ }++ for (const rrtype of rrtypes) {++ assert.throws(() => resolver.resolve(name, rrtype, common.mustNotCall()), err);++ }++ assert.throws(() => resolver.reverse(ip, common.mustNotCall()), err);++}++++// Promise-based API: the default resolver and a Resolver instance.++for (const resolver of [dnsPromises, new dnsPromises.Resolver()]) {++ for (const method of methods) {++ assert.throws(() => resolver[method](name), err);++ }++ for (const rrtype of rrtypes) {++ assert.throws(() => resolver.resolve(name, rrtype), err);++ }++ assert.throws(() => resolver.reverse(ip), err);++}+diff --git a/test/parallel/test-dns-setlocaladdress.js b/test/parallel/test-dns-setlocaladdress.js+index 25bece328f4a..b47916115a26 100644+--- a/test/parallel/test-dns-setlocaladdress.js++++ b/test/parallel/test-dns-setlocaladdress.js+@@ -38,3 +38,24 @@ const promiseResolver = new dns.promises.Resolver();+ promiseResolver.setLocalAddress();+ }, Error);+ }++++// Verify that setLocalAddress rejects addresses containing null bytes instead++// of silently truncating them at the first null byte++{++ for (const r of [resolver, promiseResolver]) {++ assert.throws(() => {++ r.setLocalAddress('127.0.0.1\u0000junk');++ }, {++ code: 'ERR_INVALID_ARG_VALUE',++ name: 'TypeError',++ message: /^The argument 'ipv4' must be a string without null bytes\. Received /,++ });++ assert.throws(() => {++ r.setLocalAddress('127.0.0.1', '::1\u0000junk');++ }, {++ code: 'ERR_INVALID_ARG_VALUE',++ name: 'TypeError',++ message: /^The argument 'ipv6' must be a string without null bytes\. Received /,++ });++ }++}diff --git a/scripts/docker/nodejs-rpm/Dockerfile b/scripts/docker/nodejs-rpm/Dockerfilenew file mode 100644index 0000000000..8f555d4c9e--- /dev/null+++ b/scripts/docker/nodejs-rpm/Dockerfile@@ -0,0 +1,34 @@+# TEMPORARY(node-24.22.1-security): see build.sh.+#+# Builds the patched nodejs:24 RPMs and publishes them as a scratch image of+# /rpms, which web/Dockerfile and worker/Dockerfile pull by digest. Built and+# pushed by .github/workflows/nodejs-rpm.yml; a cold build compiles all of Node+# and V8 (about 70 minutes on 16 x86_64 cores with 12 jobs, ~10 GB RAM).+ARG BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.8++FROM ${BASE_IMAGE} AS builder+COPY build.sh 000*.patch /build/+ARG NODE_BUILD_JOBS+ARG NODEJS_RPM_CHECK=1+RUN NODE_BUILD_JOBS="${NODE_BUILD_JOBS}" NODEJS_RPM_CHECK="${NODEJS_RPM_CHECK}" \+ bash /build/build.sh++# Installs the RPMs the way the images do and checks the fixes and FIPS mode,+# so an image that fails either cannot be published.+FROM ${BASE_IMAGE} AS verify+COPY install-nodejs.sh test-node-security-fixes.js /verify/+RUN --mount=type=bind,from=builder,source=/out/rpms,target=/rpms \+ bash /verify/install-nodejs.sh /rpms nodejs nodejs-libs nodejs-full-i18n npm \+ openssl-fips-provider openssl-fips-provider-so && \+ rpm -q nodejs | grep -q '\.lf1\.' && \+ node /verify/test-node-security-fixes.js && \+ OPENSSL_FORCE_FIPS_MODE=1 node -e ' \+ const assert = require("node:assert/strict"); \+ const crypto = require("node:crypto"); \+ assert.equal(crypto.getFips(), 1, "FIPS provider not active"); \+ assert.throws(() => crypto.createHash("md5"), { code: "ERR_OSSL_EVP_UNSUPPORTED" });' && \+ rpm -q nodejs > /verified++FROM scratch+COPY --from=builder /out/rpms/ /rpms/+COPY --from=verify /verified /rpms/verifieddiff --git a/scripts/docker/nodejs-rpm/build.sh b/scripts/docker/nodejs-rpm/build.shnew file mode 100644index 0000000000..103bdd04b0--- /dev/null+++ b/scripts/docker/nodejs-rpm/build.sh@@ -0,0 +1,105 @@+#!/usr/bin/env bash+# TEMPORARY(node-24.22.1-security): remove scripts/docker/nodejs-rpm/ once Red+# Hat ships a nodejs:24 errata for RHEL 9 that passes test-node-security-fixes.js.+#+# Rebuilds Red Hat's nodejs:24 module RPMs from their source RPM with these+# fixes from Node 24.22.1, vendored verbatim from its v24.x branch:+# 0002 nodejs/node@49dff6f57aa7 CVE-2026-111497 bundled Brotli decoder+# (in libnode, so the system brotli package+# does not fix it)+# 0003 nodejs/node@de49c913f232 CVE-2026-105483 tls: IP normalization+# 0004 nodejs/node@935918e34279 CVE-2026-106069 tls: non-canonical IPs+# 0005 nodejs/node@843a1627dce1 CVE-2026-105482 dns: null bytes in names+# 0004 rewrites the code 0003 adds, so they apply in that (upstream) order.+#+# Everything else is Red Hat's: spec, patches (including the FIPS patch),+# configure flags and compiler flags. Node keeps linking the system OpenSSL, so+# node:crypto stays on RHEL's FIPS provider.+#+# The release gets a ".lf1" suffix on top of Red Hat's: it sorts above the+# vulnerable build and below any later Red Hat release, so the images switch+# back to Red Hat's package as soon as one exists+# (scripts/docker/nodejs-rpm/install-nodejs.sh).+#+# Runs as root on UBI 9 and writes the runtime RPMs to /out/rpms.+# NODE_BUILD_JOBS compile jobs (default: one per CPU; ~1.5 GB RAM each)+# NODEJS_RPM_CHECK 1 runs the spec's %check test suite (default), 0 skips it+set -euo pipefail++readonly SRPM_NAME=nodejs-24.21.0-1.module+el9.8.0+24924+cd677006.src.rpm+readonly SRPM_SHA256=3f5b2604c4b8391235ab4bc3de0e1e2e847fe9cca2167f7b8612fda7874f121e+# UBI's public source repo: no Red Hat subscription needed. Source RPMs are+# architecture-independent, so the x86_64 path serves every build arch.+readonly SRPM_URL="https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/x86_64/appstream/source/SRPMS/Packages/n/${SRPM_NAME}"+readonly DIST=.module+el9.8.0+24924+cd677006.lf1+readonly -a PATCHES=(+ 0002-deps-brotli-CVE-2026-111497-block-switch.patch+ 0003-tls-CVE-2026-105483-ip-normalization-regression.patch+ 0004-tls-CVE-2026-106069-reject-non-canonical-ip.patch+ 0005-dns-CVE-2026-105482-reject-null-bytes.patch+)+readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"+readonly TOPDIR=/build/rpmbuild+readonly BUILD_JOBS="${NODE_BUILD_JOBS:-$(nproc)}"+readonly RUN_CHECK="${NODEJS_RPM_CHECK:-1}"++if [[ ! "$BUILD_JOBS" =~ ^[1-9][0-9]*$ ]]; then+ echo "NODE_BUILD_JOBS must be a positive integer" >&2+ exit 1+fi++dnf -y install --setopt=install_weak_deps=0 rpm-build dnf-plugins-core+# nodejs-packaging, a build dependency, only exists inside the module.+dnf -y module enable nodejs:24++mkdir -p "$TOPDIR"+curl --fail --show-error --silent --location --retry 5 --retry-all-errors \+ --output "/build/${SRPM_NAME}" "$SRPM_URL"+printf '%s %s\n' "$SRPM_SHA256" "/build/${SRPM_NAME}" | sha256sum --check --strict -+rpmkeys --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release+rpm --checksig "/build/${SRPM_NAME}"+rpm -i --define "_topdir ${TOPDIR}" "/build/${SRPM_NAME}"++readonly SPEC="${TOPDIR}/SPECS/nodejs.spec"+for patch in "${PATCHES[@]}"; do+ cp "${SCRIPT_DIR}/${patch}" "${TOPDIR}/SOURCES/"+done+# Apply after Red Hat's FIPS patch; %autosetup -S git_am applies %patchlist in+# order with git am, which fails on any patch that does not apply exactly.+sed -i "s|^0001-fips-disable-options.patch\$|&$(printf '\\n%s' "${PATCHES[@]}")|" "$SPEC"+sed -i "s|^%changelog\$|&\n* $(LC_ALL=C date -u '+%a %b %d %Y') gage-clickhouse <[email protected]> - 1:24.21.0-1${DIST}\n- Backport fixes from Node 24.22.1 for CVE-2026-111497 (bundled Brotli),\n CVE-2026-105483 and CVE-2026-106069 (tls), CVE-2026-105482 (dns)\n|" "$SPEC"+for patch in "${PATCHES[@]}"; do+ grep -qx "$patch" "$SPEC" || { echo "Failed to add ${patch} to ${SPEC}" >&2; exit 1; }+done++# Red Hat builds with every dependency bundled, as the binary RPM's+# bundled(...) provides show. The spec derives that from its bootstrap bcond,+# which RHEL 9's rpm 4.16 does not propagate, so set it directly; without it,+# the build devendors Brotli and needs packages UBI does not carry.+readonly -a RPM_DEFINES=(+ --define "_topdir ${TOPDIR}"+ --define "dist ${DIST}"+ --define "_smp_build_ncpus ${BUILD_JOBS}"+ --define "_with_all_deps_bundled --with-all_deps_bundled"+)+dnf -y builddep "${RPM_DEFINES[@]}" "$SPEC"++check_flag=()+[ "$RUN_CHECK" = "1" ] || check_flag=(--nocheck)+rpmbuild -bb "${check_flag[@]}" "${RPM_DEFINES[@]}" "$SPEC"++# Only the packages the images install; debuginfo, -devel and -docs stay here.+mkdir -p /out/rpms+for name in nodejs nodejs-libs nodejs-full-i18n npm; do+ find "${TOPDIR}/RPMS" -name "${name}-[0-9]*${DIST}.*.rpm" -exec cp {} /out/rpms/ \;+done+test "$(find /out/rpms -name '*.rpm' | wc -l)" -eq 4+patches_json="$(for patch in "${PATCHES[@]}"; do+ printf '{"name":"%s","sha256":"%s"}\n' "$patch" \+ "$(sha256sum "${SCRIPT_DIR}/${patch}" | cut -d ' ' -f 1)"+done | paste -sd ,)"+printf '{"srpm":"%s","srpmSha256":"%s","patches":[%s],"check":%s}\n' \+ "$SRPM_NAME" "$SRPM_SHA256" "$patches_json" \+ "$([ "$RUN_CHECK" = "1" ] && echo true || echo false)" \+ > /out/rpms/build-info.json+ls -l /out/rpmsdiff --git a/scripts/docker/nodejs-rpm/install-nodejs.sh b/scripts/docker/nodejs-rpm/install-nodejs.shnew file mode 100644index 0000000000..27fcb47a5c--- /dev/null+++ b/scripts/docker/nodejs-rpm/install-nodejs.sh@@ -0,0 +1,55 @@+#!/usr/bin/env bash+# TEMPORARY(node-24.22.1-security): see build.sh.+#+# Enables the nodejs:24 module and installs the given packages in one dnf+# transaction, taking nodejs, nodejs-libs, nodejs-full-i18n and npm from the+# patched RPMs built by build.sh only while those are newer than what Red Hat's+# repos offer. Once Red Hat ships a newer nodejs, this installs theirs instead,+# and test-node-security-fixes.js (run by the Dockerfiles right after) decides+# whether it also has every fix: if it does, delete scripts/docker/nodejs-rpm/;+# if not, rebase the patches onto Red Hat's new source RPM.+#+# Usage: install-nodejs.sh RPM_DIR PACKAGE...+# NODEJS_INSTALLROOT install into this root instead of /. Pass every package+# in one call: once the root holds packages, dnf reads+# its repo config from there and loses the UBI repos.+set -euo pipefail++readonly RPM_DIR="${1:?usage: install-nodejs.sh RPM_DIR PACKAGE...}"+shift+[ "$#" -gt 0 ] || { echo "usage: install-nodejs.sh RPM_DIR PACKAGE..." >&2; exit 1; }+readonly PATCHED_NAMES=" nodejs nodejs-libs nodejs-full-i18n npm "++dnf_args=(-y --setopt=install_weak_deps=0)+if [ -n "${NODEJS_INSTALLROOT:-}" ]; then+ dnf_args+=(--installroot "$NODEJS_INSTALLROOT" --releasever 9 \+ --disableexcludes=all --setopt=tsflags=nodocs)+fi++dnf "${dnf_args[@]}" module enable nodejs:24++vendored_rpm="$(find "$RPM_DIR" -name 'nodejs-[0-9]*.rpm' | head -n 1)"+[ -n "$vendored_rpm" ] || { echo "No nodejs RPM in ${RPM_DIR}" >&2; exit 1; }+vendored="$(rpm -qp --qf '%{EPOCHNUM}:%{VERSION}-%{RELEASE}' "$vendored_rpm")"+available="$(dnf "${dnf_args[@]}" -q repoquery --latest-limit 1 \+ --qf '%{epoch}:%{version}-%{release}' nodejs | tail -n 1)"+[ -n "$available" ] || { echo "nodejs:24 is not available from the repos" >&2; exit 1; }++packages=("$@")+if [ "$(rpm --eval "%{lua: print(rpm.vercmp('${vendored}', '${available}'))}")" -gt 0 ]; then+ echo "Installing patched nodejs ${vendored} (repos offer ${available})"+ for i in "${!packages[@]}"; do+ name="${packages[$i]}"+ [[ "$PATCHED_NAMES" == *" ${name} "* ]] || continue+ file="$(find "$RPM_DIR" -name "${name}-[0-9]*.rpm" | head -n 1)"+ [ -n "$file" ] || { echo "No ${name} RPM in ${RPM_DIR}" >&2; exit 1; }+ packages[$i]="$file"+ done+else+ echo "Red Hat's nodejs ${available} is not older than the patched ${vendored};" \+ "installing it. If the security fix checks pass, remove scripts/docker/nodejs-rpm/."+fi++# The patched RPMs are built in CI from Red Hat's signed source RPM and pulled+# into the image build by digest, so they carry no package signature to check.+dnf "${dnf_args[@]}" --setopt=localpkg_gpgcheck=0 install "${packages[@]}"diff --git a/scripts/docker/nodejs-rpm/test-node-security-fixes.js b/scripts/docker/nodejs-rpm/test-node-security-fixes.jsnew file mode 100644index 0000000000..ac82d67d7f--- /dev/null+++ b/scripts/docker/nodejs-rpm/test-node-security-fixes.js@@ -0,0 +1,155 @@+// TEMPORARY(node-24.22.1-security): see build.sh.+//+// Fails unless the installed Node has every fix that build.sh patches in. Each+// check calls the affected API directly and needs no network or certificates.+//+// - CVE-2026-111497 (Brotli): the input and expected error come from Node+// v24.22.1 test/parallel/test-zlib-invalid-input.js: a block switch in a+// stream that declares a single block type. A fixed decoder reports+// BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH (errno -17); a vulnerable one+// fails later with a different error (Red Hat's 24.21.0 reports+// ERR__ERROR_FORMAT_BLOCK_LENGTH_1), so checking only that it throws would+// pass on a vulnerable build. The Brotli version string cannot tell either:+// Node did not bump it for the fix.+// - CVE-2026-106069 and CVE-2026-105483 (TLS): checkServerIdentity() must+// reject hosts that are IP addresses only after IDNA normalization, such as+// '0127.0.0.1' (octal, normalizes to 87.0.0.1) or fullwidth digits, instead+// of matching them against DNS names. Canonical IPv4 and IPv6 hosts must+// still match their IP SANs.+// - CVE-2026-105482 (DNS): resolver methods must reject names containing null+// bytes instead of truncating them at the first one.+"use strict";+const dns = require("node:dns");+const tls = require("node:tls");+const zlib = require("node:zlib");++const results = [];+const check = (name, ok, detail) => results.push({ name, ok, detail });+const describe = (e) => (e ? `${e.code} (errno ${e.errno})` : "no error");++function checkTls() {+ const nonCanonical = [+ ["0127.0.0.1", "DNS:87.0.0.1"],+ ["127.1", "DNS:127.0.0.1"],+ ["127.0.0.1", "DNS:127.0.0.1"],+ ["127。0.0.1", "DNS:127.0.0.1"],+ ];+ for (const [host, san] of nonCanonical) {+ const result = tls.checkServerIdentity(host, {+ subjectaltname: san,+ subject: {},+ });+ check(+ `tls rejects ${JSON.stringify(host)} against ${san}`,+ result?.code === "ERR_TLS_CERT_ALTNAME_INVALID" &&+ result.reason === "Host is a non-canonical IP address",+ result ? `${result.code}: ${result.reason}` : "accepted",+ );+ }+ const canonical = [+ ["127.0.0.1", "IP Address:127.0.0.1"],+ ["::1", "IP Address:0:0:0:0:0:0:0:1"],+ ];+ for (const [host, san] of canonical) {+ const result = tls.checkServerIdentity(host, {+ subjectaltname: san,+ subject: {},+ });+ check(+ `tls accepts ${host} against ${san}`,+ result === undefined,+ result ? `${result.code}: ${result.reason}` : "accepted",+ );+ }+}++async function checkDns() {+ // A vulnerable build sends the truncated query, so point it at a closed+ // local port and cancel it rather than wait on real DNS.+ const name = "example.com\u0000.trusted.corp";+ const isFixError = (e) => e?.code === "ERR_INVALID_ARG_VALUE";++ const resolver = new dns.Resolver({ timeout: 100, tries: 1 });+ resolver.setServers(["127.0.0.1:9"]);+ let callbackError = null;+ try {+ resolver.resolve4(name, () => {});+ } catch (e) {+ callbackError = e;+ }+ resolver.cancel();+ check(+ "dns.Resolver#resolve4 rejects null bytes",+ isFixError(callbackError),+ callbackError?.code ?? "query sent",+ );++ const promiseResolver = new dns.promises.Resolver({ timeout: 100, tries: 1 });+ promiseResolver.setServers(["127.0.0.1:9"]);+ let promiseError = null;+ try {+ promiseResolver.resolve4(name).catch(() => {});+ } catch (e) {+ promiseError = e;+ }+ promiseResolver.cancel();+ check(+ "dns.promises.Resolver#resolve4 rejects null bytes",+ isFixError(promiseError),+ promiseError?.code ?? "query sent",+ );+}++async function checkBrotli() {+ const input = Buffer.from(+ "200010414141fcffff07002228f00b60f7f41f000000",+ "hex",+ );+ const isFixError = (e) =>+ e?.code === "ERR__ERROR_FORMAT_BLOCK_SWITCH" && e?.errno === -17;++ let syncError = null;+ try {+ zlib.brotliDecompressSync(input);+ } catch (e) {+ syncError = e;+ }+ check("brotli sync", isFixError(syncError), describe(syncError));++ const decoder = zlib.createBrotliDecompress();+ const streamResult = new Promise((resolve) => {+ const timer = setTimeout(() => resolve({ outcome: "timeout" }), 5000);+ decoder.on("data", () => {});+ decoder.on("error", (e) => {+ clearTimeout(timer);+ resolve({ outcome: "error", error: e });+ });+ decoder.on("end", () => {+ clearTimeout(timer);+ resolve({ outcome: "end" });+ });+ });+ for (let i = 0; i < input.length; i++)+ decoder.write(input.subarray(i, i + 1));+ decoder.end();+ const { outcome, error } = await streamResult;+ check(+ "brotli stream",+ isFixError(error),+ outcome === "error" ? describe(error) : outcome,+ );+}++(async () => {+ checkTls();+ await checkDns();+ await checkBrotli();+ for (const { name, ok, detail } of results) {+ console.log(`${ok ? "fixed " : "VULNERABLE"} ${name}: ${detail}`);+ }+ const failed = results.filter((r) => !r.ok).length;+ console.log(+ `Node ${process.version} security fixes: ${results.length - failed}/${results.length} checks pass`,+ );+ process.exit(failed ? 1 : 0);+})();