diff --git a/DEPS b/DEPS index 6b19f310aff4..eba6d27c4dab 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '134.0.6998.10', 'node_version': - 'v22.13.1', + 'v22.14.0', 'nan_version': 'e14bdcd1f72d62bca1d541b66da43130384ec213', 'squirrel.mac_version': diff --git a/patches/node/.patches b/patches/node/.patches index f5296ff5e7a5..4f3bf093d0c4 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -41,3 +41,5 @@ fix_remove_fastapitypedarray_usage.patch test_handle_explicit_resource_management_globals.patch build_remove_explicit_linker_call_to_libm_on_macos.patch linux_try_preadv64_pwritev64_before_preadv_pwritev_4683.patch +build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch +test_make_eval_snapshot_tests_more_flexible.patch diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 5058aab000e1..a5dcecf25f49 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -10,17 +10,6 @@ however those files were cherry-picked from main branch and do not really in 20/21. We have to wait until 22 is released to be able to build with upstream GN files. -diff --git a/deps/simdjson/unofficial.gni b/deps/simdjson/unofficial.gni -index d6909b95886f4de3f0b953c2a2992f69066b7434..972955f9144aafcd3a3fe278b7aaad401cadddda 100644 ---- a/deps/simdjson/unofficial.gni -+++ b/deps/simdjson/unofficial.gni -@@ -18,5 +18,6 @@ template("simdjson_gn_build") { - forward_variables_from(invoker, "*") - public_configs = [ ":simdjson_config" ] - sources = gypi_values.simdjson_sources -+ cflags_c = [ "-Wdeprecated-literal-operator" ] - } - } diff --git a/node.gni b/node.gni index a2123cc6c6d21c53fafc8934203b3720393e7b11..245a43920c7baf000ba63192a84a4c3fd219be7d 100644 --- a/node.gni @@ -65,11 +54,71 @@ index a2123cc6c6d21c53fafc8934203b3720393e7b11..245a43920c7baf000ba63192a84a4c3f } assert(!node_enable_inspector || node_use_openssl, +diff --git a/src/inspector/unofficial.gni b/src/inspector/unofficial.gni +index 5d87f3c901ab509e534598ed1eb0796a96355b5e..3d7aa148678b2646b88fa7c32abec91791b02b82 100644 +--- a/src/inspector/unofficial.gni ++++ b/src/inspector/unofficial.gni +@@ -13,7 +13,7 @@ template("inspector_gn_build") { + } + + node_gen_dir = get_label_info("../..", "target_gen_dir") +- protocol_tool_path = "../../tools/inspector_protocol" ++ protocol_tool_path = "../../deps/inspector_protocol" + + gypi_values = exec_script( + "../../tools/gypi_to_gn.py", +@@ -35,6 +35,8 @@ template("inspector_gn_build") { + ] + + args = [ ++ "--inspector_protocol_dir", ++ rebase_path(protocol_tool_path, root_build_dir), + "--jinja_dir", + # jinja is in third_party. + rebase_path("//third_party/", root_build_dir), +@@ -72,4 +74,37 @@ template("inspector_gn_build") { + outputs = [ "$node_gen_dir/src/{{source_name_part}}.json" ] + args = [ "{{source}}" ] + rebase_path(outputs, root_build_dir) + } ++ ++ config("crdtp_config") { ++ include_dirs = [ protocol_tool_path ] ++ } ++ ++ static_library("crdtp") { ++ public_configs = [ ":crdtp_config" ] ++ sources = [ ++ "$protocol_tool_path/crdtp/cbor.cc", ++ "$protocol_tool_path/crdtp/cbor.h", ++ "$protocol_tool_path/crdtp/dispatch.cc", ++ "$protocol_tool_path/crdtp/dispatch.h", ++ "$protocol_tool_path/crdtp/error_support.cc", ++ "$protocol_tool_path/crdtp/error_support.h", ++ "$protocol_tool_path/crdtp/export.h", ++ "$protocol_tool_path/crdtp/find_by_first.h", ++ "$protocol_tool_path/crdtp/frontend_channel.h", ++ "$protocol_tool_path/crdtp/glue.h", ++ "$protocol_tool_path/crdtp/json.cc", ++ "$protocol_tool_path/crdtp/json.h", ++ "$protocol_tool_path/crdtp/parser_handler.h", ++ "$protocol_tool_path/crdtp/protocol_core.cc", ++ "$protocol_tool_path/crdtp/protocol_core.h", ++ "$protocol_tool_path/crdtp/serializable.cc", ++ "$protocol_tool_path/crdtp/serializable.h", ++ "$protocol_tool_path/crdtp/span.cc", ++ "$protocol_tool_path/crdtp/span.h", ++ "$protocol_tool_path/crdtp/status.cc", ++ "$protocol_tool_path/crdtp/status.h", ++ "$protocol_tool_path/crdtp/json_platform.cc", ++ "$protocol_tool_path/crdtp/json_platform.h", ++ ] ++ } + } diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 9aaf5626fcfe4a9b168e069df0265df7b535b76e..ece9c4656919d8dc408112142367791628dd5f8b 100644 +index 894fd515202cc3a1f933c2bbc618dd09869ad904..4f1ed661e9c432f3b50f2e7e348ad9794ff773d0 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -779,6 +779,7 @@ void BuiltinLoader::RegisterExternalReferences( +@@ -781,6 +781,7 @@ void BuiltinLoader::RegisterExternalReferences( registry->Register(GetNatives); RegisterExternalReferencesForInternalizedBuiltinCode(registry); @@ -261,7 +310,7 @@ index 65d0e1be42f0a85418491ebb548278cf431aa6a0..d4a31342f1c6107b029394c6e1d00a1d except Exception as e: print(str(e)) diff --git a/unofficial.gni b/unofficial.gni -index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..3632d5bd21e277fcbd8d62dc65598a7f7c87f00e 100644 +index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..a2f3a769ceaa08db6d7438223884dc5aeab1340d 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -145,6 +145,7 @@ template("node_gn_build") { @@ -292,7 +341,7 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..3632d5bd21e277fcbd8d62dc65598a7f "$target_gen_dir/node_javascript.cc", ] + gypi_values.node_sources -@@ -185,7 +189,7 @@ template("node_gn_build") { +@@ -185,11 +189,12 @@ template("node_gn_build") { } if (node_use_openssl) { deps += [ "deps/ncrypto" ] @@ -301,7 +350,12 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..3632d5bd21e277fcbd8d62dc65598a7f sources += gypi_values.node_crypto_sources } if (node_enable_inspector) { -@@ -282,6 +286,7 @@ template("node_gn_build") { + deps += [ ++ "src/inspector:crdtp", + "src/inspector:node_protocol_generated_sources", + "src/inspector:v8_inspector_compress_protocol_json", + ] +@@ -282,6 +287,7 @@ template("node_gn_build") { } executable("node_js2c") { @@ -309,7 +363,7 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..3632d5bd21e277fcbd8d62dc65598a7f deps = [ "deps/uv", "$node_simdutf_path", -@@ -292,26 +297,75 @@ template("node_gn_build") { +@@ -292,26 +298,75 @@ template("node_gn_build") { "src/embedded_data.cc", "src/embedded_data.h", ] @@ -395,7 +449,7 @@ index 9e496d99d7141bf42ef7374a3c676c7b333eeeab..3632d5bd21e277fcbd8d62dc65598a7f outputs = [ "$target_gen_dir/node_javascript.cc" ] # Get the path to node_js2c executable of the host toolchain. -@@ -325,11 +379,11 @@ template("node_gn_build") { +@@ -325,11 +380,11 @@ template("node_gn_build") { get_label_info(":node_js2c($host_toolchain)", "name") + host_executable_suffix diff --git a/patches/node/build_allow_unbundling_of_node_js_dependencies.patch b/patches/node/build_allow_unbundling_of_node_js_dependencies.patch index 27e491f083e3..952cc525820f 100644 --- a/patches/node/build_allow_unbundling_of_node_js_dependencies.patch +++ b/patches/node/build_allow_unbundling_of_node_js_dependencies.patch @@ -14,7 +14,7 @@ We don't need to do this for zlib, as the existing gn workflow uses the same Upstreamed at https://github.com/nodejs/node/pull/55903 diff --git a/unofficial.gni b/unofficial.gni -index 08a4ed939fb1482a897def94128282fdfd63dc62..23367db388ce9e83e123d4c6e8c6325266dd52dc 100644 +index 08603eaef2da51fd92f9bf977647b56409eff48c..cd0eae52ca9bf244e43643a2034fa9d26c4db206 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -153,7 +153,6 @@ template("node_gn_build") { @@ -44,7 +44,7 @@ index 08a4ed939fb1482a897def94128282fdfd63dc62..23367db388ce9e83e123d4c6e8c63252 if (v8_enable_i18n_support) { deps += [ "//third_party/icu" ] } -@@ -211,6 +220,19 @@ template("node_gn_build") { +@@ -212,6 +221,19 @@ template("node_gn_build") { sources += node_inspector.node_inspector_sources + node_inspector.node_inspector_generated_sources } diff --git a/patches/node/build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch b/patches/node/build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch new file mode 100644 index 000000000000..9f5b3c70a4ef --- /dev/null +++ b/patches/node/build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Wed, 12 Feb 2025 15:31:07 +0100 +Subject: build: change crdtp::ProtocolTypeTraits signatures to avoid conflict + +After https://github.com/nodejs/node/pull/56649 we see conflicts with the +version in //third_party/inspector_protocol/crdtp/chromium/protocol_traits.cc + +error: duplicate symbol: crdtp::ProtocolTypeTraits, std::__Cr::allocator>, void>::Serialize(std::__Cr::basic_string, std::__Cr::allocator> const&, std::__Cr::vector>*) +>>> defined in node_string.cc:28 (../../third_party/electron_node/src/inspector/node_string.cc:28) +>>> obj/third_party/electron_node/libnode/node_string.o +>>> defined in protocol_traits.cc:20 (../../third_party/inspector_protocol/crdtp/chromium/protocol_traits.cc:20) + +Some distinguishing change should be upstreamed to Node.js. + +diff --git a/src/inspector/node_string.cc b/src/inspector/node_string.cc +index d83c53c81ca7745a31b200d5af3656af59f4f530..b2f6d412415e2988ead3c1e25b9557e1f0c91de3 100644 +--- a/src/inspector/node_string.cc ++++ b/src/inspector/node_string.cc +@@ -7,7 +7,8 @@ + namespace crdtp { + + bool ProtocolTypeTraits::Deserialize(DeserializerState* state, +- std::string* value) { ++ std::string* value, ++ void* extra) { + if (state->tokenizer()->TokenTag() == cbor::CBORTokenTag::STRING8) { + span cbor_span = state->tokenizer()->GetString8(); + value->assign(reinterpret_cast(cbor_span.data()), +@@ -24,12 +25,13 @@ bool ProtocolTypeTraits::Deserialize(DeserializerState* state, + } + + void ProtocolTypeTraits::Serialize(const std::string& value, +- std::vector* bytes) { ++ std::vector* bytes, ++ void* extra) { + cbor::EncodeString8(SpanFrom(value), bytes); + } +- + } // namespace crdtp + ++ + namespace node { + namespace inspector { + namespace protocol { +diff --git a/src/inspector/node_string.h b/src/inspector/node_string.h +index d529d1337be0e2292202920446e841701d16b0b7..08e00f9b94918e3385aed18de80eec5c7ad81095 100644 +--- a/src/inspector/node_string.h ++++ b/src/inspector/node_string.h +@@ -15,8 +15,8 @@ namespace crdtp { + + template <> + struct ProtocolTypeTraits { +- static bool Deserialize(DeserializerState* state, std::string* value); +- static void Serialize(const std::string& value, std::vector* bytes); ++ static bool Deserialize(DeserializerState* state, std::string* value, void* extra = nullptr); ++ static void Serialize(const std::string& value, std::vector* bytes, void* extra = nullptr); + }; + + } // namespace crdtp diff --git a/patches/node/build_enable_perfetto.patch b/patches/node/build_enable_perfetto.patch index 6c9e1ae373c1..d0548a2e8e81 100644 --- a/patches/node/build_enable_perfetto.patch +++ b/patches/node/build_enable_perfetto.patch @@ -64,7 +64,7 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327 module.exports = { diff --git a/node.gyp b/node.gyp -index b21cfbf2fad024445e8d1ef8a6781141f788eb1a..55c6e01d9e879ce63524ec1504f8a23e00a2aa29 100644 +index d97004c8e148be6b63634dad5306756d503fb1f8..271fb4f76bc1e69baad0b1fafca128b3bca4a360 100644 --- a/node.gyp +++ b/node.gyp @@ -174,7 +174,6 @@ @@ -84,10 +84,10 @@ index b21cfbf2fad024445e8d1ef8a6781141f788eb1a..55c6e01d9e879ce63524ec1504f8a23e 'src/tracing/trace_event.h', 'src/tracing/trace_event_common.h', diff --git a/src/inspector/tracing_agent.cc b/src/inspector/tracing_agent.cc -index e7b6d3b3ea63bdc80e569f56209e958b4fcde328..b52d5b1c7293539315626cd67f794cce4cfd1760 100644 +index 40c8aea35c931c46fc62b717c978eab0659645fd..348cdfb0b42aa18f352c220cea0b896c09f67753 100644 --- a/src/inspector/tracing_agent.cc +++ b/src/inspector/tracing_agent.cc -@@ -84,14 +84,14 @@ class InspectorTraceWriter : public node::tracing::AsyncTraceWriter { +@@ -92,14 +92,14 @@ class InspectorTraceWriter : public node::tracing::AsyncTraceWriter { explicit InspectorTraceWriter(int frontend_object_id, std::shared_ptr main_thread) : frontend_object_id_(frontend_object_id), main_thread_(main_thread) {} diff --git a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch index 297cfe698716..7b52bcc0fd16 100644 --- a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch +++ b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -34,7 +34,7 @@ index 411eab8136d5957ae8a491bc38ffbdc88e59f5da..63c93b5be09692d0d4b6bfbb214b173b let kResistStopPropagation; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index ece9c4656919d8dc408112142367791628dd5f8b..c6a5f8cab45e9c3503ae1bb576cf94b4ca817e2a 100644 +index 4f1ed661e9c432f3b50f2e7e348ad9794ff773d0..16c95348ee254061d5c48f405968c1b0ee33bf82 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -34,6 +34,7 @@ using v8::Value; diff --git a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch index bb54a882319d..db45eab11fe4 100644 --- a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch +++ b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch @@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form of this. diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index ccd038dc136480cdd84a13e58f4012b71cd40928..5be90bc3df67751b55e67a05ac1c5b9a12d9c585 100644 +index 9b5772fe9b8babbb892c7a5ec79258472da55a76..3568fd6ea0816f62d97d46f5d497bb1b23bf4e25 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -1563,6 +1563,13 @@ Module.prototype._compile = function(content, filename, format) { +@@ -1555,6 +1555,13 @@ Module.prototype._compile = function(content, filename, format) { this[kIsExecuting] = true; if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) { const { callAndPauseOnStart } = internalBinding('inspector'); @@ -26,7 +26,7 @@ index ccd038dc136480cdd84a13e58f4012b71cd40928..5be90bc3df67751b55e67a05ac1c5b9a require, module, filename, dirname, process, localGlobal, localBuffer); diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js -index 5d67892bb8e1fd265df414b3f41e62cdabbec873..89660076c41e1c05b26c17609a62a028c1e2ec5a 100644 +index d1c05d1717cdc825c4e48885c963c9ed65bcf51c..278665921c5160ff10b3178db27d4df319fab6b3 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js @@ -243,12 +243,14 @@ function patchProcessObject(expandArgv1) { diff --git a/patches/node/chore_expose_importmoduledynamically_and.patch b/patches/node/chore_expose_importmoduledynamically_and.patch index a9b15c0bfefe..2596e1482f10 100644 --- a/patches/node/chore_expose_importmoduledynamically_and.patch +++ b/patches/node/chore_expose_importmoduledynamically_and.patch @@ -40,19 +40,19 @@ index 99061e62976e7cb24be81e8632b0e21d1e9adf9a..bbc9311c059e8ab0328c5f92b21a6be5 /** diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index 8be6dbd1d0262ccbb2318de1d98e344e9b21a510..1509fc54fe9767e101b107509b4b2d6c821ce95d 100644 +index 649ec428e2dd6fbf0082b3f1ba9fdfbfab892a94..168912fe6ede3b71ab3029c292ba430915fd79d8 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -823,7 +823,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( +@@ -832,7 +832,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( return module->module_.Get(isolate); } -static MaybeLocal ImportModuleDynamically( +MaybeLocal ImportModuleDynamically( Local context, - Local host_defined_options, + Local host_defined_options, Local resource_name, -@@ -888,12 +888,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( +@@ -897,12 +897,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( Realm* realm = Realm::GetCurrent(args); HandleScope handle_scope(isolate); @@ -68,7 +68,7 @@ index 8be6dbd1d0262ccbb2318de1d98e344e9b21a510..1509fc54fe9767e101b107509b4b2d6c } void ModuleWrap::HostInitializeImportMetaObjectCallback( -@@ -935,13 +936,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( +@@ -944,13 +945,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( Realm* realm = Realm::GetCurrent(args); Isolate* isolate = realm->isolate(); diff --git a/patches/node/cli_remove_deprecated_v8_flag.patch b/patches/node/cli_remove_deprecated_v8_flag.patch index 829e3bbfcc63..5acad06fbdca 100644 --- a/patches/node/cli_remove_deprecated_v8_flag.patch +++ b/patches/node/cli_remove_deprecated_v8_flag.patch @@ -18,10 +18,10 @@ Reviewed-By: Michaƫl Zasso Reviewed-By: Yagiz Nizipli diff --git a/doc/api/cli.md b/doc/api/cli.md -index 770d2ca4fcf003352c2c12815ac885a7a5e67b7f..4af66f690e626b0159a88d58f6ee81391573ebab 100644 +index 8105592764abca6036e8e029ca9b6a32402e7156..431a6aa7a2cf4d537cb719f15c2749254e0433b3 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -3232,7 +3232,6 @@ V8 options that are allowed are: +@@ -3270,7 +3270,6 @@ V8 options that are allowed are: * `--disallow-code-generation-from-strings` * `--enable-etw-stack-walking` * `--expose-gc` @@ -30,10 +30,10 @@ index 770d2ca4fcf003352c2c12815ac885a7a5e67b7f..4af66f690e626b0159a88d58f6ee8139 * `--jitless` * `--max-old-space-size` diff --git a/src/node_options.cc b/src/node_options.cc -index ec419cf96a14989338e3261b85c92b81ba8b50d9..5a4d536ff0d090fa6b43ea4cbd403d4aa23171c1 100644 +index 620776c06d835eb1bfeed060751c570e8d435b29..866f2a39a5e51a8bf434ccd54d76c685bcdd1502 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -970,11 +970,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( +@@ -980,11 +980,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( "disallow eval and friends", V8Option{}, kAllowedInEnvvar); @@ -46,10 +46,10 @@ index ec419cf96a14989338e3261b85c92b81ba8b50d9..5a4d536ff0d090fa6b43ea4cbd403d4a "disable runtime allocation of executable memory", V8Option{}, diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js -index 03ffe7aa03f48156f04bb527316221ec10e7e0df..69bf136559c1a8a18a7bfc444a439d161f622635 100644 +index b1d5c44ceeeebc674938d85736aace2a6ef570e2..9e89200e9f6dfd89340cd04afb76e271ffc82b54 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js -@@ -72,7 +72,6 @@ if (common.hasCrypto) { +@@ -73,7 +73,6 @@ if (common.hasCrypto) { expect('--abort_on-uncaught_exception', 'B\n'); expect('--disallow-code-generation-from-strings', 'B\n'); expect('--expose-gc', 'B\n'); diff --git a/patches/node/fix_assert_module_in_the_renderer_process.patch b/patches/node/fix_assert_module_in_the_renderer_process.patch index 2470a65e4c18..8efa5f5b272d 100644 --- a/patches/node/fix_assert_module_in_the_renderer_process.patch +++ b/patches/node/fix_assert_module_in_the_renderer_process.patch @@ -58,10 +58,10 @@ index fc9b056d2f7e25109100fbde5f3ab0aebc8c619a..32fc075e97eebca6c47e796ac5308915 } diff --git a/src/node_options.cc b/src/node_options.cc -index f70e0917f6caa66210107cdb2ef891685563ba96..ec419cf96a14989338e3261b85c92b81ba8b50d9 100644 +index 3608ab2b4aeb09e985ca98e23f2dff23567ade71..620776c06d835eb1bfeed060751c570e8d435b29 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -1517,14 +1517,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { +@@ -1527,14 +1527,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { } Isolate* isolate = args.GetIsolate(); diff --git a/patches/node/fix_crypto_tests_to_run_with_bssl.patch b/patches/node/fix_crypto_tests_to_run_with_bssl.patch index dd799803da36..31ecfb8700b2 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -11,19 +11,19 @@ before it's acceptable to upstream, as this patch comments out a couple of tests that upstream probably cares about. diff --git a/test/common/index.js b/test/common/index.js -index d1eaf6e69f603b0a7037e44be6ef185283972090..e3f26d32dbad2e4ccb47dea028dbf1a855525cfb 100644 +index 92c7294e6f6298f511b5a289e1e0e3a4be68cc77..63a350c5ed912a785b042a238c064c98ed423af4 100644 --- a/test/common/index.js +++ b/test/common/index.js -@@ -65,6 +65,8 @@ const opensslVersionNumber = (major = 0, minor = 0, patch = 0) => { - return (major << 28) | (minor << 20) | (patch << 4); - }; +@@ -56,6 +56,8 @@ const hasCrypto = Boolean(process.versions.openssl) && + + const hasQuic = hasCrypto && !!process.config.variables.openssl_quic; +const openSSLIsBoringSSL = process.versions.openssl === '0.0.0'; + - let OPENSSL_VERSION_NUMBER; - const hasOpenSSL = (major = 0, minor = 0, patch = 0) => { - if (!hasCrypto) return false; -@@ -1008,6 +1010,7 @@ const common = { + function parseTestFlags(filename = process.argv[1]) { + // The copyright notice is relatively big and the flags could come afterwards. + const bytesToRead = 1500; +@@ -889,6 +891,7 @@ const common = { mustNotMutateObjectDeep, mustSucceed, nodeProcessAborted, @@ -95,10 +95,10 @@ index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..b3287f428ce6b3fde11d449c601a57ff { diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js -index 3e3632203af72c54f2795d8de0cf345862a043bb..a066bbb803d41d9d1f26a02e41115b71233988d6 100644 +index 88d07c3b957f57b85861542d174a0fd0ba8ceb66..1f430197579ff5f31322bfa0fa5e92e4c58588e2 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js -@@ -60,6 +60,10 @@ function testCipher2(key, iv) { +@@ -62,6 +62,10 @@ function testCipher2(key, iv) { function testCipher3(key, iv) { @@ -123,10 +123,10 @@ index 81a469c226c261564dee1e0b06b6571b18a41f1f..58b66045dba4201b7ebedd78b129420f const availableCurves = new Set(crypto.getCurves()); diff --git a/test/parallel/test-crypto-dh-errors.js b/test/parallel/test-crypto-dh-errors.js -index 476ca64b4425b5b8b0fa2dc8352ee6f03d563813..2250a8f24a875d6af198426891870b450078ee5f 100644 +index 0af4db0310750cea9350ecff7fc44404c6df6c83..85ab03f6019989ad4fe93b779c3b4772ce1f5130 100644 --- a/test/parallel/test-crypto-dh-errors.js +++ b/test/parallel/test-crypto-dh-errors.js -@@ -32,9 +32,9 @@ for (const bits of [-1, 0, 1]) { +@@ -33,9 +33,9 @@ for (const bits of [-1, 0, 1]) { }); } else { assert.throws(() => crypto.createDiffieHellman(bits), { @@ -139,12 +139,12 @@ index 476ca64b4425b5b8b0fa2dc8352ee6f03d563813..2250a8f24a875d6af198426891870b45 } } diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js -index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a954edb053 100644 +index d7ffbe5eca92734aa2380f482c7f9bfe7e2a36c7..21ab2333431ea70bdf98dde43624e0b712566395 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js -@@ -55,18 +55,17 @@ const crypto = require('crypto'); +@@ -60,18 +60,17 @@ const { let wrongBlockLength; - if (common.hasOpenSSL3) { + if (hasOpenSSL3) { wrongBlockLength = { - message: 'error:1C80006B:Provider routines::wrong final block length', - code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH', @@ -169,9 +169,9 @@ index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a9 }; } -@@ -93,17 +92,23 @@ const crypto = require('crypto'); +@@ -98,17 +97,23 @@ const { dh3.computeSecret(''); - }, { message: common.hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ? + }, { message: hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ? 'Unspecified validation error' : - 'Supplied key is too small' }); + 'Supplied key is invalid' }); @@ -237,43 +237,36 @@ index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf2187 s.pipe(h).on('data', common.mustCall(function(c) { assert.strictEqual(c, expect); diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js -index 83218c105a4596e0ae0381136f176bb8d759899e..afb3c8c592d2a8e2a053fd44f455af06c592a85e 100644 +index 61145aee0727fbe0b9781acdb3eeb641e7010729..fd7d4bd7d3f86caa30ffd03ea880eeac023bbcbb 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js -@@ -182,6 +182,7 @@ assert.throws( +@@ -183,7 +183,7 @@ assert.throws( + } // Test XOF hash functions and the outputLength option. - { -+ /* - // Default outputLengths. - assert.strictEqual(crypto.createHash('shake128').digest('hex'), - '7f9c2ba4e88f827d616045507605853e'); -@@ -236,6 +237,7 @@ assert.throws( - assert.strictEqual(superLongHash.length, 2 * 1024 * 1024); - assert.ok(superLongHash.endsWith('193414035ddba77bf7bba97981e656ec')); - assert.ok(superLongHash.startsWith('a2a28dbc49cfd6e5d6ceea3d03e77748')); -+ */ - - // Non-XOF hash functions should accept valid outputLength options as well. - assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 }) +-{ ++if (!common.openSSLIsBoringSSL) { + // Default outputLengths. Since OpenSSL 3.4 an outputLength is mandatory + if (!hasOpenSSL(3, 4)) { + assert.strictEqual(crypto.createHash('shake128').digest('hex'), diff --git a/test/parallel/test-crypto-hkdf.js b/test/parallel/test-crypto-hkdf.js -index ff3abdf291efcd076b36e755de4147b0aad0b345..d29854cf0c0ce89f84c912def672e7c4e11427a3 100644 +index 3f7e61e9b2ebc0ca7c367d7c229afe9ab87762b8..36bd78105d153b75b42e4736f11d80a257916607 100644 --- a/test/parallel/test-crypto-hkdf.js +++ b/test/parallel/test-crypto-hkdf.js -@@ -124,8 +124,6 @@ const algorithms = [ +@@ -125,7 +125,7 @@ const algorithms = [ ['sha256', '', 'salt', '', 10], ['sha512', 'secret', 'salt', '', 15], ]; --if (!common.hasOpenSSL3) -- algorithms.push(['whirlpool', 'secret', '', 'info', 20]); +-if (!hasOpenSSL3) ++if (!hasOpenSSL3 && !common.openSSLIsBoringSSL) + algorithms.push(['whirlpool', 'secret', '', 'info', 20]); algorithms.forEach(([ hash, secret, salt, info, length ]) => { - { diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js -index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ceed84e6f7 100644 +index 48cd1ed4df61aaddeee8785cb90f83bdd9628187..a18aeb2bdffcc7a7e9ef12328b849994e39d6c27 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js -@@ -87,10 +87,9 @@ assert.throws(function() { +@@ -88,10 +88,9 @@ assert.throws(function() { code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH', reason: 'wrong final block length', } : { @@ -287,7 +280,7 @@ index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ce } ); -@@ -114,10 +113,9 @@ assert.throws(function() { +@@ -115,10 +114,9 @@ assert.throws(function() { reason: 'bad decrypt', code: 'ERR_OSSL_BAD_DECRYPT', } : { @@ -301,11 +294,29 @@ index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ce }); // No-pad encrypted string should return the same: +diff --git a/test/parallel/test-crypto-prime.js b/test/parallel/test-crypto-prime.js +index 5ffdc1394282be046150e3759f82f8787f5604f7..e1c7a7b4824a2df20a405355696022398216fa4f 100644 +--- a/test/parallel/test-crypto-prime.js ++++ b/test/parallel/test-crypto-prime.js +@@ -259,11 +259,11 @@ for (const checks of [-(2 ** 31), -1, 2 ** 31, 2 ** 32 - 1, 2 ** 32, 2 ** 50]) { + bytes[0] = 0x1; + assert.throws(() => checkPrime(bytes, common.mustNotCall()), { + code: 'ERR_OSSL_BN_BIGNUM_TOO_LONG', +- message: /bignum too long/ ++ message: /bignum[_ ]too[_ ]long/i + }); + assert.throws(() => checkPrimeSync(bytes), { + code: 'ERR_OSSL_BN_BIGNUM_TOO_LONG', +- message: /bignum too long/ ++ message: /bignum[_ ]too[_ ]long/i + }); + } + diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js -index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e348d9f2b4 100644 +index dcd5045daaf58c60e27c1e2f7941033302241339..6ac75565792b92a97c622baba73f821d754b8d01 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js -@@ -28,12 +28,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem'); +@@ -29,12 +29,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem'); const ec = new TextEncoder(); const openssl1DecryptError = { @@ -322,34 +333,25 @@ index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e3 + library: /digital envelope routines|Cipher functions/, }; - const decryptError = common.hasOpenSSL3 ? -@@ -222,7 +221,8 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) { + const decryptError = hasOpenSSL3 ? +@@ -223,7 +222,7 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) { }, bufferToEncrypt); - if (padding === constants.RSA_PKCS1_PADDING) { -+ // BoringSSL does not support RSA_PKCS1_PADDING. -+ if (false) { ++ if (!common.openSSLIsBoringSSL) { if (!process.config.variables.node_shared_openssl) { assert.throws(() => { crypto.privateDecrypt({ -@@ -466,10 +466,10 @@ assert.throws(() => { - assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true); - } - -- +@@ -471,7 +470,7 @@ assert.throws(() => { // // Test DSA signing and verification // +-{ +if (!common.openSSLIsBoringSSL) { - { const input = 'I AM THE WALRUS'; -@@ -541,3 +541,4 @@ const input = 'I AM THE WALRUS'; - - assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true); - } -+} + // DSA signatures vary across runs so there is no static string to verify diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88bfb23d85f 100644 --- a/test/parallel/test-crypto-scrypt.js @@ -364,10 +366,10 @@ index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88b }; assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}), diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js -index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66f1a3a03b 100644 +index 0589d60736e377f24dc8550f87a6b7624173fc44..547f22cdc130cf0c68d117f92068e3ac53a0efc2 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js -@@ -29,7 +29,7 @@ const keySize = 2048; +@@ -33,7 +33,7 @@ const keySize = 2048; } // Test handling of exceptional conditions @@ -376,10 +378,10 @@ index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66 const library = { configurable: true, set() { -@@ -341,15 +341,17 @@ assert.throws( +@@ -345,15 +345,15 @@ assert.throws( padding: crypto.constants.RSA_PKCS1_OAEP_PADDING }); - }, common.hasOpenSSL3 ? { + }, hasOpenSSL3 ? { - code: 'ERR_OSSL_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE', - message: /illegal or unsupported padding mode/, + code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/, @@ -387,18 +389,18 @@ index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66 } : { - code: 'ERR_OSSL_RSA_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE', - message: /illegal or unsupported padding mode/, +- opensslErrorStack: [ + code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/, + message: /illegal or unsupported padding mode|ILLEGAL_OR_UNSUPPORTED_PADDING_MODE/, -+ /* - opensslErrorStack: [ ++ /*opensslErrorStack: [ 'error:06089093:digital envelope routines:EVP_PKEY_CTX_ctrl:' + 'command not supported', - ], -+ */ +- ], ++ ],*/ }); } -@@ -419,10 +421,12 @@ assert.throws( +@@ -423,10 +423,12 @@ assert.throws( public: fixtures.readKey('ed25519_public.pem', 'ascii'), algo: null, sigLen: 64 }, @@ -411,7 +413,7 @@ index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66 { private: fixtures.readKey('rsa_private_2048.pem', 'ascii'), public: fixtures.readKey('rsa_public_2048.pem', 'ascii'), algo: 'sha1', -@@ -493,7 +497,7 @@ assert.throws( +@@ -497,7 +499,7 @@ assert.throws( { const data = Buffer.from('Hello world'); @@ -421,10 +423,10 @@ index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66 for (const [file, length] of keys) { const privKey = fixtures.readKey(file); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js -index 008ab129f0e019c659eecf5a76b7eb412c947fe3..6688f5d916f50e1e4fcfff1619c8634a3233f820 100644 +index 62be4eaf6edfb01ce275e7db3e56b51d09ac66ce..3fb6cd833d959d1c3c8522ebacc8f18352672628 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js -@@ -76,10 +76,10 @@ cipher.pipe(decipher) +@@ -78,10 +78,10 @@ cipher.pipe(decipher) library: 'Provider routines', reason: 'bad decrypt', } : { @@ -440,10 +442,10 @@ index 008ab129f0e019c659eecf5a76b7eb412c947fe3..6688f5d916f50e1e4fcfff1619c8634a cipher.end('Papaya!'); // Should not cause an unhandled exception. diff --git a/test/parallel/test-crypto-x509.js b/test/parallel/test-crypto-x509.js -index bd906c25b9ee194ff34fe5fb8ecb68d7a672138c..5b631a32d07bd916ff7cd847e52b26f694bd00c6 100644 +index f75e1d63470bfb7ce7fb354118b87a1a6fe5e4cc..5c0852e83a466ab4b255e8c9c9a33aca1beb9b94 100644 --- a/test/parallel/test-crypto-x509.js +++ b/test/parallel/test-crypto-x509.js -@@ -96,8 +96,10 @@ const der = Buffer.from( +@@ -97,8 +97,10 @@ const der = Buffer.from( assert.strictEqual(x509.infoAccess, infoAccessCheck); assert.strictEqual(x509.validFrom, 'Sep 3 21:40:37 2022 GMT'); assert.strictEqual(x509.validTo, 'Jun 17 21:40:37 2296 GMT'); @@ -454,7 +456,7 @@ index bd906c25b9ee194ff34fe5fb8ecb68d7a672138c..5b631a32d07bd916ff7cd847e52b26f6 assert.strictEqual( x509.fingerprint, '8B:89:16:C4:99:87:D2:13:1A:64:94:36:38:A5:32:01:F0:95:3B:53'); -@@ -325,6 +327,7 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7hRSUqlHkUi07FrP2Htg8kjI= +@@ -326,6 +328,7 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7hRSUqlHkUi07FrP2Htg8kjI= legacyObjectCheck.serialNumberPattern); } @@ -462,7 +464,7 @@ index bd906c25b9ee194ff34fe5fb8ecb68d7a672138c..5b631a32d07bd916ff7cd847e52b26f6 { // This X.509 Certificate can be parsed by OpenSSL because it contains a // structurally sound TBSCertificate structure. However, the SPKI field of the -@@ -363,6 +366,7 @@ UcXd/5qu2GhokrKU2cPttU+XAN2Om6a0 +@@ -364,6 +367,7 @@ UcXd/5qu2GhokrKU2cPttU+XAN2Om6a0 assert.strictEqual(cert.checkIssued(cert), false); } @@ -470,7 +472,7 @@ index bd906c25b9ee194ff34fe5fb8ecb68d7a672138c..5b631a32d07bd916ff7cd847e52b26f6 { // Test date parsing of `validFromDate` and `validToDate` fields, according to RFC 5280. -@@ -400,8 +404,10 @@ UidvpWWipVLZgK+oDks+bKTobcoXGW9oXobiIYqslXPy +@@ -401,8 +405,10 @@ UidvpWWipVLZgK+oDks+bKTobcoXGW9oXobiIYqslXPy -----END CERTIFICATE-----`.trim(); const c1 = new X509Certificate(certPemUTCTime); @@ -481,7 +483,7 @@ index bd906c25b9ee194ff34fe5fb8ecb68d7a672138c..5b631a32d07bd916ff7cd847e52b26f6 // The GeneralizedTime format is used for dates in 2050 or later. const certPemGeneralizedTime = `-----BEGIN CERTIFICATE----- -@@ -435,6 +441,8 @@ CWwQO8JZjJqFtqtuzy2n+gLCvqePgG/gmSqHOPm2ZbLW +@@ -436,6 +442,8 @@ CWwQO8JZjJqFtqtuzy2n+gLCvqePgG/gmSqHOPm2ZbLW -----END CERTIFICATE-----`.trim(); const c2 = new X509Certificate(certPemGeneralizedTime); @@ -491,10 +493,10 @@ index bd906c25b9ee194ff34fe5fb8ecb68d7a672138c..5b631a32d07bd916ff7cd847e52b26f6 + } } diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js -index 4271121881379b6c6892e89e520345f77e4181df..7a17285deee18ffbccf1d01d9d1b7b87e561bffa 100644 +index 93644e016de447d2aadc519123f18cd72b7a5750..8b16c83cd47bd8969654242296c987ecc97ccaeb 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js -@@ -61,7 +61,7 @@ assert.throws(() => { +@@ -62,7 +62,7 @@ assert.throws(() => { // Throws general Error, so there is no opensslErrorStack property. return err instanceof Error && err.name === 'Error' && @@ -503,7 +505,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..7a17285deee18ffbccf1d01d9d1b7b87 !('opensslErrorStack' in err); }); -@@ -71,7 +71,7 @@ assert.throws(() => { +@@ -72,7 +72,7 @@ assert.throws(() => { // Throws general Error, so there is no opensslErrorStack property. return err instanceof Error && err.name === 'Error' && @@ -512,7 +514,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..7a17285deee18ffbccf1d01d9d1b7b87 !('opensslErrorStack' in err); }); -@@ -81,7 +81,7 @@ assert.throws(() => { +@@ -82,7 +82,7 @@ assert.throws(() => { // Throws general Error, so there is no opensslErrorStack property. return err instanceof Error && err.name === 'Error' && @@ -521,7 +523,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..7a17285deee18ffbccf1d01d9d1b7b87 !('opensslErrorStack' in err); }); -@@ -144,8 +144,6 @@ assert(crypto.getHashes().includes('sha1')); +@@ -145,8 +145,6 @@ assert(crypto.getHashes().includes('sha1')); assert(crypto.getHashes().includes('sha256')); assert(!crypto.getHashes().includes('SHA1')); assert(!crypto.getHashes().includes('SHA256')); @@ -530,7 +532,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..7a17285deee18ffbccf1d01d9d1b7b87 validateList(crypto.getHashes()); // Make sure all of the hashes are supported by OpenSSL for (const algo of crypto.getHashes()) -@@ -196,6 +194,7 @@ assert.throws( +@@ -197,6 +195,7 @@ assert.throws( } ); @@ -538,7 +540,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..7a17285deee18ffbccf1d01d9d1b7b87 assert.throws(() => { const priv = [ '-----BEGIN RSA PRIVATE KEY-----', -@@ -216,10 +215,10 @@ assert.throws(() => { +@@ -217,10 +216,10 @@ assert.throws(() => { library: 'rsa routines', } : { name: 'Error', @@ -553,7 +555,7 @@ index 4271121881379b6c6892e89e520345f77e4181df..7a17285deee18ffbccf1d01d9d1b7b87 code: 'ERR_OSSL_RSA_DIGEST_TOO_BIG_FOR_RSA_KEY' }); return true; -@@ -252,7 +251,7 @@ if (!common.hasOpenSSL3) { +@@ -253,7 +252,7 @@ if (!hasOpenSSL3) { return true; }); } @@ -585,10 +587,10 @@ index 543ee176fb6af38874fee9f14be76f3fdda11060..fef9f1bc2f9fc6c220cf47847e86e038 } diff --git a/test/parallel/test-https-agent-session-eviction.js b/test/parallel/test-https-agent-session-eviction.js -index e0986e53c1103b63cf15002a7fa4ce8bc4844d90..33c8a2aa72c56dd4a98558aab2102f03fae2b3cf 100644 +index 6f88e81e9ff29defe73800fc038b0d96d1ebd846..c0b92e2bdf86d3d2638c973f8be3110d5ae31f78 100644 --- a/test/parallel/test-https-agent-session-eviction.js +++ b/test/parallel/test-https-agent-session-eviction.js -@@ -14,7 +14,7 @@ const options = { +@@ -17,7 +17,7 @@ const options = { key: readKey('agent1-key.pem'), cert: readKey('agent1-cert.pem'), secureOptions: SSL_OP_NO_TICKET, @@ -598,10 +600,10 @@ index e0986e53c1103b63cf15002a7fa4ce8bc4844d90..33c8a2aa72c56dd4a98558aab2102f03 // Create TLS1.2 server diff --git a/test/parallel/test-tls-getprotocol.js b/test/parallel/test-tls-getprotocol.js -index a9c8775e2f112f2b5e1f4e80f22264f219bf6a9d..4550d28125379e6043962826b8e97b692d63804b 100644 +index b1eab88fd6517e3698934dea17752ef2bb8d8d54..3ad6db20316baa8490e3787dd55903b58a54ad06 100644 --- a/test/parallel/test-tls-getprotocol.js +++ b/test/parallel/test-tls-getprotocol.js -@@ -27,7 +27,7 @@ const clientConfigs = [ +@@ -29,7 +29,7 @@ const clientConfigs = [ const serverConfig = { secureProtocol: 'TLS_method', @@ -708,10 +710,10 @@ index d1ca571af4be713082d32093bfb8a65f2aef9800..57b8df2ce18df58ff54b2d828af67e3c function generateWrappingKeys() { diff --git a/test/parallel/test-x509-escaping.js b/test/parallel/test-x509-escaping.js -index e6ae4d886908cbc0e56787009db855dad8b12ba7..a17147daa0576ec49e560c05448f1ed0ae8d5640 100644 +index b507af88e1f7f3424b7b5d6d683a295b9d208e5e..825ba4c8dce775f401080a0522565bb7a087bcc3 100644 --- a/test/parallel/test-x509-escaping.js +++ b/test/parallel/test-x509-escaping.js -@@ -447,7 +447,7 @@ const { hasOpenSSL3 } = common; +@@ -448,7 +448,7 @@ const { hasOpenSSL3 } = require('../common/crypto'); assert.strictEqual(certX509.checkHost(servername, { subject: 'default' }), undefined); assert.strictEqual(certX509.checkHost(servername, { subject: 'always' }), @@ -720,7 +722,7 @@ index e6ae4d886908cbc0e56787009db855dad8b12ba7..a17147daa0576ec49e560c05448f1ed0 assert.strictEqual(certX509.checkHost(servername, { subject: 'never' }), undefined); -@@ -482,11 +482,11 @@ const { hasOpenSSL3 } = common; +@@ -483,11 +483,11 @@ const { hasOpenSSL3 } = require('../common/crypto'); assert.strictEqual(certX509.subjectAltName, 'IP Address:1.2.3.4'); // The newer X509Certificate API allows customizing this behavior: diff --git a/patches/node/fix_do_not_resolve_electron_entrypoints.patch b/patches/node/fix_do_not_resolve_electron_entrypoints.patch index ac669d32293a..73608aa7e06e 100644 --- a/patches/node/fix_do_not_resolve_electron_entrypoints.patch +++ b/patches/node/fix_do_not_resolve_electron_entrypoints.patch @@ -19,10 +19,10 @@ index c9d4a3536d0f60375ae623b48ca2fa7095c88d42..d818320fbbc430d06a0c2852e4723981 context = { __proto__: context, source }; } diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 0f138b1099b4833176e8a0ce681c745422efc24a..c7dd203e4bd5d611186300d9c0f2255afdf81684 100644 +index 0caba80bb213e0edfb1f834250f895ccc05d0d1c..6feab19d24a3524e36c5ed3bbac53cba0fa298c7 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -287,6 +287,9 @@ function cjsPreparseModuleExports(filename, source) { +@@ -286,6 +286,9 @@ function cjsPreparseModuleExports(filename, source) { if (module && module[kModuleExportNames] !== undefined) { return { module, exportNames: module[kModuleExportNames] }; } diff --git a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch index 10bca3092c14..f6652a3aeefa 100644 --- a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch +++ b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch @@ -46,19 +46,18 @@ index 5ba13096b98047ff33e4d44167c2a069ccc5e69d..a00b5979e3b5deb4ba315b4635c7e5d2 } } diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 61c043e35c6ce9ef9d7255e009162289e80eaf4d..0c41492aa9652112df0b839361570a832daf3b13 100644 +index bfd9bd3d127404de1cbb6f30c43ab0342590759d..9e7d8ef0adef3b68a3ec186e4b218f591aa69266 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js -@@ -791,6 +791,8 @@ function parsePackageName(specifier, base) { - return { packageName, packageSubpath, isScoped }; +@@ -751,6 +751,7 @@ function packageImportsResolve(name, base, conditions) { + throw importNotDefined(name, packageJSONUrl, base); } +const electronTypes = ['electron', 'electron/main', 'electron/common', 'electron/renderer']; -+ + /** * Resolves a package specifier to a URL. - * @param {string} specifier - The package specifier to resolve. -@@ -804,6 +806,11 @@ function packageResolve(specifier, base, conditions) { +@@ -765,6 +766,11 @@ function packageResolve(specifier, base, conditions) { return new URL('node:' + specifier); } @@ -67,11 +66,11 @@ index 61c043e35c6ce9ef9d7255e009162289e80eaf4d..0c41492aa9652112df0b839361570a83 + return new URL('electron:electron'); + } + - const { packageName, packageSubpath, isScoped } = - parsePackageName(specifier, base); + const { packageJSONUrl, packageJSONPath, packageSubpath } = packageJsonReader.getPackageJSONURL(specifier, base); + const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true }); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 491dc3f450733a9181096a145cfa508767682658..23ed971daebdda3cb627907ffa3626daaa5b5b7b 100644 +index a587246e329b41f33a3fdfe5ef92910915911611..1b94d923b6d83cc7806d793497a4f9f978c5938c 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -182,7 +182,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { @@ -106,7 +105,7 @@ index 491dc3f450733a9181096a145cfa508767682658..23ed971daebdda3cb627907ffa3626da // This translator function must be sync, as `require` is sync. translators.set('require-commonjs-typescript', (url, source, isMain) => { diff --git a/lib/internal/url.js b/lib/internal/url.js -index 14b0ef61d2f91cf48bba9aceefc55751e7ed5db2..6d6b32f65131d1d55aeeae27dd2970440d99b4bd 100644 +index f6e58e196860fc9321e3367f8461ec2647d7e8f8..a80ecee888222e02f5d03f42f7af2c1ab9750cab 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1505,6 +1505,8 @@ function fileURLToPath(path, options = kEmptyObject) { diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index 7bc0ece811be..cdd487fd9f6c 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -17,7 +17,7 @@ Upstreams: - https://github.com/nodejs/node/pull/39136 diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc -index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93ea5075700 100644 +index ce2e7b384eb1987ddb081f79884fb8cb62ade60b..bffdb0259eeed7389adb54a8ff13a1ac4e767d90 100644 --- a/deps/ncrypto/ncrypto.cc +++ b/deps/ncrypto/ncrypto.cc @@ -11,9 +11,6 @@ @@ -30,7 +30,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e namespace ncrypto { namespace { -@@ -708,7 +705,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) { +@@ -789,7 +786,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) { bool ok = true; @@ -39,7 +39,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i); if (i != 0) BIO_write(out.get(), ", ", 2); -@@ -732,7 +729,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) { +@@ -813,7 +810,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) { bool ok = true; @@ -48,7 +48,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e ACCESS_DESCRIPTION* desc = sk_ACCESS_DESCRIPTION_value(descs, i); if (i != 0) BIO_write(out.get(), "\n", 1); -@@ -874,13 +871,17 @@ BIOPointer X509View::getValidTo() const { +@@ -955,13 +952,17 @@ BIOPointer X509View::getValidTo() const { int64_t X509View::getValidToTime() const { struct tm tp; @@ -67,7 +67,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e return PortableTimeGM(&tp); } -@@ -1085,7 +1086,11 @@ BIOPointer BIOPointer::NewMem() { +@@ -1236,7 +1237,11 @@ BIOPointer BIOPointer::NewMem() { } BIOPointer BIOPointer::NewSecMem() { @@ -80,7 +80,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e } BIOPointer BIOPointer::New(const BIO_METHOD* method) { -@@ -1149,8 +1154,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name, +@@ -1306,8 +1311,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name, #define V(n, p) \ if (EqualNoCase(name, n)) return BignumPointer(p(nullptr)); if (option != FindGroupOption::NO_SMALL_PRIMES) { @@ -91,7 +91,7 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e V("modp5", BN_get_rfc3526_prime_1536); } V("modp14", BN_get_rfc3526_prime_2048); -@@ -1223,11 +1230,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey( +@@ -1383,11 +1390,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey( int codes = 0; if (DH_check_pub_key(dh_.get(), pub_key.get(), &codes) != 1) return DHPointer::CheckPublicKeyResult::CHECK_FAILED; @@ -106,11 +106,59 @@ index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93e return DHPointer::CheckPublicKeyResult::INVALID; } return CheckPublicKeyResult::NONE; +@@ -2330,7 +2339,7 @@ const std::string_view SSLPointer::getClientHelloAlpn() const { + const unsigned char* buf; + size_t len; + size_t rem; +- ++#ifndef OPENSSL_IS_BORINGSSL + if (!SSL_client_hello_get0_ext( + get(), + TLSEXT_TYPE_application_layer_protocol_negotiation, +@@ -2343,6 +2352,8 @@ const std::string_view SSLPointer::getClientHelloAlpn() const { + len = (buf[0] << 8) | buf[1]; + if (len + 2 != rem) return {}; + return reinterpret_cast(buf + 3); ++#endif ++ return nullptr; + } + + const std::string_view SSLPointer::getClientHelloServerName() const { +@@ -2350,7 +2361,7 @@ const std::string_view SSLPointer::getClientHelloServerName() const { + const unsigned char* buf; + size_t len; + size_t rem; +- ++#ifndef OPENSSL_IS_BORINGSSL + if (!SSL_client_hello_get0_ext(get(), TLSEXT_TYPE_server_name, &buf, &rem) || + rem <= 2) { + return {}; +@@ -2366,6 +2377,8 @@ const std::string_view SSLPointer::getClientHelloServerName() const { + len = (*(buf + 3) << 8) | *(buf + 4); + if (len + 2 > rem) return {}; + return reinterpret_cast(buf + 5); ++#endif ++ return nullptr; + } + + std::optional SSLPointer::GetServerName( +@@ -2399,8 +2412,11 @@ bool SSLPointer::isServer() const { + EVPKeyPointer SSLPointer::getPeerTempKey() const { + if (!ssl_) return {}; + EVP_PKEY* raw_key = nullptr; ++#ifndef OPENSSL_IS_BORINGSSL + if (!SSL_get_peer_tmp_key(get(), &raw_key)) return {}; + return EVPKeyPointer(raw_key); ++#endif ++ return {}; + } + + SSLCtxPointer::SSLCtxPointer(SSL_CTX* ctx) : ctx_(ctx) {} diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h -index fffa75ec718facc61cebf48f33ddc3909b9b9413..19757016a4f50e2f656a76bf60cb87e601845afe 100644 +index e5bf2b529bf23914677e25d7468aad58a4684557..9a3c6029ff3319cce58c79782a7bd5d1fcd467f9 100644 --- a/deps/ncrypto/ncrypto.h +++ b/deps/ncrypto/ncrypto.h -@@ -516,17 +516,21 @@ class DHPointer final { +@@ -623,17 +623,21 @@ class DHPointer final { UNABLE_TO_CHECK_GENERATOR = DH_UNABLE_TO_CHECK_GENERATOR, NOT_SUITABLE_GENERATOR = DH_NOT_SUITABLE_GENERATOR, Q_NOT_PRIME = DH_CHECK_Q_NOT_PRIME, @@ -147,10 +195,10 @@ index 245a43920c7baf000ba63192a84a4c3fd219be7d..56a554175b805c1703f13d62041f8c80 # The location of simdutf - use the one from node's deps by default. node_simdutf_path = "$node_path/deps/simdutf" diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc -index c7588583530cf291946d01cec807390d987706cf..495fb92355a7eadc2f7ec885a3b529988bb3bd02 100644 +index 1754d1f71b8adbcb584bfe4606e2a341836fb671..ac0f529e75c30add0708dc20470846f2f56e4b86 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc -@@ -1080,7 +1080,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { +@@ -1033,7 +1033,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) { return ThrowCryptoError(env, ERR_get_error()); } @@ -159,7 +207,7 @@ index c7588583530cf291946d01cec807390d987706cf..495fb92355a7eadc2f7ec885a3b52998 int rsa_pkcs1_implicit_rejection = EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1"); // From the doc -2 means that the option is not supported. -@@ -1095,6 +1095,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { +@@ -1048,6 +1048,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { env, "RSA_PKCS1_PADDING is no longer supported for private decryption"); } @@ -168,45 +216,10 @@ index c7588583530cf291946d01cec807390d987706cf..495fb92355a7eadc2f7ec885a3b52998 const EVP_MD* digest = nullptr; diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc -index 43a126f863779d3f364f92bd237039474b489845..77a3caee93049f65faef37e93b871c467ebca7e5 100644 +index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f877c0e77c 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc -@@ -134,7 +134,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { - const unsigned char* buf; - size_t len; - size_t rem; -- -+#ifndef OPENSSL_IS_BORINGSSL - if (!SSL_client_hello_get0_ext( - ssl.get(), - TLSEXT_TYPE_application_layer_protocol_negotiation, -@@ -147,13 +147,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { - len = (buf[0] << 8) | buf[1]; - if (len + 2 != rem) return nullptr; - return reinterpret_cast(buf + 3); -+#endif -+ return nullptr; - } - - const char* GetClientHelloServerName(const SSLPointer& ssl) { - const unsigned char* buf; - size_t len; - size_t rem; -- -+#ifndef OPENSSL_IS_BORINGSSL - if (!SSL_client_hello_get0_ext( - ssl.get(), - TLSEXT_TYPE_server_name, -@@ -175,6 +177,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { - if (len + 2 > rem) - return nullptr; - return reinterpret_cast(buf + 5); -+#endif -+ return nullptr; - } - - const char* GetServerName(SSL* ssl) { -@@ -282,7 +286,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert, +@@ -124,7 +124,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert, if (!peer_certs) return StackOfX509(); if (cert && !sk_X509_push(peer_certs.get(), cert.release())) return StackOfX509(); @@ -215,52 +228,30 @@ index 43a126f863779d3f364f92bd237039474b489845..77a3caee93049f65faef37e93b871c46 X509Pointer cert(X509_dup(sk_X509_value(ssl_certs, i))); if (!cert || !sk_X509_push(peer_certs.get(), cert.get())) return StackOfX509(); -@@ -298,7 +302,7 @@ MaybeLocal AddIssuerChainToObject(X509Pointer* cert, +@@ -140,7 +140,7 @@ MaybeLocal AddIssuerChainToObject(X509Pointer* cert, Environment* const env) { cert->reset(sk_X509_delete(peer_certs.get(), 0)); for (;;) { - int i; + size_t i; for (i = 0; i < sk_X509_num(peer_certs.get()); i++) { - ncrypto::X509View ca(sk_X509_value(peer_certs.get(), i)); + X509View ca(sk_X509_value(peer_certs.get(), i)); if (!cert->view().isIssuedBy(ca)) continue; -@@ -384,14 +388,14 @@ MaybeLocal GetClientHelloCiphers( - Environment* env, - const SSLPointer& ssl) { - EscapableHandleScope scope(env->isolate()); -- const unsigned char* buf; -- size_t len = SSL_client_hello_get0_ciphers(ssl.get(), &buf); -+ // const unsigned char* buf = nullptr; -+ size_t len = 0; // SSL_client_hello_get0_ciphers(ssl.get(), &buf); - size_t count = len / 2; - MaybeStackBuffer, 16> ciphers(count); - int j = 0; - for (size_t n = 0; n < len; n += 2) { -- const SSL_CIPHER* cipher = SSL_CIPHER_find(ssl.get(), buf); -- buf += 2; -+ const SSL_CIPHER* cipher = nullptr; // SSL_CIPHER_find(ssl.get(), buf); -+ // buf += 2; - Local obj = Object::New(env->isolate()); - if (!Set(env->context(), - obj, -@@ -444,8 +448,11 @@ MaybeLocal GetEphemeralKey(Environment* env, const SSLPointer& ssl) { - - EscapableHandleScope scope(env->isolate()); - Local info = Object::New(env->isolate()); -+#ifndef OPENSSL_IS_BORINGSSL - if (!SSL_get_peer_tmp_key(ssl.get(), &raw_key)) return scope.Escape(info); -- -+#else -+ if (!SSL_get_server_tmp_key(ssl.get(), &raw_key)) return scope.Escape(info); -+#endif - Local context = env->context(); - crypto::EVPKeyPointer key(raw_key); - diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index aa5fc61f19e435b4833f3f49df10fa1edf2142c7..0a338b018a4ec20cb5bce250faf60d3f3bf192d4 100644 +index c89d591c6804ab7d41199d61452d10d12cdf7398..05740c7dc599954bca0779b8c8d6bd615183288a 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc -@@ -94,7 +94,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, +@@ -26,7 +26,9 @@ using ncrypto::BIOPointer; + using ncrypto::ClearErrorOnReturn; + using ncrypto::CryptoErrorList; + using ncrypto::DHPointer; ++#ifndef OPENSSL_NO_ENGINE + using ncrypto::EnginePointer; ++#endif // !OPENSSL_NO_ENGINE + using ncrypto::EVPKeyPointer; + using ncrypto::MarkPopErrorOnReturn; + using ncrypto::SSLPointer; +@@ -105,7 +107,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, // the CA certificates. SSL_CTX_clear_extra_chain_certs(ctx); @@ -269,7 +260,7 @@ index aa5fc61f19e435b4833f3f49df10fa1edf2142c7..0a338b018a4ec20cb5bce250faf60d3f X509* ca = sk_X509_value(extra_certs, i); // NOTE: Increments reference count on `ca` -@@ -920,11 +920,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { +@@ -931,11 +933,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { // If the user specified "auto" for dhparams, the JavaScript layer will pass // true to this function instead of the original string. Any other string // value will be interpreted as custom DH parameters below. @@ -283,7 +274,7 @@ index aa5fc61f19e435b4833f3f49df10fa1edf2142c7..0a338b018a4ec20cb5bce250faf60d3f DHPointer dh; { BIOPointer bio(LoadBIO(env, args[0])); -@@ -1150,7 +1151,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo& args) { +@@ -1161,7 +1164,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo& args) { } // Add CA certs too @@ -293,7 +284,7 @@ index aa5fc61f19e435b4833f3f49df10fa1edf2142c7..0a338b018a4ec20cb5bce250faf60d3f X509_STORE_add_cert(sc->GetCertStoreOwnedByThisSecureContext(), ca); diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d77b98958 100644 +index 7041eb985d9f6d163098a94342aec976cb6c2bb9..5387d9625a28bb7d11f7f0f05a5f07d1fee2c216 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc @@ -7,7 +7,9 @@ @@ -306,7 +297,7 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d #include "openssl/dh.h" #include "threadpoolwork-inl.h" #include "v8.h" -@@ -86,11 +88,7 @@ void New(const FunctionCallbackInfo& args) { +@@ -88,11 +90,7 @@ void New(const FunctionCallbackInfo& args) { if (args[0]->IsInt32()) { int32_t bits = args[0].As()->Value(); if (bits < 2) { @@ -319,7 +310,7 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d return ThrowCryptoError(env, ERR_get_error(), "Invalid prime length"); } -@@ -103,7 +101,7 @@ void New(const FunctionCallbackInfo& args) { +@@ -105,7 +103,7 @@ void New(const FunctionCallbackInfo& args) { } int32_t generator = args[1].As()->Value(); if (generator < 2) { @@ -328,7 +319,7 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); } -@@ -132,12 +130,12 @@ void New(const FunctionCallbackInfo& args) { +@@ -134,12 +132,12 @@ void New(const FunctionCallbackInfo& args) { if (args[1]->IsInt32()) { int32_t generator = args[1].As()->Value(); if (generator < 2) { @@ -343,7 +334,7 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); } } else { -@@ -146,11 +144,11 @@ void New(const FunctionCallbackInfo& args) { +@@ -148,11 +146,11 @@ void New(const FunctionCallbackInfo& args) { return THROW_ERR_OUT_OF_RANGE(env, "generator is too big"); bn_g = BignumPointer(reinterpret_cast(arg1.data()), arg1.size()); if (!bn_g) { @@ -357,7 +348,7 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); } } -@@ -258,15 +256,17 @@ void ComputeSecret(const FunctionCallbackInfo& args) { +@@ -260,15 +258,17 @@ void ComputeSecret(const FunctionCallbackInfo& args) { BignumPointer key(key_buf.data(), key_buf.size()); switch (dh.checkPublicKey(key)) { @@ -377,7 +368,7 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d case DHPointer::CheckPublicKeyResult::NONE: break; } -@@ -398,9 +398,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { +@@ -400,9 +400,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { key_params = EVPKeyPointer::New(); CHECK(key_params); CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1); @@ -390,7 +381,7 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d if (!param_ctx || EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || EVP_PKEY_CTX_set_dh_paramgen_prime_len( -@@ -414,6 +416,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { +@@ -416,6 +418,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { } key_params = EVPKeyPointer(raw_params); @@ -401,10 +392,10 @@ index d760a0d3ea1d12184a558f5e87cb22043d26a0f5..f973941b3b9ea954f35f2ea135f8ee3d UNREACHABLE(); } diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc -index b557de774117e442d7f429e92d63a6e1faa236fd..0aca233ced39269b09c383e5b32d85cf36260a1e 100644 +index 471fee77531139ce988292470dff443fdfb05b07..931f7c2ae3d7e12afce471545d610d22f63412d7 100644 --- a/src/crypto/crypto_dsa.cc +++ b/src/crypto/crypto_dsa.cc -@@ -40,7 +40,7 @@ namespace crypto { +@@ -43,7 +43,7 @@ namespace crypto { EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) { EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DSA, nullptr)); EVP_PKEY* raw_params = nullptr; @@ -413,7 +404,7 @@ index b557de774117e442d7f429e92d63a6e1faa236fd..0aca233ced39269b09c383e5b32d85cf if (!param_ctx || EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || EVP_PKEY_CTX_set_dsa_paramgen_bits( -@@ -55,7 +55,9 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) { +@@ -58,7 +58,9 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) { return EVPKeyCtxPointer(); } } @@ -425,10 +416,10 @@ index b557de774117e442d7f429e92d63a6e1faa236fd..0aca233ced39269b09c383e5b32d85cf return EVPKeyCtxPointer(); diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc -index ac4103400e1e293909e7c524f4a1422c5f04e707..c44c11cbd533350d8bf149032c658d5585303b7d 100644 +index f66c57b1079af6cd040dc6d11e72f353507b75e5..abd2bccb9669e06dd8355f66220f8b06c8e863dc 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc -@@ -945,6 +945,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( +@@ -949,6 +949,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( } bool KeyObjectHandle::CheckEcKeyData() const { @@ -436,7 +427,7 @@ index ac4103400e1e293909e7c524f4a1422c5f04e707..c44c11cbd533350d8bf149032c658d55 MarkPopErrorOnReturn mark_pop_error_on_return; const auto& key = data_.GetAsymmetricKey(); -@@ -961,6 +962,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { +@@ -965,6 +966,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { #else return EVP_PKEY_public_check(ctx.get()) == 1; #endif @@ -447,10 +438,10 @@ index ac4103400e1e293909e7c524f4a1422c5f04e707..c44c11cbd533350d8bf149032c658d55 void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo& args) { diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc -index b59e394d9a7e2c19fdf1f2b0177753ff488da0fa..91218f49da5392c6f769495ee7f9275a47ce09b1 100644 +index cb96698aa644c3b6c506c0979910f2b4421d63ad..b9b21329199b49c9e41f9ae708296e5b0edb39b0 100644 --- a/src/crypto/crypto_random.cc +++ b/src/crypto/crypto_random.cc -@@ -134,7 +134,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( +@@ -143,7 +143,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( params->bits = bits; params->safe = safe; @@ -460,10 +451,10 @@ index b59e394d9a7e2c19fdf1f2b0177753ff488da0fa..91218f49da5392c6f769495ee7f9275a THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime"); return Nothing(); diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc -index 6d360554b31d53a597d61fcbd660f703a903ca21..86fafe98222d4c18f062032d80104f3ef00dbc01 100644 +index 05a3882c7e17d78e27aabb29891aa250789a47c0..1f2fccce6ed8f14525557644e0bdd130eedf3337 100644 --- a/src/crypto/crypto_rsa.cc +++ b/src/crypto/crypto_rsa.cc -@@ -608,10 +608,13 @@ Maybe GetRsaKeyDetail(Environment* env, +@@ -612,10 +612,13 @@ Maybe GetRsaKeyDetail(Environment* env, } if (params->saltLength != nullptr) { @@ -478,10 +469,20 @@ index 6d360554b31d53a597d61fcbd660f703a903ca21..86fafe98222d4c18f062032d80104f3e if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 12ee0cde0897024bccb0face49053544a0bcfcd7..8a6a36a3c31532ed585c287ba8cee14026d315b4 100644 +index e255288f6e013ce122f317c415d73d9c93d38580..25fa9af8153852f49d5289aa253f3c8f7268d89c 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -495,24 +495,15 @@ Maybe Decorate(Environment* env, +@@ -29,7 +29,9 @@ namespace node { + using ncrypto::BignumPointer; + using ncrypto::BIOPointer; + using ncrypto::CryptoErrorList; ++#ifndef OPENSSL_NO_ENGINE + using ncrypto::EnginePointer; ++#endif // !OPENSSL_NO_ENGINE + using ncrypto::EVPKeyCtxPointer; + using v8::ArrayBuffer; + using v8::BackingStore; +@@ -502,24 +504,15 @@ Maybe Decorate(Environment* env, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -507,7 +508,7 @@ index 12ee0cde0897024bccb0face49053544a0bcfcd7..8a6a36a3c31532ed585c287ba8cee140 V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -654,7 +645,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -661,7 +654,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); uint32_t len = args[0].As()->Value(); @@ -516,7 +517,7 @@ index 12ee0cde0897024bccb0face49053544a0bcfcd7..8a6a36a3c31532ed585c287ba8cee140 if (data == nullptr) { // There's no memory available for the allocation. // Return nothing. -@@ -665,7 +656,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -672,7 +665,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { data, len, [](void* data, size_t len, void* deleter_data) { @@ -525,7 +526,7 @@ index 12ee0cde0897024bccb0face49053544a0bcfcd7..8a6a36a3c31532ed585c287ba8cee140 }, data); Local buffer = ArrayBuffer::New(env->isolate(), store); -@@ -673,10 +664,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -680,10 +673,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) { @@ -539,7 +540,7 @@ index 12ee0cde0897024bccb0face49053544a0bcfcd7..8a6a36a3c31532ed585c287ba8cee140 } // namespace diff --git a/src/env.h b/src/env.h -index 16312e548e526b80ec9a230bc3c772f45685b61f..0a3f09ebc7e2e7c1f8b9499d4439e2ca90b86810 100644 +index 1239cbdbf2d375a50ada37ee0ed5592c751d4c5c..aed066852d7c257076cc7ca8b173fd2a3a353a00 100644 --- a/src/env.h +++ b/src/env.h @@ -50,7 +50,7 @@ @@ -551,7 +552,7 @@ index 16312e548e526b80ec9a230bc3c772f45685b61f..0a3f09ebc7e2e7c1f8b9499d4439e2ca #include #endif -@@ -1062,7 +1062,7 @@ class Environment final : public MemoryRetainer { +@@ -1071,7 +1071,7 @@ class Environment final : public MemoryRetainer { kExitInfoFieldCount }; @@ -574,7 +575,7 @@ index c59e65ad1fe3fac23f1fc25ca77e6133d1ccaccd..f2f07434e076e2977755ef7dac7d489a #if NODE_OPENSSL_HAS_QUIC #include diff --git a/src/node_options.cc b/src/node_options.cc -index a03daec2bd74d7857d38238ea0479e36e054a7a3..f70e0917f6caa66210107cdb2ef891685563ba96 100644 +index 1d81079a9b7d8a69ad2d87835090be88ae507bd8..3608ab2b4aeb09e985ca98e23f2dff23567ade71 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -6,7 +6,7 @@ @@ -587,7 +588,7 @@ index a03daec2bd74d7857d38238ea0479e36e054a7a3..f70e0917f6caa66210107cdb2ef89168 #endif diff --git a/src/node_options.h b/src/node_options.h -index ab6ea77b2e9ce54af44e21c29fcba929f117c41b..23923ccd645e810d84b0a08e57e486d012b5796b 100644 +index 621f5eca96b10685734a39e56cce7cee6c8a25bf..41dd04f5e2b1cd54c32df70830389d44d7b39aa2 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ @@ -600,7 +601,7 @@ index ab6ea77b2e9ce54af44e21c29fcba929f117c41b..23923ccd645e810d84b0a08e57e486d0 #endif diff --git a/unofficial.gni b/unofficial.gni -index 3632d5bd21e277fcbd8d62dc65598a7f7c87f00e..08a4ed939fb1482a897def94128282fdfd63dc62 100644 +index a2f3a769ceaa08db6d7438223884dc5aeab1340d..08603eaef2da51fd92f9bf977647b56409eff48c 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -151,7 +151,6 @@ template("node_gn_build") { diff --git a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch index f6e341be495e..fa54a035afce 100644 --- a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch +++ b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch @@ -38,7 +38,7 @@ index a00b5979e3b5deb4ba315b4635c7e5d2801c376e..c9d4a3536d0f60375ae623b48ca2fa70 const result = dataURLProcessor(url); if (result === 'failure') { diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 0c41492aa9652112df0b839361570a832daf3b13..f2fbb576da23fc0a48b0c979a263aa2dbe3600eb 100644 +index 9e7d8ef0adef3b68a3ec186e4b218f591aa69266..2879e5cf541fb4d226cfd7cc0fe367ca448fb926 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -25,7 +25,7 @@ const { @@ -60,7 +60,7 @@ index 0c41492aa9652112df0b839361570a832daf3b13..f2fbb576da23fc0a48b0c979a263aa2d }); const { search, hash } = resolved; diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 23ed971daebdda3cb627907ffa3626daaa5b5b7b..0f138b1099b4833176e8a0ce681c745422efc24a 100644 +index 1b94d923b6d83cc7806d793497a4f9f978c5938c..0caba80bb213e0edfb1f834250f895ccc05d0d1c 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -24,7 +24,7 @@ const { @@ -72,7 +72,7 @@ index 23ed971daebdda3cb627907ffa3626daaa5b5b7b..0f138b1099b4833176e8a0ce681c7454 const { dirname, extname, isAbsolute } = require('path'); const { assertBufferSource, -@@ -269,7 +269,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) { +@@ -268,7 +268,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) { try { // We still need to read the FS to detect the exports. @@ -81,7 +81,7 @@ index 23ed971daebdda3cb627907ffa3626daaa5b5b7b..0f138b1099b4833176e8a0ce681c7454 } catch { // Continue regardless of error. } -@@ -336,7 +336,7 @@ function cjsPreparseModuleExports(filename, source) { +@@ -335,7 +335,7 @@ function cjsPreparseModuleExports(filename, source) { isAbsolute(resolved)) { // TODO: this should be calling the `load` hook chain to get the source // (and fallback to reading the FS only if the source is nullish). diff --git a/patches/node/fix_remove_deprecated_errno_constants.patch b/patches/node/fix_remove_deprecated_errno_constants.patch index 0bccd1e238a1..ab580184a317 100644 --- a/patches/node/fix_remove_deprecated_errno_constants.patch +++ b/patches/node/fix_remove_deprecated_errno_constants.patch @@ -45,7 +45,7 @@ index 127278ef916161a96e23e645927d16bedfdaca5b..b36da3daa5744e6f994e32d9d82aaef6 # define UV__EUNATCH UV__ERR(EUNATCH) #else diff --git a/src/node_constants.cc b/src/node_constants.cc -index 149c7c107322919dfeea1dfe89dc223f78b0e979..e4e8dac6b8b5924a7eae83935031e09142554747 100644 +index 13263149c111beede83b7063fa54f56655aea54c..99068098e1867af4846e18a5d039a25689722a4a 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -241,10 +241,6 @@ void DefineErrnoConstants(Local target) { @@ -86,10 +86,10 @@ index 149c7c107322919dfeea1dfe89dc223f78b0e979..e4e8dac6b8b5924a7eae83935031e091 NODE_DEFINE_CONSTANT(target, ETIMEDOUT); #endif diff --git a/src/node_errors.cc b/src/node_errors.cc -index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe9963d100a8b 100644 +index 609601328f7f5ff5f121151e81c2df82e7ef4253..6b9b944c11af917fe4e296961e6ed7df7b89a123 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc -@@ -857,10 +857,6 @@ const char* errno_string(int errorno) { +@@ -862,10 +862,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ENOBUFS); #endif @@ -100,7 +100,7 @@ index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe996 #ifdef ENODEV ERRNO_CASE(ENODEV); #endif -@@ -899,14 +895,6 @@ const char* errno_string(int errorno) { +@@ -904,14 +900,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ENOSPC); #endif @@ -115,7 +115,7 @@ index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe996 #ifdef ENOSYS ERRNO_CASE(ENOSYS); #endif -@@ -989,10 +977,6 @@ const char* errno_string(int errorno) { +@@ -994,10 +982,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ESTALE); #endif diff --git a/patches/node/fix_remove_fastapitypedarray_usage.patch b/patches/node/fix_remove_fastapitypedarray_usage.patch index 1fc987f0bf35..b1dad662b716 100644 --- a/patches/node/fix_remove_fastapitypedarray_usage.patch +++ b/patches/node/fix_remove_fastapitypedarray_usage.patch @@ -246,7 +246,7 @@ index 8d49a119c218323674e29a522ecf71bd22cdaf1b..d39693f2f45f39e45960453112b0f646 // This class manages the external references from the V8 heap // to the C++ addresses in Node.js. diff --git a/src/util.h b/src/util.h -index b1f316eebc7199a3737f05a5f9a1dd7fc289490c..23a0a486244ce38277ef11df5806da1266b901ac 100644 +index 0d4676ddade8d91d101b6aeb8763886a234f0bae..7af9ed01a919927ae3897d4989206ec23cfe50d3 100644 --- a/src/util.h +++ b/src/util.h @@ -59,6 +59,7 @@ @@ -257,7 +257,7 @@ index b1f316eebc7199a3737f05a5f9a1dd7fc289490c..23a0a486244ce38277ef11df5806da12 #ifdef _WIN32 /* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ -@@ -576,6 +577,16 @@ class BufferValue : public MaybeStackBuffer { +@@ -579,6 +580,16 @@ class BufferValue : public MaybeStackBuffer { static_cast(name->Buffer()->Data()) + name##_offset; \ if (name##_length > 0) CHECK_NE(name##_data, nullptr); diff --git a/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch b/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch index 22df4459ff31..7918bde078ef 100644 --- a/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch +++ b/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch @@ -15,7 +15,7 @@ to recognize asar files. This reverts commit 9cf2e1f55b8446a7cde23699d00a3be73aa0c8f1. diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index f2fbb576da23fc0a48b0c979a263aa2dbe3600eb..97d3b4e9bd9303e1271bb62b1c9851da1100e019 100644 +index 2879e5cf541fb4d226cfd7cc0fe367ca448fb926..8bd68839878427d58d4c61e19c8ec339df4911cd 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -28,14 +28,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm'); diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index e59e114deffb..c6c29f00a2ea 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -6,10 +6,10 @@ Subject: Pass all globals through "require" (cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 236b2484049c43ee9d6b9c728561b80813b12982..ccd038dc136480cdd84a13e58f4012b71cd40928 100644 +index 62c33730ed17cb98b6dd8d69b61360a419518ba5..9b5772fe9b8babbb892c7a5ec79258472da55a76 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -182,6 +182,13 @@ const { +@@ -185,6 +185,13 @@ const { CHAR_FORWARD_SLASH, } = require('internal/constants'); @@ -23,7 +23,7 @@ index 236b2484049c43ee9d6b9c728561b80813b12982..ccd038dc136480cdd84a13e58f4012b7 const { isProxy, } = require('internal/util/types'); -@@ -1557,10 +1564,12 @@ Module.prototype._compile = function(content, filename, format) { +@@ -1549,10 +1556,12 @@ Module.prototype._compile = function(content, filename, format) { if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) { const { callAndPauseOnStart } = internalBinding('inspector'); result = callAndPauseOnStart(compiledWrapper, thisValue, exports, diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index 5f1b7347b021..091bdc3abcec 100644 --- a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch +++ b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch @@ -7,7 +7,7 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were a real filesystem. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js -index 11d585bc5b3e47b36877ca8306b72f571acb7d09..65d42428c70a3242f7076f1c1a4cec027a9c9829 100644 +index f5c0208864084a234a05898e793845681b6e80cc..48d809f61eaf09097acb3e996e956e39cf7b4ef3 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -134,6 +134,10 @@ process.domain = null; diff --git a/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch b/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch index 583f1658d9a3..c866e376873f 100644 --- a/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch +++ b/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch @@ -33,7 +33,7 @@ Reviewed-By: Rafael Gonzaga Reviewed-By: James M Snell diff --git a/src/node_process_object.cc b/src/node_process_object.cc -index a13f8d15724cb00fe0e9d722395bd9b9514a3943..3f8a4fbd1a65971645e6785e469bc887a1afbad1 100644 +index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a246892b6 100644 --- a/src/node_process_object.cc +++ b/src/node_process_object.cc @@ -13,7 +13,6 @@ @@ -44,7 +44,7 @@ index a13f8d15724cb00fe0e9d722395bd9b9514a3943..3f8a4fbd1a65971645e6785e469bc887 using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; -@@ -188,13 +187,12 @@ void PatchProcessObject(const FunctionCallbackInfo& args) { +@@ -186,13 +185,12 @@ void PatchProcessObject(const FunctionCallbackInfo& args) { // process.title CHECK(process @@ -59,7 +59,7 @@ index a13f8d15724cb00fe0e9d722395bd9b9514a3943..3f8a4fbd1a65971645e6785e469bc887 None, SideEffectType::kHasNoSideEffect) .FromJust()); -@@ -213,9 +211,15 @@ void PatchProcessObject(const FunctionCallbackInfo& args) { +@@ -211,9 +209,15 @@ void PatchProcessObject(const FunctionCallbackInfo& args) { READONLY_PROPERTY(process, "pid", Integer::New(isolate, uv_os_getpid())); @@ -78,7 +78,7 @@ index a13f8d15724cb00fe0e9d722395bd9b9514a3943..3f8a4fbd1a65971645e6785e469bc887 // --security-revert flags #define V(code, _, __) \ -@@ -240,12 +244,15 @@ void PatchProcessObject(const FunctionCallbackInfo& args) { +@@ -238,12 +242,15 @@ void PatchProcessObject(const FunctionCallbackInfo& args) { // process.debugPort CHECK(process diff --git a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch index 8dff31ced1ba..b99712eaf254 100644 --- a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch +++ b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch @@ -16,7 +16,7 @@ patch: (cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326) diff --git a/src/env-inl.h b/src/env-inl.h -index c460018af954e6333cd937059ae5dc81f179d8ca..d266eca6fc3300e657383feb4bb7a7194da79275 100644 +index 49c3513ee9b67b407a2bb6609ac89a5959a78cd1..9a8216354e646e86d692b25c2bed5134e267528c 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const { @@ -52,7 +52,7 @@ index c460018af954e6333cd937059ae5dc81f179d8ca..d266eca6fc3300e657383feb4bb7a719 return &(wrapper_data_->cppgc_id); } diff --git a/src/env.cc b/src/env.cc -index adb6cc1c2f1c0100b64e688d13e5ca81b1ae2775..579a15f0e1fdd97184ec81873dbc4547e747ec1d 100644 +index b428c922ed218cbdf19cdba50d18b1f81a56b8ca..1c1062a3996f2bb7de9e91f7f4385c8f8d20f490 100644 --- a/src/env.cc +++ b/src/env.cc @@ -23,6 +23,7 @@ @@ -71,7 +71,7 @@ index adb6cc1c2f1c0100b64e688d13e5ca81b1ae2775..579a15f0e1fdd97184ec81873dbc4547 using worker::Worker; int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64; -@@ -531,6 +531,14 @@ void IsolateData::CreateProperties() { +@@ -527,6 +527,14 @@ void IsolateData::CreateProperties() { CreateEnvProxyTemplate(this); } @@ -86,7 +86,7 @@ index adb6cc1c2f1c0100b64e688d13e5ca81b1ae2775..579a15f0e1fdd97184ec81873dbc4547 constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de; Mutex IsolateData::isolate_data_mutex_; std::unordered_map> -@@ -568,36 +576,16 @@ IsolateData::IsolateData(Isolate* isolate, +@@ -564,36 +572,16 @@ IsolateData::IsolateData(Isolate* isolate, v8::CppHeap* cpp_heap = isolate->GetCppHeap(); uint16_t cppgc_id = kDefaultCppGCEmbedderID; @@ -130,7 +130,7 @@ index adb6cc1c2f1c0100b64e688d13e5ca81b1ae2775..579a15f0e1fdd97184ec81873dbc4547 { // GC could still be run after the IsolateData is destroyed, so we store -@@ -629,11 +617,12 @@ IsolateData::~IsolateData() { +@@ -625,11 +613,12 @@ IsolateData::~IsolateData() { } } @@ -146,7 +146,7 @@ index adb6cc1c2f1c0100b64e688d13e5ca81b1ae2775..579a15f0e1fdd97184ec81873dbc4547 void IsolateData::MemoryInfo(MemoryTracker* tracker) const { diff --git a/src/env.h b/src/env.h -index 0a3f09ebc7e2e7c1f8b9499d4439e2ca90b86810..d6f412cb13460f97f9444af397c8025c7a8bd290 100644 +index aed066852d7c257076cc7ca8b173fd2a3a353a00..1f8dc8f88d40ca95ba13d6517b2b5ed83184e1ce 100644 --- a/src/env.h +++ b/src/env.h @@ -175,10 +175,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { diff --git a/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch b/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch index 548b7c82afc5..62bca8851e95 100644 --- a/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch +++ b/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch @@ -26,7 +26,7 @@ index 3d8ccc77b5952a999c5fe48792259d32b402c460..867a1c4aca54b9d41490d23a5eb55088 } diff --git a/src/histogram.cc b/src/histogram.cc -index c62a5b8952400ff0dd8818c31a3e07622b63725c..36f61f57e951e1abfeb2fedb831b55c61363bcbc 100644 +index 0f0cde7be431dcb80c5314b1a9da49886c436d1c..f6d2bd439cad8b9f91c9d9a6cdb302e64130a5e2 100644 --- a/src/histogram.cc +++ b/src/histogram.cc @@ -195,7 +195,8 @@ void HistogramBase::FastRecord(Local unused, @@ -40,10 +40,10 @@ index c62a5b8952400ff0dd8818c31a3e07622b63725c..36f61f57e951e1abfeb2fedb831b55c6 } HistogramBase* histogram; diff --git a/src/node_file.cc b/src/node_file.cc -index 4bdbfa1be2c22f6a823acc380efe15c8d72f66ce..83f482612fae2d7ebf9bfd6817d334c239f8a218 100644 +index 1d22e19f16d5ad82466b0724971b2e4a685682f7..7531664c37833da9804d24c642a38a60c336c2c7 100644 --- a/src/node_file.cc +++ b/src/node_file.cc -@@ -1060,13 +1060,8 @@ static int32_t FastInternalModuleStat( +@@ -1061,13 +1061,8 @@ static int32_t FastInternalModuleStat( // NOLINTNEXTLINE(runtime/references) This is V8 api. FastApiCallbackOptions& options) { // This needs a HandleScope which needs an isolate. diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index f4b3eb95fd82..100326397f40 100644 --- a/patches/node/support_v8_sandboxed_pointers.patch +++ b/patches/node/support_v8_sandboxed_pointers.patch @@ -26,13 +26,13 @@ index ad323fc800a33c010b0504a4aa55c107498dee26..fc9b056d2f7e25109100fbde5f3ab0ae void* ret; if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers) diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index f973941b3b9ea954f35f2ea135f8ee3d77b98958..743c63ff7e3f526829919a8f2de7ebd625a93fbc 100644 +index 5387d9625a28bb7d11f7f0f05a5f07d1fee2c216..1b3b8c7b70073926f8dbf02759c2e1af5d938679 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc -@@ -51,6 +51,25 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { +@@ -55,13 +55,32 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { + namespace { - MaybeLocal DataPointerToBuffer(Environment* env, - ncrypto::DataPointer&& data) { + MaybeLocal DataPointerToBuffer(Environment* env, DataPointer&& data) { +#if defined(V8_ENABLE_SANDBOX) + std::unique_ptr backing; + if (data.size() > 0) { @@ -55,19 +55,19 @@ index f973941b3b9ea954f35f2ea135f8ee3d77b98958..743c63ff7e3f526829919a8f2de7ebd6 auto backing = ArrayBuffer::NewBackingStore( data.get(), data.size(), -@@ -59,6 +78,7 @@ MaybeLocal DataPointerToBuffer(Environment* env, - }, + [](void* data, size_t len, void* ptr) { DataPointer free_me(data, len); }, nullptr); data.release(); +- +#endif - auto ab = ArrayBuffer::New(env->isolate(), std::move(backing)); return Buffer::New(env, ab, 0, ab->ByteLength()).FromMaybe(Local()); + } diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 8a6a36a3c31532ed585c287ba8cee14026d315b4..3d449b5853f359d63e1b88671a857bf9152ff6af 100644 +index 25fa9af8153852f49d5289aa253f3c8f7268d89c..a67268f78b18cf71b90b9e31ad733eb0c8d93af3 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -326,10 +326,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { +@@ -335,10 +335,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { return *this; } @@ -104,7 +104,7 @@ index 8a6a36a3c31532ed585c287ba8cee14026d315b4..3d449b5853f359d63e1b88671a857bf9 std::unique_ptr ptr = ArrayBuffer::NewBackingStore( allocated_data_, size(), -@@ -341,10 +366,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { +@@ -350,10 +375,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { data_ = nullptr; size_ = 0; return ptr; @@ -117,7 +117,7 @@ index 8a6a36a3c31532ed585c287ba8cee14026d315b4..3d449b5853f359d63e1b88671a857bf9 return ArrayBuffer::New(env->isolate(), std::move(store)); } -@@ -641,6 +667,16 @@ namespace { +@@ -650,6 +676,16 @@ namespace { // in which case this has the same semantics as // using OPENSSL_malloc. However, if the secure heap is // initialized, SecureBuffer will automatically use it. @@ -134,7 +134,7 @@ index 8a6a36a3c31532ed585c287ba8cee14026d315b4..3d449b5853f359d63e1b88671a857bf9 void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); -@@ -662,6 +698,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -671,6 +707,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { Local buffer = ArrayBuffer::New(env->isolate(), store); args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); } @@ -143,10 +143,10 @@ index 8a6a36a3c31532ed585c287ba8cee14026d315b4..3d449b5853f359d63e1b88671a857bf9 void SecureHeapUsed(const FunctionCallbackInfo& args) { #ifndef OPENSSL_IS_BORINGSSL diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index 5c717c6fdb0fc453fa6c0061077300926af31ed5..b5fbe8e964943ab6f3842b27638f20ff64a1c0c4 100644 +index a5967c7d24b8365eb64ab63ec0b3ef8dc23c727e..2acebc3ac2ed9f631fc572f42f19f2e3dccfeb12 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h -@@ -268,7 +268,7 @@ class ByteSource { +@@ -241,7 +241,7 @@ class ByteSource { // Creates a v8::BackingStore that takes over responsibility for // any allocated data. The ByteSource will be reset with size = 0 // after being called. @@ -156,10 +156,10 @@ index 5c717c6fdb0fc453fa6c0061077300926af31ed5..b5fbe8e964943ab6f3842b27638f20ff v8::Local ToArrayBuffer(Environment* env); diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc -index 9b9bb7be9a8daca98a2635bf13cb6d1d561ea5fb..81afe2b5f7398f0c20b340648ca75022470be544 100644 +index 3465454e4de4a78912b81e7eca0de395fbe89911..c8ae863460107c69dd77d67c76c11843114e99c4 100644 --- a/src/crypto/crypto_x509.cc +++ b/src/crypto/crypto_x509.cc -@@ -175,6 +175,19 @@ MaybeLocal ToV8Value(Local context, const BIOPointer& bio) { +@@ -167,6 +167,19 @@ MaybeLocal ToV8Value(Local context, const BIOPointer& bio) { MaybeLocal ToBuffer(Environment* env, BIOPointer* bio) { if (bio == nullptr || !*bio) return {}; BUF_MEM* mem = *bio; @@ -179,7 +179,7 @@ index 9b9bb7be9a8daca98a2635bf13cb6d1d561ea5fb..81afe2b5f7398f0c20b340648ca75022 auto backing = ArrayBuffer::NewBackingStore( mem->data, mem->length, -@@ -182,6 +195,8 @@ MaybeLocal ToBuffer(Environment* env, BIOPointer* bio) { +@@ -174,6 +187,8 @@ MaybeLocal ToBuffer(Environment* env, BIOPointer* bio) { BIOPointer free_me(static_cast(data)); }, bio->release()); @@ -229,7 +229,7 @@ index 0bcf10a0b35accb8d6d5fe9891d4f52b27d40346..606c2021242e6967ea4195af3e2493a7 constexpr const char* EncodingName(const enum encoding encoding) { diff --git a/src/node_internals.h b/src/node_internals.h -index 000ba16303740d7e48dcaf7b7c2e16fd750ac599..6396dc8f1a9db806ca4a4b547914680fcbaed9a1 100644 +index 382df89a2312f76b5293412a8d51969ae5d9fa9c..1c90da9bbcb9547ab36de4d01088c03f3350b787 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -117,7 +117,9 @@ v8::Maybe InitializePrimordials(v8::Local context); diff --git a/patches/node/test_formally_mark_some_tests_as_flaky.patch b/patches/node/test_formally_mark_some_tests_as_flaky.patch index f8705db398e7..974c8eeeb6c2 100644 --- a/patches/node/test_formally_mark_some_tests_as_flaky.patch +++ b/patches/node/test_formally_mark_some_tests_as_flaky.patch @@ -28,7 +28,7 @@ index fd42444c7b216a4a1fa026efc1bbc1b5df8c7394..26f78764842aaaa781a9409dda2a7d32 test-net-write-fully-async-hex-string: PASS, FLAKY # https://github.com/nodejs/node/issues/52273 diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status -index 5f4445416d95fa588ccec309fd119cd40cfc8046..c0024ce74c619800ee812b1cac11297f82772356 100644 +index a3199b385dd99de57ac0fc25b1b3ecfebfcb5e61..725457846899583698ae37a8ba6088c694b09053 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -7,6 +7,18 @@ prefix sequential diff --git a/patches/node/test_make_eval_snapshot_tests_more_flexible.patch b/patches/node/test_make_eval_snapshot_tests_more_flexible.patch new file mode 100644 index 000000000000..8d930ce9360d --- /dev/null +++ b/patches/node/test_make_eval_snapshot_tests_more_flexible.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Wed, 12 Feb 2025 21:01:13 +0100 +Subject: test: make eval snapshot tests more flexible + +Upstreamed in X + +diff --git a/test/fixtures/eval/eval_messages.snapshot b/test/fixtures/eval/eval_messages.snapshot +index f6fc803e0e3ec3f6a0c7cd056f42ac860012c907..998a06584b3bf3648e6703774aeb31c07bdb5d0e 100644 +--- a/test/fixtures/eval/eval_messages.snapshot ++++ b/test/fixtures/eval/eval_messages.snapshot +@@ -35,7 +35,7 @@ Node.js * + var ______________________________________________; throw 10 + ^ + 10 +-(Use `node --trace-uncaught ...` to show where the exception was thrown) ++(Use `* --trace-uncaught ...` to show where the exception was thrown) + + Node.js * + +@@ -43,7 +43,7 @@ Node.js * + var ______________________________________________; throw 10 + ^ + 10 +-(Use `node --trace-uncaught ...` to show where the exception was thrown) ++(Use `* --trace-uncaught ...` to show where the exception was thrown) + + Node.js * + done +diff --git a/test/fixtures/eval/stdin_messages.snapshot b/test/fixtures/eval/stdin_messages.snapshot +index 66bd506f758ca93906f850a9c773b617745eb834..0382a6ae3ccd792523cc19847bbdeef4d53e1579 100644 +--- a/test/fixtures/eval/stdin_messages.snapshot ++++ b/test/fixtures/eval/stdin_messages.snapshot +@@ -40,7 +40,7 @@ Node.js * + let ______________________________________________; throw 10 + ^ + 10 +-(Use `node --trace-uncaught ...` to show where the exception was thrown) ++(Use `* --trace-uncaught ...` to show where the exception was thrown) + + Node.js * + +@@ -48,7 +48,7 @@ Node.js * + let ______________________________________________; throw 10 + ^ + 10 +-(Use `node --trace-uncaught ...` to show where the exception was thrown) ++(Use `* --trace-uncaught ...` to show where the exception was thrown) + + Node.js * + done +diff --git a/test/parallel/test-node-output-eval.mjs b/test/parallel/test-node-output-eval.mjs +index d8c52176b1c3c3a0664d7f6b6750da03aa960587..8a3cc59574206769e4c80a04f05b03586f511ac2 100644 +--- a/test/parallel/test-node-output-eval.mjs ++++ b/test/parallel/test-node-output-eval.mjs +@@ -1,6 +1,7 @@ + import '../common/index.mjs'; + import * as fixtures from '../common/fixtures.mjs'; + import * as snapshot from '../common/assertSnapshot.js'; ++import { basename } from 'node:path'; + import { describe, it } from 'node:test'; + + describe('eval output', { concurrency: true }, () => { +@@ -16,6 +17,7 @@ describe('eval output', { concurrency: true }, () => { + snapshot.replaceNodeVersion, + removeStackTraces, + filterEmptyLines, ++ generalizeProcessName, + ); + + function removeStackTraces(output) { +@@ -26,6 +28,11 @@ describe('eval output', { concurrency: true }, () => { + return output.replaceAll(/^\s*$/gm, ''); + } + ++ function generalizeProcessName(output) { ++ const baseName = basename(process.argv0 || 'node', '.exe'); ++ return output.replaceAll(`${baseName} --`, '* --'); ++ } ++ + const tests = [ + { name: 'eval/eval_messages.js' }, + { name: 'eval/stdin_messages.js' }, diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index 60870547f863..17c35b2b86dc 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -74,6 +74,7 @@ "parallel/test-snapshot-weak-reference", "parallel/test-snapshot-worker", "parallel/test-strace-openat-openssl", + "parallel/test-find-package-json", "parallel/test-tls-alpn-server-client", "parallel/test-tls-cli-min-version-1.0", "parallel/test-tls-cli-max-version-1.2", @@ -89,6 +90,7 @@ "parallel/test-tls-cnnic-whitelist", "parallel/test-tls-disable-renegotiation", "parallel/test-tls-empty-sni-context", + "parallel/test-tls-error-stack", "parallel/test-tls-finished", "parallel/test-tls-generic-stream", "parallel/test-tls-getcipher",