node/test/fixtures
Joyee Cheung af5c144ebc
deps,build,test: fix array index hash collision
This enables v8_enable_seeded_array_index_hash and add a test for it.

Fixes: https://hackerone.com/reports/3511792

deps: V8: backport 0a8b1cdcc8b2

Original commit message:

    implement rapidhash secret generation

    Bug: 409717082
    Change-Id: I471f33d66de32002f744aeba534c1d34f71e27d2
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6733490
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: snek <snek@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#101499}

Refs: 0a8b1cdcc8
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>

deps: V8: backport 185f0fe09b72

Original commit message:

    [numbers] Refactor HashSeed as a lightweight view over ByteArray

    Instead of copying the seed and secrets into a struct with value
    fields, HashSeed now stores a pointer pointing either into the
    read-only ByteArray, or the static default seed for off-heap
    HashSeed::Default() calls. The underlying storage is always
    8-byte aligned so we can cast it directly into a struct.

    Change-Id: I5896a7f2ae24296eb4c80b757a5d90ac70a34866
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7609720
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/main@{#105531}

Refs: 185f0fe09b
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>

deps: V8: backport 1361b2a49d02

Original commit message:

    [strings] improve array index hash distribution

    Previously, the hashes stored in a Name's raw_hash_field for decimal
    numeric strings (potential array indices) consist of the literal
    integer value along with the length of the string. This means
    consecutive numeric strings can have consecutive hash values, which
    can lead to O(n^2) probing for insertion in the worst case when e.g.
    a non-numeric string happen to land in the these buckets.

    This patch adds a build-time flag v8_enable_seeded_array_index_hash that
    scrambles the 24-bit array-index value stored in a Name's raw_hash_field
    to improve the distribution.

    x ^= x >> kShift; x = (x * m1) & kMask;    // round 1
    x ^= x >> kShift; x = (x * m2) & kMask;    // round 2
    x ^= x >> kShift;                          // finalize

    To decode, apply the same steps with the modular inverses of m1 and m2
    in reverse order.

    x ^= x >> kShift; x = (x * m2_inv) & kMask;    // round 1
    x ^= x >> kShift; x = (x * m1_inv) & kMask;    // round 2
    x ^= x >> kShift;                              // finalize

    where kShift = kArrayIndexValueBits / 2, kMask = kArrayIndexValueMask,
    m1, m2 (both odd) are the lower bits of the rapidhash secrets, m1_inv,
    m2_inv (modular inverses) are precomputed modular inverse of m1 and m2.
    The pre-computed values are appended to the hash_seed ByteArray in
    ReadOnlyRoots and accessed in generated code to reduce overhead.
    In call sites that don't already have access to the seeds, we read them
    from the current isolate group/isolate's read only roots.

    To consolidate the code that encode/decode these hashes, this patch
    adds MakeArrayIndexHash/DecodeArrayIndexFromHashField in C++ and CSA
    that perform seeding/unseeding if enabled, and updates places where
    encoding/decoding of array index is needed to use them.

    Bug: 477515021
    Change-Id: I350afe511951a54c4378396538152cc56565fd55
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7564330
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/main@{#105596}

Refs: 1361b2a49d
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>

deps: V8: cherry-pick aac14dd95e5b

Original commit message:

    [string] add 3rd round to seeded array index hash

    Since we already have 3 derived secrets, and arithmetics are
    relatively cheap, add a 3rd round to the xorshift-multiply
    seeding scheme. This brings the bias from ~3.4 to ~0.4.

    Bug: 477515021
    Change-Id: I1ef48954bcee8768d8c90db06ac8adb02f06cebf
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7655117
    Reviewed-by: Chengzhong Wu <cwu631@bloomberg.net>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#105824}

Refs: aac14dd95e
PR-URL: https://github.com/nodejs-private/node-private/pull/834
CVE-ID: CVE-2026-21717
2026-03-23 18:45:35 +01:00
..
0-dns
apilinks
b
clustered-server
console
copy test: add test that uses multibyte for path and resolves modules 2025-03-06 13:38:16 +01:00
crypto
cycles
debugger
dotenv util: fix parseEnv incorrectly splitting multiple ‘=‘ in value 2025-08-27 19:20:40 +02:00
errors src: fix undefined script name in error source 2025-03-06 13:38:08 +01:00
es-module-loaders module: unflag --experimental-require-module 2025-02-11 11:56:31 +01:00
es-module-require-cache
es-module-shadow-realm module: bootstrap module loaders in shadow realm 2024-01-09 08:23:01 +00:00
es-module-specifiers
es-module-url
es-modules module: handle instantiated async module jobs in require(esm) 2025-08-27 19:20:44 +02:00
eval test: migrate message eval tests from Python to JS 2025-03-06 13:38:04 +01:00
GH-7131
global
icu deps: update icu to 78.2 2026-03-04 10:41:45 +01:00
import-require-cycle module: allow cycles in require() in the CJS handling in ESM loader 2025-08-27 19:20:44 +02:00
inspector-instrumentation-breakpoint test: add Debugger.setInstrumentationBreakpoint known issue 2024-06-17 16:25:22 +02:00
internal-modules
json-with-directory-name-module
keys test: fix test-tls-client-mindhsize for OpenSSL32 2024-10-02 16:04:15 +02:00
macos-app-sandbox
module-extension-over-directory
module-load-order
module-mocking test_runner: make mock_loader not confuse CJS and ESM resolution 2024-10-02 07:57:27 +02:00
module-require module: fix bad require.resolve with option paths for . and .. 2025-03-06 13:38:16 +01:00
module-require-symlink
nested-index
node_modules module: support 'module.exports' interop export in require(esm) 2025-02-11 11:56:34 +01:00
openssl3-conf
package-main-enoent
packages
permission permission: include permission check on lib/fs/promises 2026-03-20 17:45:06 +01:00
policy
policy-manifest
postject-copy
repl-folder-extensions/foo.js
require-bin
require-empty-main
resolve-paths
sea sea: support sea.getRawAsset() 2024-03-25 19:25:52 +00:00
self_ref_module
snapshot lib: account for cwd access from snapshot serialization cb 2024-03-25 19:28:19 +00:00
source-map lib: allow CJS source map cache to be reclaimed 2025-02-11 11:55:55 +01:00
syntax
test-init-index
test-init-native
test-module-loading-globalpaths
test-repl-tab-completion
test-runner test_runner: simplify hook running logic 2025-01-24 22:18:45 +01:00
test426 test: add initial test426 coverage 2025-03-06 13:38:06 +01:00
tools/checkimports
uncaught-exceptions
v8
v8-coverage
vm
warning_node_modules src: implement IsInsideNodeModules() in C++ 2025-02-11 11:56:43 +01:00
wasi
watch-mode
workload
wpt test: update WPT for WebCryptoAPI to edd42c005c 2025-06-11 09:21:24 +02:00
x509-escaping
.empty-hidden-repl-history-file
.empty-repl-history-file
.node_repl_history
a.js
aead-vectors.js
altdocs.md
array-hash-collision.js deps,build,test: fix array index hash collision 2026-03-23 18:45:35 +01:00
assert-first-line.js
assert-long-line.js
async-error.js
baz.js
catch-stdout-error.js
child-process-echo-options.js
child-process-message-and-exit.js
child-process-persistent.js
child-process-spawn-node.js
child-process-stay-alive-forever.js
child_process_should_emit_error.js
cjs-module-wrap.js
cjs-module-wrapper.js
cluster-preload-test.js
cluster-preload.js
crash.wasm
crash.wat
debugger-repeat-last.js
debugger-util-regression-fixture.js
define-global.js
deprecated-userland-class.js
deprecated-userland-function.js
deprecated-userland-subclass.js
deprecated.js
destroy-stdin.js
disable-warning-worker.js
disable-warning.js
doc_inc_1.md
doc_inc_2.md
doc_with_backticks_in_headings.md
doc_with_yaml.md
document_with_cjs_and_esm_code_snippet.md
document_with_esm_and_cjs_code_snippet.md
document_with_links.md
document_with_special_heading.md
echo-close-check.js
echo.js
elipses.txt
empty-with-bom.txt
empty.cjs
empty.js
empty.json
empty.txt
emptyframe.http2
exit.js
experimental.json
exports-function-with-param.js
external-repl-module.js
failcounter.js
failmustcall1.js
failmustcall2.js
file-to-read-with-bom.txt
file-to-read-without-bom.txt
fixture.ini
foo
gc.js
GH-892-request.js
GH-1899-output.js
google_ssl_hello.bin
guess-hash-seed.js
inspector-global-function.mjs
inspector-open.js
intrinsic-mutation.js
invalid.json
is-object.js
ispreloading.js
klass-with-fields.js
leakedGlobal.js
linux-perf-logger.js
linux-perf.js
loop.js
mime-whatwg-generated.js
mime-whatwg.js
module-loading-error.node
monkey-patch-run-main.js
net-fd-passing-receiver.js
no-wrapper.js
not-main-module.js
old-repl-history-file-faulty.json
old-repl-history-file-obj.json
openssl_fips_disabled.cnf
openssl_fips_enabled.cnf
order_of_end_tags_5873.md
out-of-bound.wasm
out-of-bound.wat
outside.txt
overwrite-config-preload-module.js
parent-process-nonpersistent-fork.js
parent-process-nonpersistent.js
path-resolve.js
path.js
person-large.jpg
person.jpg
person.jpg.br
person.jpg.gz
pkgexports.mjs module: support 'module.exports' interop export in require(esm) 2025-02-11 11:56:34 +01:00
print A.js
print-10-lines.js
print-chars-from-buffer.js
print-chars.js
print-delayed.js
print-error-message.js
print-intrinsic-mutation-name.js
printA.js
printB.js
printC.js
pseudo-multimember-gzip.gz
pseudo-multimember-gzip.z
pss-vectors.json
readfile_pipe_test.txt
recursive-a.cjs
recursive-b.cjs
recvfd.js
registerExt.hello.world
registerExt.test
registerExt2.test
repl-load-multiline-no-trailing-newline.js
repl-load-multiline.js
repl-pretty-stack.js
repl-tab-completion-nested-repls.js
report-oom.js
require-resolve.js
rsa-oaep-test-vectors.js
sample.png
sample_document.md
sea.js src: refactor embedded entrypoint loading 2025-02-11 11:56:00 +01:00
semicolon.js
shared-memory.wasm
shared-memory.wat
should_exit.js
simple.wasm
simple.wat
spawn-worker-with-copied-env.js test: skip --title check on IBM i 2024-08-19 10:32:45 +02:00
spawn-worker-with-trace-exit.js worker: allow copied NODE_OPTIONS in the env setting 2024-08-19 10:32:31 +02:00
spawn_closed_stdio.py
test-error-first-line-offset.js
test-fs-readfile-error.js
test-fs-stat-sync-overflow.js
test-nodetiming-uvmetricsinfo.js src,lib: add performance.uvMetricsInfo 2024-10-02 07:57:45 +02:00
test-resolution-inspect-brk-main.ext
test-resolution-inspect-brk-resolver.js
throws_error.js
throws_error1.js
throws_error2.js
throws_error3.js
throws_error4.js
throws_error5.js
throws_error6.js
throws_error7.js
tls-connect.js
tls-session-ticket.txt
tz-version.txt deps: update timezone to 2025c 2026-03-04 10:41:44 +01:00
url-idna.js
url-searchparams.js
url-setter-tests-additional.js
url-tests-additional.js
utf8-bom-shebang-shebang.js
utf8-bom.js
utf8-bom.json
utf8-shebang-bom.js
utf8_test_text.txt test: consolidate utf8 text fixtures in tests 2024-03-25 17:26:43 +00:00
warnings.js
wasi-preview-1.js test: split wasi tests 2024-03-25 19:27:16 +00:00
worker-data.cjs
worker-data.mjs
worker-from-argv.js
worker-name.js
worker-preload.js
worker-script.mjs
worker-script.ts
x.txt
x1024.txt