diff --git a/.github/label-pr-config.yml b/.github/label-pr-config.yml
index 8b36066473f4..f30b6b8a5e3e 100644
--- a/.github/label-pr-config.yml
+++ b/.github/label-pr-config.yml
@@ -15,6 +15,7 @@ subSystemLabels:
/^src\/uv\./: c++, libuv
/^src\/(?:connect(?:ion)?|pipe|tcp)_/: c++, net
/^src\/node_os/: c++, os
+ /^src\/permission\//: c++, permission
/^src\/(?:node_main|signal_)/: c++, process
/^src\/timer[_s]/: c++, timers
/^src\/node_root_certs/: c++, tls
@@ -102,6 +103,7 @@ subSystemLabels:
/^lib\/test.js$/: test_runner
/^lib\/v8.js$/: v8 module
/^lib\/internal\/url\.js$/: whatwg-url
+ /^lib\/internal\/process\/permission\.js$/: permission
/^lib\/internal\/modules\/esm/: esm
/^lib\/internal\/modules/: module
/^lib\/internal\/source_map/: source maps
@@ -116,6 +118,13 @@ subSystemLabels:
exlusiveLabels:
# More specific tests
+ /^test\/(?:parallel|sequential)\/test-(?:[^/]+-)?permission(?:-|\.)/: test, permission
+ /^test\/ffi\/test-ffi-permissions?(?:-|\.)/: test, permission
+ /^test\/addons\/no-addons\/permission\.js$/: test, addons, permission
+ /^test\/es-module\/test-[^/]*-permission(?:-|\.)/: test, esm, permission
+ /^test\/module-hooks\/test-[^/]*-permission(?:-|\.)/: test, module, loaders, permission
+ /^test\/fixtures\/permission\//: test, permission
+ /^test\/fixtures\/rc\/permission-namespace\.json$/: test, permission
/^test\/addons\//: test, addons
/^test\/debugger/: test, debugger
/^test\/doctool\//: test, doc, tools
@@ -150,6 +159,7 @@ exlusiveLabels:
# test_runner documentation
/^doc\/api\/test.md$/: doc, test_runner
# Automatically tag JS subsystem-specific API doc changes
+ /^doc\/api\/permissions\.md$/: doc, permission
/^doc\/api\/(\w+)\.md$/: doc, $1
# Add deprecations label to PRs that affect doc/api/deprecations.md
/^doc\/api\/deprecations.md$/: doc, deprecations
@@ -162,6 +172,7 @@ exlusiveLabels:
/^doc\//: doc
# More specific benchmarks
+ /^benchmark\/fs\/readfile-permission-enabled\.js$/: benchmark, fs, permission
/^benchmark\/buffers\//: benchmark, buffer
/^benchmark\/es\//: benchmark, v8 engine
/^benchmark\/_http/: benchmark, http
@@ -198,6 +209,7 @@ allJsSubSystems:
- os
- path
- perf_hooks
+ - permission
- process
- punycode
- querystring
diff --git a/.github/workflows/auto-start-ci.yml b/.github/workflows/auto-start-ci.yml
index 8c01b0592c2e..85f3e92f2ffb 100644
--- a/.github/workflows/auto-start-ci.yml
+++ b/.github/workflows/auto-start-ci.yml
@@ -1,6 +1,9 @@
# This action uses the following secrets:
# JENKINS_USER: GitHub user whose Jenkins token is defined below
-# JENKINS_TOKEN: Jenkins token, to be used to start CI
+# JENKINS_TOKEN: Jenkins token, to be used to start or resume CI
+# Optional repository variables:
+# AUTO_START_CI_BATCH_SIZE: maximum PRs to process per run (default: 5)
+# AUTO_START_CI_MAX_WORKLOAD: pause at this many running or queued PR jobs (default: 15)
name: Auto Start CI
on:
@@ -30,16 +33,25 @@ jobs:
steps:
- name: Get Pull Requests
id: get_prs_for_ci
- run: >
- echo "numbers=$(gh pr list \
+ # Explicit bash enables pipefail so jq cannot hide a failed gh query.
+ shell: bash
+ run: |
+ if ! [[ "$BATCH_SIZE" =~ ^[1-9][0-9]*$ ]]; then
+ echo '::error::AUTO_START_CI_BATCH_SIZE must be a strictly positive integer'
+ exit 1
+ fi
+ # Filter before selecting the batch; UNKNOWN mergeability is retried later.
+ numbers=$(gh pr list \
--repo "$GITHUB_REPOSITORY" \
- --label 'request-ci' \
- --json 'number' \
- --search 'review:approved' \
- -t '{{ range . }}{{ .number }} {{ end }}' \
- --limit 5)" >> "$GITHUB_OUTPUT"
+ --json 'number,mergeable' \
+ --search 'review:approved label:request-ci,resume-ci' \
+ --limit 100 \
+ | jq --argjson limit "$BATCH_SIZE" \
+ '[.[] | select(.mergeable == "MERGEABLE") | .number] | .[:$limit] | map(tostring) | join(" ")' -r)
+ echo "numbers=$numbers" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
+ BATCH_SIZE: ${{ vars.AUTO_START_CI_BATCH_SIZE || '5' }}
start-ci:
permissions:
checks: read
@@ -70,9 +82,12 @@ jobs:
GH_TOKEN: ${{ github.token }}
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
- - name: Start the CI
+ - name: Start or resume the CI
run: |
+ read -r -a numbers <<< "$PULL_REQUESTS"
curl -fsSL "https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/tools/actions/start-ci.sh" \
- | sh -s -- ${{ needs.get-prs-for-ci.outputs.numbers }}
+ | sh -s -- "${numbers[@]}"
env:
GH_TOKEN: ${{ github.token }}
+ PULL_REQUESTS: ${{ needs.get-prs-for-ci.outputs.numbers }}
+ MAX_WORKLOAD: ${{ vars.AUTO_START_CI_MAX_WORKLOAD || '15' }}
diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml
index 8b306b59fe7e..1c9eeeff7f25 100644
--- a/.github/workflows/build-tarball.yml
+++ b/.github/workflows/build-tarball.yml
@@ -30,7 +30,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
FLAKY_TESTS: keep_retrying
permissions:
@@ -68,11 +68,6 @@ jobs:
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
SCCACHE_IDLE_TIMEOUT: '0'
steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- sparse-checkout: .github/actions/install-clang
- sparse-checkout-cone-mode: false
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 1b3179ef4af1..d8eca1f2b798 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -30,15 +30,15 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
+ uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml
- name: Autobuild
- uses: github/codeql-action/autobuild@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
+ uses: github/codeql-action/autobuild@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
+ uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
category: /language:${{matrix.language}}
diff --git a/.github/workflows/commit-queue.yml b/.github/workflows/commit-queue.yml
index 8f29a390c678..83f921838b30 100644
--- a/.github/workflows/commit-queue.yml
+++ b/.github/workflows/commit-queue.yml
@@ -196,6 +196,8 @@ jobs:
git config --local user.email "github-bot@iojs.org"
git config --local user.name "Node.js GitHub Bot"
ncu-config set token "$GH_TOKEN"
- ./tools/actions/commit-queue.sh ${{ steps.get_mergeable_prs.outputs.numbers }}
+ read -r -a numbers <<< "$PULL_REQUESTS"
+ ./tools/actions/commit-queue.sh "${numbers[@]}"
env:
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
+ PULL_REQUESTS: ${{ steps.get_mergeable_prs.outputs.numbers }}
diff --git a/.github/workflows/coverage-linux-without-intl.yml b/.github/workflows/coverage-linux-without-intl.yml
index 61309d3d6aeb..f9a22f1674ff 100644
--- a/.github/workflows/coverage-linux-without-intl.yml
+++ b/.github/workflows/coverage-linux-without-intl.yml
@@ -34,7 +34,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
FLAKY_TESTS: keep_retrying
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
@@ -79,6 +79,6 @@ jobs:
- name: Clean tmp
run: rm -rf coverage/tmp && rm -rf out
- name: Upload
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
+ uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
directory: ./coverage
diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml
index 4d350ebd2e0b..5560c4be2c84 100644
--- a/.github/workflows/coverage-linux.yml
+++ b/.github/workflows/coverage-linux.yml
@@ -34,7 +34,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
FLAKY_TESTS: keep_retrying
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
@@ -79,6 +79,6 @@ jobs:
- name: Clean tmp
run: rm -rf coverage/tmp && rm -rf out
- name: Upload
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
+ uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
directory: ./coverage
diff --git a/.github/workflows/coverage-windows.yml b/.github/workflows/coverage-windows.yml
index d735ea551c93..98cf3b21fec2 100644
--- a/.github/workflows/coverage-windows.yml
+++ b/.github/workflows/coverage-windows.yml
@@ -58,7 +58,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
FLAKY_TESTS: keep_retrying
permissions:
@@ -93,6 +93,6 @@ jobs:
- name: Clean tmp
run: npx rimraf ./coverage/tmp
- name: Upload
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
+ uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
directory: ./coverage
diff --git a/.github/workflows/daily-wpt-fyi.yml b/.github/workflows/daily-wpt-fyi.yml
index 107889949997..afc04b5d4628 100644
--- a/.github/workflows/daily-wpt-fyi.yml
+++ b/.github/workflows/daily-wpt-fyi.yml
@@ -13,6 +13,7 @@ on:
- cron: 30 0 * * *
env:
+ # WPT's pywebsocket3 still uses CGIHTTPRequestHandler, removed in Python 3.15.
PYTHON_VERSION: '3.14'
permissions:
@@ -104,33 +105,15 @@ jobs:
else
echo "UNDICI_WPT=legacy" >> $GITHUB_ENV
fi
- # Checkout composite actions from the default branch since the
- # version-specific checkout above overwrites .github/actions/
- - name: Checkout undici WPT actions
- if: ${{ env.WPT_REPORT != '' }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- sparse-checkout: |
- .github/actions/undici-wpt-current
- .github/actions/undici-wpt-legacy
- sparse-checkout-cone-mode: false
- persist-credentials: false
- path: _wpt_actions
- clean: false
- - name: Place undici WPT actions
- if: ${{ env.WPT_REPORT != '' }}
- run: |
- mkdir -p .github/actions
- cp -r _wpt_actions/.github/actions/undici-wpt-* .github/actions/
- name: Run undici WPT (current)
if: ${{ env.UNDICI_WPT == 'current' }}
- uses: ./.github/actions/undici-wpt-current
+ uses: $/.github/actions/undici-wpt-current
with:
undici-version: ${{ env.UNDICI_VERSION }}
wpt-report: ${{ env.WPT_REPORT }}
- name: Run undici WPT (legacy)
if: ${{ env.UNDICI_WPT == 'legacy' }}
- uses: ./.github/actions/undici-wpt-legacy
+ uses: $/.github/actions/undici-wpt-legacy
with:
undici-version: ${{ env.UNDICI_VERSION }}
wpt-report: ${{ env.WPT_REPORT }}
@@ -139,7 +122,9 @@ jobs:
- name: Clone report for upload
if: ${{ env.WPT_REPORT != '' }}
working-directory: out/wpt
- run: cp wptreport.json wptreport-${{ steps.setup-node.outputs.node-version }}.json
+ run: cp wptreport.json "wptreport-$NODE_VERSION.json"
+ env:
+ NODE_VERSION: ${{ steps.setup-node.outputs.node-version }}
- name: Upload GitHub Actions artifact
if: ${{ env.WPT_REPORT != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -150,12 +135,13 @@ jobs:
- name: Upload WPT Report to wpt.fyi API
if: ${{ env.WPT_REPORT != '' }}
env:
+ NODE_VERSION: ${{ steps.setup-node.outputs.node-version }}
WPT_FYI_USERNAME: ${{ vars.WPT_FYI_USERNAME }}
WPT_FYI_PASSWORD: ${{ secrets.WPT_FYI_PASSWORD }}
working-directory: out/wpt
run: |
gzip wptreport.json
- echo "## Node.js ${{ steps.setup-node.outputs.node-version }}" >> $GITHUB_STEP_SUMMARY
+ echo "## Node.js $NODE_VERSION" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "WPT Revision: [\`${WPT_REVISION:0:7}\`](https://github.com/web-platform-tests/wpt/commits/$WPT_REVISION)" >> $GITHUB_STEP_SUMMARY
for WPT_FYI_ENDPOINT in "https://wpt.fyi/api/results/upload" "https://staging.wpt.fyi/api/results/upload"
diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml
index 03aa1fa9a8d0..3c50701224ca 100644
--- a/.github/workflows/label-pr.yml
+++ b/.github/workflows/label-pr.yml
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-slim
steps:
- - uses: nodejs/node-pr-labeler@d4cf1b8b9f23189c37917000e5e17e796c770a6b # v1
+ - uses: nodejs/node-pr-labeler@dfe5eb3b099a487644e32567a482744620876ab3 # v1
with:
repo-token: ${{ secrets.GH_USER_TOKEN }}
configuration-path: .github/label-pr-config.yml
diff --git a/.github/workflows/lint-release-proposal.yml b/.github/workflows/lint-release-proposal.yml
index 027aee336ace..9652eea91b89 100644
--- a/.github/workflows/lint-release-proposal.yml
+++ b/.github/workflows/lint-release-proposal.yml
@@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
NODE_VERSION: lts/*
permissions:
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
index 38980ecf6d93..fbfe118ef440 100644
--- a/.github/workflows/linters.yml
+++ b/.github/workflows/linters.yml
@@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
NODE_VERSION: lts/*
permissions:
@@ -41,6 +41,12 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
+ # Skip large vendored trees that lint-cpp does not use.
+ sparse-checkout: |
+ /*
+ !/deps/openssl/
+ !/deps/v8/
+ sparse-checkout-cone-mode: false
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
@@ -53,7 +59,8 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
- fetch-depth: 0
+ # The first parent of the PR merge commit is the base branch commit.
+ fetch-depth: 2
persist-credentials: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -70,7 +77,7 @@ jobs:
# because it is irrelevant. We already check if the formatter produced
# a diff in the next line.
# Refs: https://github.com/nodejs/node/pull/42764
- CLANG_FORMAT_START="$(git merge-base HEAD refs/remotes/origin/$GITHUB_BASE_REF)" \
+ CLANG_FORMAT_START=HEAD^ \
make format-cpp || true
git --no-pager diff --exit-code && EXIT_CODE="$?" || EXIT_CODE="$?"
if [ "$EXIT_CODE" != "0" ]
@@ -91,13 +98,29 @@ jobs:
with:
persist-credentials: false
- name: Use Node.js ${{ env.NODE_VERSION }}
+ id: setup-node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
+ cache: npm
+ cache-dependency-path: |
+ tools/doc/package-lock.json
+ tools/eslint/package-lock.json
+ tools/lint-md/package-lock.json
+ - name: Cache ESLint results
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
+ env:
+ # ESLint only invalidates its cache on config changes, so the key also
+ # covers the custom rules and the files they read.
+ cache-prefix: eslint-${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('eslint.config.mjs', '*/eslint.config_partial.mjs', 'tools/eslint/*', 'tools/eslint-rules/**', 'doc/api/errors.md', 'doc/api/deprecations.md') }}
+ with:
+ path: .eslintcache
+ key: ${{ env.cache-prefix }}-${{ github.sha }}
+ restore-keys: ${{ env.cache-prefix }}-
- name: Lint JavaScript files
run: |
set +e
- NODE=$(command -v node) make lint-js
+ NODE=$(command -v node) make lint-js ESLINT_CACHE_FLAGS='--cache --cache-strategy content'
EXIT_CODE="$?"
if [ "$EXIT_CODE" != "0" ]; then
echo
@@ -127,7 +150,7 @@ jobs:
- name: Lint markdown files
run: |
echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json"
- NODE=$(command -v node) make lint-md
+ NODE=$(command -v node) make lint-md ESLINT_CACHE_FLAGS='--cache --cache-strategy content'
env:
NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }}
lint-py:
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index 4a7415bc90e1..2663019bcc2a 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -76,6 +76,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: Upload to code-scanning
- uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
+ uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
sarif_file: results.sarif
diff --git a/.github/workflows/stress-test.yml b/.github/workflows/stress-test.yml
index af1df77fe5f8..1672fd6f445e 100644
--- a/.github/workflows/stress-test.yml
+++ b/.github/workflows/stress-test.yml
@@ -33,7 +33,7 @@ on:
type: string
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
XCODE_VERSION: '16.4'
CLANG_VERSION: '19'
RUSTC_VERSION: '1.82'
@@ -60,7 +60,7 @@ jobs:
path: node
- name: Install Clang ${{ env.CLANG_VERSION }}
if: runner.os == 'Linux'
- uses: ./node/.github/actions/install-clang
+ uses: $/.github/actions/install-clang
with:
clang-version: ${{ env.CLANG_VERSION }}
- name: Set up Xcode ${{ env.XCODE_VERSION }}
diff --git a/.github/workflows/test-internet.yml b/.github/workflows/test-internet.yml
index ee3a85d10fc9..c6a0266bc6f9 100644
--- a/.github/workflows/test-internet.yml
+++ b/.github/workflows/test-internet.yml
@@ -31,7 +31,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
FLAKY_TESTS: keep_retrying
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
diff --git a/.github/workflows/test-linux-quic.yml b/.github/workflows/test-linux-quic.yml
index c1a57509c0ba..ff3e6ce2e058 100644
--- a/.github/workflows/test-linux-quic.yml
+++ b/.github/workflows/test-linux-quic.yml
@@ -8,6 +8,7 @@ on:
- configure.py
- node.gyp
- node.gypi
+ - deps/v8/**
- deps/ngtcp2/**
- deps/nghttp3/**
- deps/openssl/**
@@ -30,7 +31,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
FLAKY_TESTS: keep_retrying
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml
index 03f349fbed9e..021a063f1baa 100644
--- a/.github/workflows/test-linux.yml
+++ b/.github/workflows/test-linux.yml
@@ -35,7 +35,7 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
FLAKY_TESTS: keep_retrying
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml
index 29b9d4b0b93a..4247a017ba4d 100644
--- a/.github/workflows/test-macos.yml
+++ b/.github/workflows/test-macos.yml
@@ -31,8 +31,8 @@ concurrency:
cancel-in-progress: true
env:
- PYTHON_VERSION: '3.14'
- XCODE_VERSION: '16.1'
+ PYTHON_VERSION: '3.15'
+ XCODE_VERSION: '16.4'
FLAKY_TESTS: keep_retrying
permissions:
@@ -43,7 +43,7 @@ jobs:
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
- runs-on: macos-14
+ runs-on: macos-15
env:
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} gcc
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} g++
diff --git a/.github/workflows/timezone-update.yml b/.github/workflows/timezone-update.yml
index 481c20da4e05..abe4516db4a7 100644
--- a/.github/workflows/timezone-update.yml
+++ b/.github/workflows/timezone-update.yml
@@ -40,14 +40,14 @@ jobs:
- name: Compare versions
run: |
- echo "Comparing current version ${{ env.current_version }} to new version ${{ env.new_version }}"
+ echo "Comparing current version $current_version to new version $new_version"
- run: ./tools/dep_updaters/update-timezone.mjs
if: ${{ env.new_version != env.current_version }}
- name: Update the expected timezone version in test
if: ${{ env.new_version != env.current_version }}
- run: echo "${{ env.new_version }}" > test/fixtures/tz-version.txt
+ run: printf '%s\n' "$new_version" > test/fixtures/tz-version.txt
- name: Open Pull Request
if: ${{ env.new_version != env.current_version }}
diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml
index 89ed96f31d2c..cd2e7dc8810e 100644
--- a/.github/workflows/tools.yml
+++ b/.github/workflows/tools.yml
@@ -44,7 +44,7 @@ on:
- zstd
env:
- PYTHON_VERSION: '3.14'
+ PYTHON_VERSION: '3.15'
permissions:
contents: read
@@ -304,7 +304,7 @@ jobs:
- name: Generate commit message if not set
if: env.COMMIT_MSG == '' && (github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id)
run: |
- echo "COMMIT_MSG=${{ matrix.subsystem }}: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}" >> "$GITHUB_ENV"
+ echo "COMMIT_MSG=${{ matrix.subsystem }}: update ${{ matrix.id }} to $NEW_VERSION" >> "$GITHUB_ENV"
- uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id
# Creates a PR or update the Action's existing PR, or
diff --git a/.github/workflows/update-openssl.yml b/.github/workflows/update-openssl.yml
index 10eb3289a1f7..b81a260312ba 100644
--- a/.github/workflows/update-openssl.yml
+++ b/.github/workflows/update-openssl.yml
@@ -27,6 +27,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
- name: Create PR with first commit
+ id: create-pull-request
if: env.NEW_VERSION
uses: gr2m/create-or-update-pull-request-action@b65137ca591da0b9f43bad7b24df13050ea45d1b # v1.10.1
# Creates a PR with the new OpenSSL source code committed
@@ -41,6 +42,7 @@ jobs:
title: 'deps: update OpenSSL to ${{ env.NEW_VERSION }}'
path: deps/openssl
update-pull-request-title-and-body: true
+ draft: true
- name: Regenerate platform specific files
if: env.NEW_VERSION
run: |
@@ -59,3 +61,9 @@ jobs:
branch: actions/tools-update-openssl # Custom branch *just* for this Action.
commit-message: 'deps: update archs files for openssl-${{ env.NEW_VERSION }}'
path: deps/openssl
+ - name: Mark PR as ready for review
+ if: env.NEW_VERSION
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
+ PR_ID: ${{ steps.create-pull-request.outputs.pull-request-number }}
+ run: gh --repo "$GITHUB_REPOSITORY" pr ready "$PR_ID"
diff --git a/.gitignore b/.gitignore
index 74eb99c8158c..c07942dd1bc6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,6 +103,11 @@ _UpgradeReport_Files/
tools/*/*.i
tools/*/*.i.tmp
+# === Rules for pgo artifacts ===
+*.profdata
+*.profraw
+*.gcda
+
# === Rules for release artifacts ===
/*.tar.*
/*.pkg
@@ -162,6 +167,7 @@ install_manifest.txt
# === Rules for AI assistants ===
CLAUDE.md
AGENTS.md
+AGENTS.override.md
# === Global Rules ===
# Keep last to avoid being excluded
diff --git a/BUILDING.md b/BUILDING.md
index 6770bd3711b5..b730b9206ca9 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -106,7 +106,7 @@ platforms. This is true regardless of entries in the table below.
| Operating System | Architectures | Versions | Support Type | Notes |
| ---------------- | ---------------- | --------------------------------- | ------------ | ------------------------------------ |
| GNU/Linux | x64 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10, RHEL 8 |
-| GNU/Linux | x64 | kernel >= 3.10, musl >= 1.1.19 | Experimental | e.g. Alpine 3.8 |
+| GNU/Linux | x64 | kernel >= 6.12, musl >= 1.2.5 | Tier 2 | e.g. Alpine 3.22 |
| GNU/Linux | x86 | kernel >= 3.10, glibc >= 2.17 | Experimental | Downgraded as of Node.js 10 |
| GNU/Linux | arm64 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10, RHEL 8 |
| GNU/Linux | armv7 | kernel >= 4.18[^1], glibc >= 2.28 | Experimental | Downgraded as of Node.js 24 |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81ef6a90e97b..a2459a2e56be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,7 +40,8 @@ release.
-24.22.3
+24.23.0
+24.22.3
24.22.2
24.22.1
24.22.0
diff --git a/LICENSE b/LICENSE
index 9cc3315dd388..e2bdb733465f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1184,8 +1184,8 @@ The externally maintained libraries used by Node.js are:
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2017 - 2025 R. Thomas
- Copyright 2017 - 2025 Quarkslab
+ Copyright 2017 - 2026 R. Thomas
+ Copyright 2017 - 2026 Quarkslab
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/Makefile b/Makefile
index 3672ac9be042..60e7033a8e76 100644
--- a/Makefile
+++ b/Makefile
@@ -1056,6 +1056,7 @@ HAS_XZ ?= $(shell command -v xz > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || ech
SKIP_XZ ?= 0
XZ = $(shell [ $(HAS_XZ) -eq 1 ] && [ $(SKIP_XZ) -eq 0 ] && echo 1 || echo 0)
XZ_COMPRESSION ?= 9e
+GZIP_COMPRESSION ?= 9
PKG=$(TARNAME).pkg
MACOSOUTDIR=out/macos
@@ -1189,7 +1190,7 @@ endif
--resources $(MACOSOUTDIR)/installer/productbuild/Resources \
--package-path $(MACOSOUTDIR)/pkgs ./$(PKG)
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh
- sh tools/osx-notarize.sh $(FULLVERSION)
+ sh tools/osx-notarize.sh $(PKG)
.PHONY: pkg
pkg: $(PKG) ## Build the macOS installer for releases.
@@ -1249,7 +1250,7 @@ $(TARBALL): release-only doc-only
find $(TARNAME)/ -type l | xargs $(RM)
tar -cf $(TARNAME).tar $(TARNAME)
$(RM) -r $(TARNAME)
- gzip -c -f -9 $(TARNAME).tar > $(TARNAME).tar.gz
+ gzip -c -f -$(GZIP_COMPRESSION) $(TARNAME).tar > $(TARNAME).tar.gz
ifeq ($(XZ), 1)
xz -c -f -$(XZ_COMPRESSION) $(TARNAME).tar > $(TARNAME).tar.xz
endif
@@ -1294,7 +1295,7 @@ $(TARBALL)-headers: release-only
find $(TARNAME)/ -type l | xargs $(RM)
tar -cf $(TARNAME)-headers.tar $(TARNAME)
$(RM) -r $(TARNAME)
- gzip -c -f -9 $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.gz
+ gzip -c -f -$(GZIP_COMPRESSION) $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.gz
ifeq ($(XZ), 1)
xz -c -f -$(XZ_COMPRESSION) $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.xz
endif
@@ -1336,10 +1337,11 @@ else
endif
ifeq ($(OSTYPE),darwin)
SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" sh tools/osx-codesign.sh
+ sh tools/osx-notarize.sh $(BINARYNAME)/bin/node
endif
tar -cf $(BINARYNAME).tar $(BINARYNAME)
$(RM) -r $(BINARYNAME)
- gzip -c -f -9 $(BINARYNAME).tar > $(BINARYNAME).tar.gz
+ gzip -c -f -$(GZIP_COMPRESSION) $(BINARYNAME).tar > $(BINARYNAME).tar.gz
ifeq ($(XZ), 1)
xz -c -f -$(XZ_COMPRESSION) $(BINARYNAME).tar > $(BINARYNAME).tar.xz
endif
@@ -1410,10 +1412,10 @@ format-md: tools/lint-md/node_modules/remark-parse/package.json ## Format the ma
@$(call available-node,$(run-format-md))
-
+ESLINT_CACHE_FLAGS ?= --cache
LINT_JS_TARGETS = eslint.config.mjs benchmark doc lib test tools
-run-lint-js = tools/eslint/node_modules/eslint/bin/eslint.js --cache \
+run-lint-js = tools/eslint/node_modules/eslint/bin/eslint.js $(ESLINT_CACHE_FLAGS) \
--max-warnings=0 --report-unused-disable-directives \
--concurrency auto $(LINT_JS_TARGETS)
run-lint-js-fix = $(run-lint-js) --fix
diff --git a/README.md b/README.md
index d90887e0f5d8..d14fba943dd0 100644
--- a/README.md
+++ b/README.md
@@ -445,6 +445,8 @@ For information about the governance of the Node.js project, see
**Vladimir Morozov** <> (he/him)
* [watilde](https://github.com/watilde) -
**Daijiro Wachi** <> (he/him)
+* [XadillaX](https://github.com/XadillaX) -
+ **Khaidi Chu** <> (he/him)
* [ZYSzys](https://github.com/ZYSzys) -
**Yongsheng Zhang** <> (he/him)
@@ -725,8 +727,6 @@ For information about the governance of the Node.js project, see
**Thomas Watson** <>
* [whitlockjc](https://github.com/whitlockjc) -
**Jeremy Whitlock** <>
-* [XadillaX](https://github.com/XadillaX) -
- **Khaidi Chu** <> (he/him)
* [yashLadha](https://github.com/yashLadha) -
**Yash Ladha** <> (he/him)
* [yhwang](https://github.com/yhwang) -
diff --git a/SECURITY.md b/SECURITY.md
index cdf2469343bb..eeb0e30033e9 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -242,7 +242,12 @@ then untrusted input must not lead to arbitrary JavaScript code execution.
* The developers and infrastructure that run it.
* The operating system that Node.js is running under and its configuration,
- along with anything under the control of the operating system.
+ along with anything under the control of the operating system. An attacker
+ who can already run commands on the host and uses an official, signed
+ Node.js binary to execute malicious JavaScript does not exploit a
+ vulnerability in Node.js. A code signature identifies the publisher of the
+ Node.js binary; it is not a statement about the trustworthiness of the
+ scripts that binary executes.
* The deployment network environment for the privacy of traffic and routing
decisions, including internal networks through which Node.js traffic passes
and configured HTTP(S) proxy servers. Built-in proxy support is intended to
diff --git a/android-configure b/android-configure
index 0467e7a90b79..d8d10c2f8f0d 100755
--- a/android-configure
+++ b/android-configure
@@ -4,6 +4,7 @@
# Note that the mix of single and double quotes is intentional,
# as is the fact that the ] goes on a new line.
_=[ 'exec' '/bin/sh' '-c' '''
+command -v python3.15 >/dev/null && exec python3.15 "$0" "$@"
command -v python3.14 >/dev/null && exec python3.14 "$0" "$@"
command -v python3.13 >/dev/null && exec python3.13 "$0" "$@"
command -v python3.12 >/dev/null && exec python3.12 "$0" "$@"
@@ -23,7 +24,7 @@ except ImportError:
from distutils.spawn import find_executable as which
print('Node.js android configure: Found Python {}.{}.{}...'.format(*sys.version_info))
-acceptable_pythons = ((3, 14), (3, 13), (3, 12), (3, 11), (3, 10), (3, 9))
+acceptable_pythons = ((3, 15), (3, 14), (3, 13), (3, 12), (3, 11), (3, 10), (3, 9))
if sys.version_info[:2] in acceptable_pythons:
import android_configure
else:
diff --git a/benchmark/buffers/buffer-read-with-byteLength.js b/benchmark/buffers/buffer-read-with-byteLength.js
index 57e46b8ce445..1b88663f7fc1 100644
--- a/benchmark/buffers/buffer-read-with-byteLength.js
+++ b/benchmark/buffers/buffer-read-with-byteLength.js
@@ -9,14 +9,14 @@ const types = [
];
const bench = common.createBenchmark(main, {
- buffer: ['fast'],
+ buffer: ['fast', 'slow'],
type: types,
n: [1e6],
- byteLength: [1, 2, 3, 4, 5, 6],
+ byteLength: [1, 2, 4, 6],
});
-function main({ n, buf, type, byteLength }) {
- const buff = buf === 'fast' ?
+function main({ n, buffer, type, byteLength }) {
+ const buff = buffer === 'fast' ?
Buffer.alloc(8) :
require('buffer').SlowBuffer(8);
const fn = `read${type}`;
diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js
index f3b2a5645174..a0b037f09f91 100644
--- a/benchmark/buffers/buffer-read.js
+++ b/benchmark/buffers/buffer-read.js
@@ -19,13 +19,13 @@ const types = [
];
const bench = common.createBenchmark(main, {
- buffer: ['fast'],
+ buffer: ['fast', 'slow'],
type: types,
n: [1e6],
});
-function main({ n, buf, type }) {
- const buff = buf === 'fast' ?
+function main({ n, buffer, type }) {
+ const buff = buffer === 'fast' ?
Buffer.alloc(8) :
require('buffer').SlowBuffer(8);
const fn = `read${type}`;
diff --git a/benchmark/buffers/buffer-stringlength.js b/benchmark/buffers/buffer-stringlength.js
new file mode 100644
index 000000000000..00fc5c35026e
--- /dev/null
+++ b/benchmark/buffers/buffer-stringlength.js
@@ -0,0 +1,28 @@
+'use strict';
+
+const common = require('../common.js');
+const { Buffer } = require('node:buffer');
+const assert = require('node:assert');
+
+const bench = common.createBenchmark(main, {
+ n: [1e6],
+ encoding: ['utf8', 'latin1', 'base64'],
+ len: [32, 4096, 1048576],
+ input: ['ascii', 'multibyte', 'invalid'],
+});
+
+function main({ n, encoding, len, input }) {
+ let buf;
+ if (input === 'ascii') {
+ buf = Buffer.alloc(len, 'a');
+ } else {
+ buf = Buffer.alloc(len - (len % 3), '€');
+ if (input === 'invalid') buf = Buffer.concat([buf, Buffer.from([0xE2, 0x82])]);
+ }
+ const expected = buf.toString(encoding).length;
+ bench.start();
+ for (let i = 0; i < n; ++i) {
+ assert.strictEqual(Buffer.stringLength(buf, encoding), expected);
+ }
+ bench.end(n);
+}
diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js
index 239abc8a0da6..2518dec3eb41 100644
--- a/benchmark/buffers/buffer-write.js
+++ b/benchmark/buffers/buffer-write.js
@@ -27,7 +27,7 @@ const types = [
];
const bench = common.createBenchmark(main, {
- buffer: ['fast'],
+ buffer: ['fast', 'slow'],
type: types,
n: [1e6],
});
@@ -70,8 +70,8 @@ const byteLength = {
writeIntBE: 6,
};
-function main({ n, buf, type }) {
- const buff = buf === 'fast' ?
+function main({ n, buffer, type }) {
+ const buff = buffer === 'fast' ?
Buffer.alloc(8) :
require('buffer').SlowBuffer(8);
const fn = `write${type}`;
diff --git a/benchmark/crypto/timingSafeEqual.js b/benchmark/crypto/timingSafeEqual.js
index 475807dba4ea..bd8962a3bdf4 100644
--- a/benchmark/crypto/timingSafeEqual.js
+++ b/benchmark/crypto/timingSafeEqual.js
@@ -7,10 +7,14 @@ const { randomBytes, timingSafeEqual } = require('node:crypto');
const bench = common.createBenchmark(main, {
n: [1e5],
bufferSize: [10, 100, 200, 2_100, 22_023],
+}, {
+ test: { bufferSize: 256 },
});
function main({ n, bufferSize }) {
const bufs = [randomBytes(bufferSize), randomBytes(bufferSize)];
+ // Ensure the buffers differ even if the random bytes are identical.
+ bufs[1][0] = bufs[0][0] ^ 1;
bench.start();
let count = 0;
for (let i = 0; i < n; i++) {
diff --git a/benchmark/crypto/webcrypto-digest.js b/benchmark/crypto/webcrypto-digest.js
index f5ef8e6bc493..e25181a3c3d6 100644
--- a/benchmark/crypto/webcrypto-digest.js
+++ b/benchmark/crypto/webcrypto-digest.js
@@ -33,8 +33,6 @@ function measureLegacy(n, data, method) {
}
function measureSubtle(n, data, method) {
- const ec = new TextEncoder();
- data = ec.encode(data);
const jobs = new Array(n);
bench.start();
for (let i = 0; i < n; i++)
diff --git a/benchmark/crypto/webcrypto-export.js b/benchmark/crypto/webcrypto-export.js
new file mode 100644
index 000000000000..4d96b54ec74d
--- /dev/null
+++ b/benchmark/crypto/webcrypto-export.js
@@ -0,0 +1,47 @@
+'use strict';
+
+const common = require('../common.js');
+const fixtures = require('../../test/common/fixtures.js');
+const { createPrivateKey, createPublicKey, subtle } = require('node:crypto');
+
+const bench = common.createBenchmark(main, {
+ keyType: ['hmac', 'aes-gcm', 'ecdsa-private', 'rsa-private', 'rsa-public'],
+ n: [1e5],
+});
+
+async function createKey(keyType) {
+ switch (keyType) {
+ case 'hmac':
+ return subtle.importKey(
+ 'raw', new Uint8Array(32), { name: 'HMAC', hash: 'SHA-256' },
+ true, ['sign', 'verify']);
+ case 'aes-gcm':
+ return subtle.importKey(
+ 'raw', new Uint8Array(32), 'AES-GCM',
+ true, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']);
+ case 'ecdsa-private':
+ return createPrivateKey(fixtures.readKey('ec_p256_private.pem'))
+ .toCryptoKey({ name: 'ECDSA', namedCurve: 'P-256' }, true, ['sign']);
+ case 'rsa-private':
+ return createPrivateKey(fixtures.readKey('rsa_private_2048.pem'))
+ .toCryptoKey({ name: 'RSA-PSS', hash: 'SHA-256' }, true, ['sign']);
+ case 'rsa-public':
+ return createPublicKey(fixtures.readKey('rsa_private_2048.pem'))
+ .toCryptoKey({ name: 'RSA-PSS', hash: 'SHA-256' }, true, ['verify']);
+ default:
+ throw new Error(`Unsupported key type: ${keyType}`);
+ }
+}
+
+async function main({ n, keyType }) {
+ const key = await createKey(keyType);
+ let result;
+
+ bench.start();
+ for (let i = 0; i < n; i++)
+ result = await subtle.exportKey('jwk', key);
+ bench.end(n);
+
+ if (result.kty === undefined)
+ throw new Error('Missing key type');
+}
diff --git a/benchmark/fixtures/coverage-many-branches.js b/benchmark/fixtures/coverage-many-branches.js
index 9cb6360336e0..45f9c4b7f525 100644
--- a/benchmark/fixtures/coverage-many-branches.js
+++ b/benchmark/fixtures/coverage-many-branches.js
@@ -30,7 +30,7 @@ class CoveredClass {
}
}
-// Excercise coverage of functions:
+// Exercise coverage of functions:
function add(x, y) {
const mt = new CoveredClass(x, y);
return mt.add();
diff --git a/benchmark/fixtures/simple-http-server.js b/benchmark/fixtures/simple-http-server.js
index fb5b0d87c16e..808ee7e4b2dc 100644
--- a/benchmark/fixtures/simple-http-server.js
+++ b/benchmark/fixtures/simple-http-server.js
@@ -114,6 +114,12 @@ module.exports = http.createServer((req, res) => {
else
res.writeHead(status, { 'Content-Length': len.toString() });
break;
+ case 'setHeaderImplicit':
+ // Let end() derive the message framing: no Content-Length or
+ // Transfer-Encoding header and no writeHead() call.
+ res.statusCode = status;
+ res.setHeader('Content-Type', 'text/plain');
+ break;
default:
if (chunkedEnc) {
res.writeHead(status, {
diff --git a/benchmark/http/get-raw-header-names.js b/benchmark/http/get-raw-header-names.js
new file mode 100644
index 000000000000..27c996d7ebb9
--- /dev/null
+++ b/benchmark/http/get-raw-header-names.js
@@ -0,0 +1,33 @@
+'use strict';
+
+const common = require('../common.js');
+const assert = require('node:assert');
+const { OutgoingMessage } = require('node:http');
+
+const bench = common.createBenchmark(main, {
+ n: [1e6],
+ headers: [0, 1, 4, 16, 64],
+});
+
+function main({ n, headers }) {
+ const message = new OutgoingMessage();
+ const expected = [];
+ for (let index = 0; index < headers; index++) {
+ const name = `X-Header-${index}`;
+ message.setHeader(name, 'value');
+ expected.push(name);
+ }
+
+ for (let index = 0; index < 1e4; index++) {
+ message.getRawHeaderNames();
+ }
+
+ let result;
+ bench.start();
+ for (let index = 0; index < n; index++) {
+ result = message.getRawHeaderNames();
+ }
+ bench.end(n);
+
+ assert.deepStrictEqual(result, expected);
+}
diff --git a/benchmark/http/incoming_headers.js b/benchmark/http/incoming_headers.js
index 21e15fcd7d69..8a1b8bf7de7a 100644
--- a/benchmark/http/incoming_headers.js
+++ b/benchmark/http/incoming_headers.js
@@ -6,16 +6,20 @@ const bench = common.createBenchmark(main, {
connections: [50], // Concurrent connections
headers: [20], // Number of header lines to append after the common headers
w: [0, 6], // Amount of trailing whitespace
+ read: [0, 1], // Whether the handler reads req.headers
duration: 5,
});
-function main({ connections, headers, w, duration }) {
+function main({ connections, headers, w, read, duration }) {
const server = http.createServer((req, res) => {
+ if (read && req.headers.host === undefined) {
+ throw new Error('Missing Host header');
+ }
res.end();
});
server.listen(0, () => {
- const headers = {
+ const requestHeaders = {
'Content-Type': 'text/plain',
'Accept': 'text/plain',
'User-Agent': 'nodejs-benchmark',
@@ -28,12 +32,12 @@ function main({ connections, headers, w, duration }) {
// - wrk can only send trailing OWS. This is a side-effect of wrk
// processing requests with http-parser before sending them, causing
// leading OWS to be stripped.
- headers[`foo${i}`] = `some header value ${i}${' \t'.repeat(w / 2)}`;
+ requestHeaders[`foo${i}`] = `some header value ${i}${' \t'.repeat(w / 2)}`;
}
bench.http({
path: '/',
connections,
- headers,
+ headers: requestHeaders,
duration,
port: server.address().port,
}, () => {
diff --git a/benchmark/http/is_valid_header.js b/benchmark/http/is_valid_header.js
new file mode 100644
index 000000000000..cefe5c1f87ce
--- /dev/null
+++ b/benchmark/http/is_valid_header.js
@@ -0,0 +1,120 @@
+'use strict';
+
+// Compares the non-throwing header validators (http.isValidHeaderName() and
+// http.isValidHeaderValue()) with the throwing ones (http.validateHeaderName()
+// and http.validateHeaderValue()) used inside try/catch.
+
+const common = require('../common.js');
+const assert = require('assert');
+const {
+ isValidHeaderName,
+ isValidHeaderValue,
+ validateHeaderName,
+ validateHeaderValue,
+} = require('http');
+
+const inputs = {
+ name: {
+ valid: [
+ 'ETag', 'date', 'Vary', 'server', 'Expires', 'location', 'Connection',
+ 'content-type', 'Cache-Control', 'content-length', 'x-frame-options',
+ 'Transfer-Encoding', 'x-request-id',
+ ],
+ invalid: [
+ '', ':', 'bad header', 'x-forwarded-fםr', '中文呢', '((((())))',
+ ':alternate-protocol', 'alternate-protocol:', 'x\r\ninjected',
+ ],
+ },
+ value: {
+ valid: [
+ 'W/"2-d4cbb29"', 'OK', 'Express', 'application/json',
+ 'application/json; charset=utf-8', 'sessionid=; Path=/',
+ 'text/html; charset=utf-8', '10', 'max-age=0, no-cache', 'gzip, br',
+ ],
+ // Invalid under both 'strict' and 'relaxed' validation.
+ invalid: [
+ 'a\r\nb', 'value\n', 'cr\r', 'nul\0byte', 'לא תקין', 'emoji \u{1F600}',
+ 'x'.repeat(64) + '\r\n',
+ ],
+ },
+};
+
+const bench = common.createBenchmark(main, {
+ method: [
+ 'isValidHeaderName',
+ 'validateHeaderName',
+ 'isValidHeaderValue',
+ 'validateHeaderValue',
+ ],
+ input: ['valid', 'invalid'],
+ httpValidation: ['strict', 'relaxed'],
+ n: [1e6],
+}, {
+ // httpValidation only applies to isValidHeaderValue().
+ combinationFilter: (p) =>
+ p.httpValidation === 'strict' || p.method === 'isValidHeaderValue',
+});
+
+function main({ n, method, input, httpValidation }) {
+ let valid = 0;
+
+ switch (method) {
+ case 'isValidHeaderName': {
+ const list = inputs.name[input];
+ const len = list.length;
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ if (isValidHeaderName(list[i % len])) valid++;
+ }
+ bench.end(n);
+ break;
+ }
+ case 'validateHeaderName': {
+ const list = inputs.name[input];
+ const len = list.length;
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ try {
+ validateHeaderName(list[i % len]);
+ valid++;
+ } catch {
+ // Invalid name.
+ }
+ }
+ bench.end(n);
+ break;
+ }
+ case 'isValidHeaderValue': {
+ const list = inputs.value[input];
+ const len = list.length;
+ const options = httpValidation === 'strict' ? undefined : { httpValidation };
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ if (isValidHeaderValue(list[i % len], options)) valid++;
+ }
+ bench.end(n);
+ break;
+ }
+ case 'validateHeaderValue': {
+ const list = inputs.value[input];
+ const len = list.length;
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ try {
+ validateHeaderValue('x-header', list[i % len]);
+ valid++;
+ } catch {
+ // Invalid value.
+ }
+ }
+ bench.end(n);
+ break;
+ }
+ default:
+ throw new Error(`Unexpected method: ${method}`);
+ }
+
+ // Consume the result so the loop cannot be optimized away, and make sure
+ // the inputs are what they claim to be.
+ assert.strictEqual(valid, input === 'valid' ? n : 0);
+}
diff --git a/benchmark/http/set-header.js b/benchmark/http/set-header.js
index 8bf00b84ad0a..0936c1309e2d 100644
--- a/benchmark/http/set-header.js
+++ b/benchmark/http/set-header.js
@@ -2,7 +2,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- res: ['normal', 'setHeader', 'setHeaderWH'],
+ res: ['normal', 'setHeader', 'setHeaderWH', 'setHeaderImplicit'],
duration: 5,
});
@@ -15,6 +15,7 @@ const c = 50;
// normal: writeHead(status, {...})
// setHeader: statusCode = status, setHeader(...) x2
// setHeaderWH: setHeader(...), writeHead(status, ...)
+// setHeaderImplicit: statusCode = status, setHeader(...) x1, framing left to end()
function main({ res, duration }) {
const server = require('../fixtures/simple-http-server.js')
.listen(0)
diff --git a/benchmark/http2/get-headers.js b/benchmark/http2/get-headers.js
new file mode 100644
index 000000000000..a0732d92d7c9
--- /dev/null
+++ b/benchmark/http2/get-headers.js
@@ -0,0 +1,46 @@
+'use strict';
+
+const common = require('../common.js');
+const assert = require('node:assert');
+const http2 = require('node:http2');
+
+const bench = common.createBenchmark(main, {
+ n: [1e6],
+ headers: [0, 1, 4, 16, 64],
+});
+
+function main({ n, headers }) {
+ const server = http2.createServer();
+ server.on('request', (request, response) => {
+ const expected = { __proto__: null };
+ for (let index = 0; index < headers; index++) {
+ const name = `x-header-${index}`;
+ response.setHeader(name, 'value');
+ expected[name] = 'value';
+ }
+
+ for (let index = 0; index < 1e4; index++) {
+ response.getHeaders();
+ }
+
+ let result;
+ bench.start();
+ for (let index = 0; index < n; index++) {
+ result = response.getHeaders();
+ }
+ bench.end(n);
+ assert.deepStrictEqual(result, expected);
+ response.end();
+ });
+
+ server.listen(0, '127.0.0.1', () => {
+ const client = http2.connect(`http://127.0.0.1:${server.address().port}`);
+ const request = client.request();
+ request.resume();
+ request.on('end', () => {
+ client.close();
+ server.close();
+ });
+ request.end();
+ });
+}
diff --git a/benchmark/mime/mimetype-parse.js b/benchmark/mime/mimetype-parse.js
new file mode 100644
index 000000000000..2aec20ceb062
--- /dev/null
+++ b/benchmark/mime/mimetype-parse.js
@@ -0,0 +1,53 @@
+'use strict';
+
+const common = require('../common');
+const assert = require('assert');
+const { MIMEType } = require('util');
+
+const bench = common.createBenchmark(main, {
+ n: [1e5],
+ value: [
+ 'application/json',
+ 'text/html; charset=utf-8',
+ 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW',
+ 'text/plain; charset="utf-8"; foo="b\\"ar"; x=y',
+ 'not a mime type',
+ ],
+ operation: ['parse', 'essence', 'params.get'],
+});
+
+function main({ n, value, operation }) {
+ const length = 1024;
+ const array = [];
+ let fn;
+ switch (operation) {
+ case 'parse':
+ fn = () => MIMEType.parse(value);
+ break;
+ case 'essence':
+ fn = () => MIMEType.parse(value)?.essence ?? null;
+ break;
+ case 'params.get':
+ fn = () => MIMEType.parse(value)?.params.get('charset') ?? null;
+ break;
+ default:
+ throw new Error(`Unsupported operation ${operation}`);
+ }
+
+ // Warm up.
+ for (let i = 0; i < length; ++i) {
+ array.push(fn());
+ }
+
+ bench.start();
+ for (let i = 0; i < n; ++i) {
+ array[i % length] = fn();
+ }
+ bench.end(n);
+
+ // Verify the entries to prevent dead code elimination from making
+ // the benchmark invalid.
+ for (let i = 0; i < length; ++i) {
+ assert.notStrictEqual(array[i], undefined);
+ }
+}
diff --git a/benchmark/misc/startup-cli-version.js b/benchmark/misc/startup-cli-version.js
index a553f90621f4..f67be6263feb 100644
--- a/benchmark/misc/startup-cli-version.js
+++ b/benchmark/misc/startup-cli-version.js
@@ -8,7 +8,7 @@ const path = require('path');
// checked into the source code. We use --version because the output
// tends to be minimal and fewer operations are done to generate
// these so that the startup cost is still dominated by a more
-// indispensible part of the CLI.
+// indispensable part of the CLI.
// NOTE: not all tools are present in tarball hence need to filter
const availableCli = [
'tools/eslint/node_modules/eslint/bin/eslint.js',
diff --git a/benchmark/misc/structured-clone.js b/benchmark/misc/structured-clone.js
index 257671df44b0..38c0d0aed232 100644
--- a/benchmark/misc/structured-clone.js
+++ b/benchmark/misc/structured-clone.js
@@ -4,7 +4,7 @@ const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
- type: ['string', 'object', 'arraybuffer'],
+ type: ['int', 'string', 'object', 'arraybuffer'],
n: [1e4],
});
@@ -12,6 +12,11 @@ function main({ n, type }) {
const data = [];
switch (type) {
+ case 'int':
+ for (let i = 0; i < n; ++i) {
+ data.push(i);
+ }
+ break;
case 'string':
for (let i = 0; i < n; ++i) {
data.push(new Date().toISOString());
diff --git a/benchmark/misc/webcrypto-util.js b/benchmark/misc/webcrypto-util.js
new file mode 100644
index 000000000000..581602ab347f
--- /dev/null
+++ b/benchmark/misc/webcrypto-util.js
@@ -0,0 +1,117 @@
+'use strict';
+
+const common = require('../common.js');
+
+const inputs = [
+ 'arraybuffer',
+ 'uint8array',
+ 'dataview',
+ 'buffer',
+ 'sharedview',
+ 'empty-arraybuffer',
+ 'empty-uint8array',
+ 'empty-dataview',
+ 'detached-arraybuffer',
+ 'detached-uint8array',
+ 'detached-dataview',
+];
+
+const bench = common.createBenchmark(main, {
+ op: [
+ ...inputs.flatMap((input) => [`byteLength:${input}`, `bytes:${input}`]),
+ 'truncate:arraybuffer:100',
+ 'truncate:arraybuffer:128',
+ 'truncate:uint8array:100',
+ 'truncate:uint8array:128',
+ 'usages:0',
+ 'usages:1',
+ 'usages:2',
+ 'usages:4',
+ ],
+ n: [1e6],
+}, { flags: ['--expose-internals'] });
+
+function createInput(input) {
+ const empty = input.startsWith('empty-');
+ const detached = input.startsWith('detached-');
+ const type = input.replace(/^(empty|detached)-/, '');
+ const size = empty ? 0 : 32;
+ const buffer = new ArrayBuffer(size + 16);
+ let value;
+ switch (type) {
+ case 'arraybuffer':
+ value = new ArrayBuffer(size);
+ break;
+ case 'uint8array':
+ value = new Uint8Array(buffer, 8, size);
+ break;
+ case 'dataview':
+ value = new DataView(buffer, 8, size);
+ break;
+ case 'buffer':
+ value = Buffer.from(buffer, 8, size);
+ break;
+ case 'sharedview':
+ value = new Uint8Array(new SharedArrayBuffer(size));
+ break;
+ default:
+ throw new Error(`Unsupported input: ${input}`);
+ }
+ if (detached) {
+ const backing = type === 'arraybuffer' ? value : buffer;
+ structuredClone(backing, { transfer: [backing] });
+ }
+ return value;
+}
+
+function main({ n, op }) {
+ const {
+ getBufferSourceByteLength,
+ getBufferSourceBytes,
+ getUsagesFromMask,
+ getUsagesMask,
+ truncateToBitLength,
+ } = require('internal/crypto/util');
+ const [operation, input, length] = op.split(':');
+ let run;
+ switch (operation) {
+ case 'byteLength': {
+ const value = createInput(input);
+ run = () => getBufferSourceByteLength(value);
+ break;
+ }
+ case 'bytes': {
+ const value = createInput(input);
+ run = () => getBufferSourceBytes(value);
+ break;
+ }
+ case 'truncate': {
+ const value = createInput(input);
+ const bits = Number(length);
+ run = () => truncateToBitLength(bits, value);
+ break;
+ }
+ case 'usages': {
+ const usages = {
+ 0: [],
+ 1: ['sign'],
+ 2: ['sign', 'verify'],
+ 4: ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey'],
+ };
+ const mask = getUsagesMask(usages[input]);
+ run = () => getUsagesFromMask(mask);
+ break;
+ }
+ default:
+ throw new Error(`Unsupported operation: ${operation}`);
+ }
+
+ let result;
+ bench.start();
+ for (let i = 0; i < n; i++)
+ result = run();
+ bench.end(n);
+
+ if (result === undefined)
+ throw new Error('Missing benchmark result');
+}
diff --git a/benchmark/misc/webcrypto-webidl.js b/benchmark/misc/webcrypto-webidl.js
index 0f6275ed0951..318ea7982071 100644
--- a/benchmark/misc/webcrypto-webidl.js
+++ b/benchmark/misc/webcrypto-webidl.js
@@ -6,6 +6,13 @@ const bench = common.createBenchmark(main, {
op: [
'normalizeAlgorithm-string',
'normalizeAlgorithm-dict',
+ 'normalizeAlgorithm-validate-aes-gcm',
+ 'normalizeAlgorithm-validate-aes-cbc',
+ 'normalizeAlgorithm-validate-aes-ctr',
+ 'normalizeAlgorithm-validate-aes-generate',
+ 'normalizeAlgorithm-validate-hkdf',
+ 'normalizeAlgorithm-validate-hmac',
+ 'normalizeAlgorithm-validate-rsa',
'webidl-dict',
'webidl-algorithm-identifier-string',
'webidl-algorithm-identifier-object',
@@ -17,7 +24,7 @@ const bench = common.createBenchmark(main, {
}, { flags: ['--expose-internals'] });
function main({ n, op }) {
- const { normalizeAlgorithm } = require('internal/crypto/util');
+ const { normalizeAlgorithm, validateAlgorithm } = require('internal/crypto/util');
switch (op) {
case 'normalizeAlgorithm-string': {
@@ -37,6 +44,54 @@ function main({ n, op }) {
bench.end(n);
break;
}
+ case 'normalizeAlgorithm-validate-aes-gcm':
+ case 'normalizeAlgorithm-validate-aes-cbc':
+ case 'normalizeAlgorithm-validate-aes-ctr':
+ case 'normalizeAlgorithm-validate-aes-generate':
+ case 'normalizeAlgorithm-validate-hkdf':
+ case 'normalizeAlgorithm-validate-hmac':
+ case 'normalizeAlgorithm-validate-rsa': {
+ const cases = {
+ 'aes-gcm': [
+ { name: 'AES-GCM', iv: new Uint8Array(12), tagLength: 128 },
+ 'encrypt',
+ ],
+ 'aes-cbc': [
+ { name: 'AES-CBC', iv: new Uint8Array(16) },
+ 'encrypt',
+ ],
+ 'aes-ctr': [
+ { name: 'AES-CTR', counter: new Uint8Array(16), length: 64 },
+ 'encrypt',
+ ],
+ 'aes-generate': [{ name: 'AES-GCM', length: 256 }, 'generateKey'],
+ 'hkdf': [
+ {
+ name: 'HKDF', hash: 'SHA-256',
+ salt: new Uint8Array(32), info: new Uint8Array(32),
+ },
+ 'deriveBits',
+ ],
+ 'hmac': [{ name: 'HMAC', hash: 'SHA-256', length: 256 }, 'importKey'],
+ 'rsa': [
+ {
+ name: 'RSA-PSS', hash: 'SHA-256', modulusLength: 2048,
+ publicExponent: new Uint8Array([1, 0, 1]),
+ },
+ 'generateKey',
+ ],
+ };
+ const name = op.slice('normalizeAlgorithm-validate-'.length);
+ const [input, operation] = cases[name];
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ const normalized = normalizeAlgorithm(input, operation);
+ // Older revisions validate inside normalizeAlgorithm.
+ validateAlgorithm?.(normalized, operation);
+ }
+ bench.end(n);
+ break;
+ }
case 'webidl-dict': {
// WebIDL dictionary converter in isolation.
const webidl = require('internal/crypto/webidl');
@@ -85,7 +140,7 @@ function main({ n, op }) {
break;
}
case 'webidl-dict-ensure-sha': {
- // Exercises ensureSHA on a hash member.
+ // Converts a dictionary containing a hash identifier.
const webidl = require('internal/crypto/webidl');
const input = { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' };
const opts = { prefix: 'test', context: 'test' };
diff --git a/benchmark/napi/make_callback/.gitignore b/benchmark/napi/make_callback/.gitignore
new file mode 100644
index 000000000000..567609b1234a
--- /dev/null
+++ b/benchmark/napi/make_callback/.gitignore
@@ -0,0 +1 @@
+build/
diff --git a/benchmark/napi/make_callback/binding.cc b/benchmark/napi/make_callback/binding.cc
new file mode 100644
index 000000000000..85d335170fb0
--- /dev/null
+++ b/benchmark/napi/make_callback/binding.cc
@@ -0,0 +1,58 @@
+#include
+#include
+#include
+
+using v8::Context;
+using v8::Function;
+using v8::FunctionCallbackInfo;
+using v8::Global;
+using v8::HandleScope;
+using v8::Isolate;
+using v8::Local;
+using v8::Object;
+using v8::Value;
+
+struct State {
+ uv_timer_t timer;
+ Isolate* isolate;
+ int64_t n;
+ Global fn;
+ Global done;
+};
+
+static void OnTimer(uv_timer_t* handle) {
+ State* state = static_cast(handle->data);
+ Isolate* isolate = state->isolate;
+ HandleScope handle_scope(isolate);
+ Local fn = state->fn.Get(isolate);
+ Local context = fn->GetCreationContextChecked(isolate);
+ Context::Scope context_scope(context);
+ Local |