8397 Commits
Author SHA1 Message Date
Richard Lau 96a4559f25 2023-02-16, Version 16.19.1 'Gallium' (LTS)
This is a security release.

Notable changes:

The following CVEs are fixed in this release:

- CVE-2023-23918: Node.js Permissions policies can be bypassed via
  process.mainModule (High)
- CVE-2023-23919: Node.js OpenSSL error handling issues in nodejs
  crypto library (Medium)
- CVE-2023-23936: Fetch API in Node.js did not protect against CRLF
  injection in host headers (Medium)
- CVE-2023-24807: Regular Expression Denial of Service in Headers in
  Node.js fetch API (Low)
- CVE-2023-23920: Node.js insecure loading of ICU data through ICU_DATA
  environment variable (Low)

Fixed by an update to undici:

- CVE-2023-23936: Fetch API in Node.js did not protect against CRLF
  injection in host headers (Medium)
  See https://github.com/nodejs/undici/security/advisories/GHSA-5r9g-qh6m-jxff
  for more information.
- CVE-2023-24807: Regular Expression Denial of Service in Headers in
  Node.js fetch API (Low)
  See https://github.com/nodejs/undici/security/advisories/GHSA-r6ch-mqf9-qc9w
  for more information.

- OpenSSL 1.1.1t

PR-URL: https://github.com/nodejs-private/node-private/pull/390
2023-02-15 18:13:54 +00:00
RafaelGSSandBradley Farias b02d895137 policy: makeRequireFunction on mainModule.require
Co-authored-by: Bradley Farias <bradley.meck@gmail.com>
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/372
Refs: https://hackerone.com/bugs?subject=nodejs&report_id=1747642
CVE-ID: CVE-2023-23918
PR-URL: https://github.com/nodejs-private/node-private/pull/358
Reviewed-by: Bradley Farias <bradley.meck@gmail.com>
Reviewed-by: Michael Dawson <midawson@redhat.com>
2023-02-15 18:08:34 +00:00
RafaelGSS b558e9f476 crypto: clear OpenSSL error on invalid ca cert
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
CVE-ID: CVE-2023-23919
PR-URL: https://github.com/nodejs-private/node-private/pull/375
Refs: https://hackerone.com/bugs?report_id=1808596
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2023-02-14 17:00:17 +00:00
Filip Skokan 160adb7ffc crypto: clear OpenSSL error queue after calling X509_check_private_key()
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/375
CVE-ID: CVE-2023-23919
Fixes: https://github.com/nodejs/node/issues/45485
PR-URL: https://github.com/nodejs/node/pull/45495
Refs: https://hackerone.com/bugs?subject=nodejs&report_id=1808596
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-02-14 16:59:57 +00:00
Takuro Sato d0ece30948 crypto: clear OpenSSL error queue after calling X509_verify()
Prior to this commit, functions accessing the OpenSSL error queue did
not work properly after x509.verify() returned false.

Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/375
CVE-ID: CVE-2023-23919
PR-URL: https://github.com/nodejs/node/pull/45377
Refs: https://hackerone.com/bugs?subject=nodejs&report_id=1808596
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2023-02-14 16:58:41 +00:00
Richard Lau 2d5d8f5244 Working on v16.19.1
PR-URL: https://github.com/nodejs/node/pull/45791
2022-12-13 07:52:36 -05:00
Richard Lau 2adea16e39 2022-12-13, Version 16.19.0 'Gallium' (LTS)
Notable changes:

- OpenSSL 1.1.1s
- Root certificates updated to NSS 3.85
- Time zone update to 2022f
- add dgram send queue info
- upgrade npm to 8.19.3
- add `--watch`
- add default value option to parsearg

PR-URL: https://github.com/nodejs/node/pull/45791
2022-12-08 16:12:12 -05:00
Joyee Cheung fbc52e5729 src: disambiguate terms used to refer to builtins and addons
The term "native module" dates back to some of the oldest code
in the code base. Within the context of Node.js core it usually
refers to modules that are native to Node.js (e.g. fs, http),
but it can cause confusion for people who don't work on this
part of the code base, as "native module" can also refer to
native addons - which is even the case in some of the API
docs and error messages.

This patch tries to make the usage of these terms more consistent.
Now within the context of Node.js core:

- JavaScript scripts that are built-in to Node.js are now referred
  to as "built-in(s)". If they are available as modules,
  they can also be referred to as "built-in module(s)".
- Dynamically-linked shared objects that are loaded into
  the Node.js processes are referred to as "addons".

We will try to avoid using the term "native modules" because it could
be ambiguous.

Changes in this patch:

File names:
- node_native_module.h -> node_builtins.h,
- node_native_module.cc -> node_builtins.cc

C++ binding names:
- `native_module` -> `builtins`

`node::Environment`:
- `native_modules_without_cache` -> `builtins_without_cache`
- `native_modules_with_cache` -> `builtins_with_cache`
- `native_modules_in_snapshot` -> `builtins_in_cache`
- `native_module_require` -> `builtin_module_require`

`node::EnvSerializeInfo`:
- `native_modules` -> `builtins

`node::native_module::NativeModuleLoader`:
- `native_module` namespace -> `builtins` namespace
- `NativeModuleLoader` -> `BuiltinLoader`
- `NativeModuleRecordMap` -> `BuiltinSourceMap`
- `NativeModuleCacheMap` -> `BuiltinCodeCacheMap`
- `ModuleIds` -> `BuiltinIds`
- `ModuleCategories` -> `BuiltinCategories`
- `LoadBuiltinModuleSource` -> `LoadBuiltinSource`

`loader.js`:
- `NativeModule` -> `BuiltinModule` (the `NativeModule` name used in
  `process.moduleLoadList` is kept for compatibility)

And other clarifications in the documentation and comments.

PR-URL: https://github.com/nodejs/node/pull/44135
Backport-PR-URL: https://github.com/nodejs/node/pull/45663
Fixes: https://github.com/nodejs/node/issues/44036
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2022-12-08 09:55:24 -05:00
Santiago Gimeno 953072d3db src: let http2 streams end after session close
After the stream has been marked as closed by the nghttp2 stack, there
might be still pending data to be sent: trailing headers is an example
of this. In that case, avoid reentering the nghttp2 stack synchronously
to allow the data to be written before actually closing the stream.

Fixes: https://github.com/nodejs/node/issues/42713
PR-URL: https://github.com/nodejs/node/pull/45153
Backport-PR-URL: https://github.com/nodejs/node/pull/45660
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2022-12-08 09:19:00 -05:00
Luigi Pinca 704836033a crypto: update root certificates
Update the list of root certificates in src/node_root_certs.h with
tools/mk-ca-bundle.pl.

Certificates added:
- Autoridad de Certificacion Firmaprofesional CIF A62634068
- Certainly Root E1
- Certainly Root R1
- D-TRUST BR Root CA 1 2020
- D-TRUST EV Root CA 1 2020
- DigiCert TLS ECC P384 Root G5
- DigiCert TLS RSA4096 Root G5
- E-Tugra Global Root CA ECC v3
- E-Tugra Global Root CA RSA v3
- HiPKI Root CA - G1
- ISRG Root X2
- Security Communication ECC RootCA1
- Security Communication RootCA3
- Telia Root CA v2
- vTrus ECC Root CA
- vTrus Root CA

Certificates removed:
- Cybertrust Global Root
- DST Root CA X3
- GlobalSign Root CA - R2
- Hellenic Academic and Research Institutions RootCA 2011

PR-URL: https://github.com/nodejs/node/pull/45490
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2022-12-07 09:54:23 -05:00
Moshe Atlow 64d343af74 test_runner: support using --inspect with --test
PR-URL: https://github.com/nodejs/node/pull/44520
Backport-PR-URL: https://github.com/nodejs/node/pull/44873
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-12-07 09:05:04 -05:00
theanarkh 33707dcd03 dgram: add dgram send queue info
PR-URL: https://github.com/nodejs/node/pull/44149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-11-24 10:26:20 -05:00
Michael Dawson 5a0efa05d2 node-api: handle no support for external buffers
Refs: https://github.com/electron/electron/issues/35801
Refs: https://github.com/nodejs/abi-stable-node/issues/441

Electron recently dropped support for external
buffers. Provide a way for addon authors to:
- hide the methods to create external buffers so they can
  avoid using them if they want the broadest compatibility.
- call the methods that create external buffers at runtime
  to check if external buffers are supported and either
  use them or not based on the return code.

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: https://github.com/nodejs/node/pull/45181
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-11-24 08:15:35 -05:00
legendecas 54608d8dc3 src: split property helpers from node::Environment
PR-URL: https://github.com/nodejs/node/pull/44056
Backport-PR-URL: https://github.com/nodejs/node/pull/44542
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
2022-11-24 07:27:20 -05:00
Moshe Atlow 1e0dcd1ee0 cli: add --watch
PR-URL: https://github.com/nodejs/node/pull/44366
Backport-PR-URL: https://github.com/nodejs/node/pull/44976
Fixes: https://github.com/nodejs/node/issues/40429
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-11-23 14:46:59 -05:00
Beth Griggs 45522314bc Working on v16.18.2
PR-URL: https://github.com/nodejs-private/node-private/pull/363
2022-11-04 16:22:50 +00:00
Beth Griggs 25307a3d35 2022-11-04, Version 16.18.1 'Gallium' (LTS)
This is a security release.

Notable changes:

The following CVEs are fixed in this release:

- CVE-2022-43548: DNS rebinding in --inspect via invalid octal IP
                  address (Medium)

PR-URL: https://github.com/nodejs-private/node-private/pull/363
2022-11-04 11:15:43 +00:00
Tobias Nießen 9ffddd7098 inspector: harden IP address validation again
Use inet_pton() to parse IP addresses, which restricts IP addresses
to a small number of well-defined formats. In particular, octal and
hexadecimal number formats are not allowed, and neither are leading
zeros. Also explicitly reject 0.0.0.0/8 and ::/128 as non-routable.

Refs: https://hackerone.com/reports/1710652
CVE-ID: CVE-2022-43548
PR-URL: https://github.com/nodejs-private/node-private/pull/354
Reviewed-by: Michael Dawson <midawson@redhat.com>
Reviewed-by: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-by: Rich Trott <rtrott@gmail.com>
2022-11-01 22:56:04 +00:00
Juan José Arboleda 7051ba4501 Working on v16.18.1
PR-URL: https://github.com/nodejs/node/pull/44886
2022-10-12 09:02:12 -05:00
Juan José Arboleda 90af1d689d 2022-10-12, Version 16.18.0 'Gallium' (LTS)
Notable changes:

assert: add `getCalls` and `reset` to callTracker (Moshe Atlow) https://github.com/nodejs/node/pull/44191
crypto: allow zero-length secret KeyObject (Filip Skokan) https://github.com/nodejs/node/pull/44201
crypto: allow zero-length IKM in HKDF and in webcrypto PBKDF2 (Filip Skokan) https://github.com/nodejs/node/pull/44201
doc: deprecate modp1, modp2, and modp5 groups (Tobias Nießen) https://github.com/nodejs/node/pull/44588
http: make idle http parser count configurable (theanarkh) https://github.com/nodejs/node/pull/43974
http: throw error on content-length mismatch (sidwebworks) https://github.com/nodejs/node/pull/44378
lib: add diagnostics channel for process and worker (theanarkh) https://github.com/nodejs/node/pull/44045
net,tls: pass a valid socket on `tlsClientError` (Daeyeon Jeong) https://github.com/nodejs/node/pull/44021
net: add local family (theanarkh) https://github.com/nodejs/node/pull/43975
report: expose report public native apis (Chengzhong Wu) https://github.com/nodejs/node/pull/44255
src: expose environment RequestInterrupt api (Chengzhong Wu) https://github.com/nodejs/node/pull/44362
stream: add `ReadableByteStream.tee()` (Daeyeon Jeong) https://github.com/nodejs/node/pull/44505
test_runner: add before/after/each hooks (Moshe Atlow) https://github.com/nodejs/node/pull/43730
util: add `maxArrayLength` option to Set and Map (Kohei Ueno) https://github.com/nodejs/node/pull/43576

PR-URL: https://github.com/nodejs/node/pull/44886
2022-10-12 01:49:15 -05:00
Filip Skokan 317cd051ce crypto: allow zero-length IKM in HKDF and in webcrypto PBKDF2
PR-URL: https://github.com/nodejs/node/pull/44201
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Backport-PR-URL: https://github.com/nodejs/node/pull/44872
2022-10-11 14:45:30 -05:00
Filip Skokan e5c9975f11 crypto: allow zero-length secret KeyObject
PR-URL: https://github.com/nodejs/node/pull/44201
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Backport-PR-URL: https://github.com/nodejs/node/pull/44872
2022-10-11 14:45:30 -05:00
Chengzhong Wu adae66cbd4 node-api: add deprecation code of uncaught exception
Deprecation should reference a valid deprecation code.

PR-URL: https://github.com/nodejs/node/pull/44624
Refs: https://github.com/nodejs/node/pull/36510
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2022-10-11 14:45:30 -05:00
David Benjamin 7e07cce24b crypto: use EVP_PKEY_CTX_set_dsa_paramgen_q_bits when available
This matches the formulation described in the documentation:
https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_CTX_set_dsa_paramgen_q_bits.html

It is also, starting OpenSSL 3.0, more type-safe because the wrapper
macros were finally converted to real functions. In OpenSSL 3.0, it is
also no longer quite a wrapper over EVP_PKEY_CTX_ctrl, so using this
name saves some extra OSSL_PARAM <-> EVP_PKEY_CTRL conversions.

Alas, it was only backported to OpenSSL 1.1.1e, so I've left a temporary
compatibility define until you all decide to drop pre-1.1.1e releases of
1.1.1.

PR-URL: https://github.com/nodejs/node/pull/44561
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2022-10-11 14:45:29 -05:00
Tobias Nießen 3e8569cfbc src: remove ParseIP() in cares_wrap.cc
This function is only used in one place where the result argument is
never nullptr, so remove special handling of that case. Also, instead
of returning magic values 0/4/6 and then later translating those into
error/AF_INET/AF_INET6, use AF_INET/AF_INET6 directly. Lastly, inline
the function, which is simpler overall.

PR-URL: https://github.com/nodejs/node/pull/44771
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-10-11 14:45:29 -05:00
Santiago Gimeno 916f2c5783 src: avoid using v8 on Isolate termination
Fix multiple instances of those uncovered while running the tests on
debug builds.

Fixes: https://github.com/nodejs/node-v8/issues/227
PR-URL: https://github.com/nodejs/node/pull/44669
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-10-11 14:45:27 -05:00
Tobias Nießen 4f056b57e9 src: remove <unistd.h> from node_os.cc
The file does not use sysconf() and its use of gethostname() has been
removed, so including <unistd.h> appears to be unnecessary.

PR-URL: https://github.com/nodejs/node/pull/44668
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-10-11 14:45:27 -05:00
Tobias Nießen 8118fc2980 tls: fix out-of-bounds read in ClientHelloParser
ClientHelloParser::ParseHeader(data, avail) potentially accesses data
beyond avail bytes because it trusts the client to transmit a valid
frame length. Sending an impossibly small frame length causes the TLS
server to read beyond the buffer provided by the caller.

Guard against this by calling End() on the ClientHelloParser when the
client transmits an impossibly small frame length.

The test is designed to reliable cause a segmentation fault on Linux and
Windows when the buffer overrun occurs, and to trigger a spatial safety
violation when compiled with an address sanitizer enabled or when
running under valgrind.

PR-URL: https://github.com/nodejs/node/pull/44580
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-10-11 14:45:25 -05:00
Tobias Nießen 24172ca6fe src: avoid copy when creating Blob
PR-URL: https://github.com/nodejs/node/pull/44616
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
2022-10-11 14:45:25 -05:00
Rafael GonzagaandAnna Henningsen eda1f4531a src: make ReqWrap weak
This commit allows throwing an exception after creating `FSReqCallback`

Co-authored-by: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/44074
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-11 14:45:24 -05:00
Joyee Cheung ea2957fe77 src: make NearHeapLimitCallback() more robust
Instead of removing the callback before generating heap snapshot
and then adding it back after the heap snapshot is generated,
just remove it once the heap snapshot limit is reached.
Otherwise if the worker callback kicks in and sets the heap
limit to higher value during the heap snapshot generation,
the current_heap_limit in the heap snapshot callback becomes
invalid, and we might return a heap limit lower than the current
one, resulting in OOM.

In addition add more logs and checks in Worker::NearHeapLimit()
to help us catch problems.

PR-URL: https://github.com/nodejs/node/pull/44581
Refs: https://github.com/nodejs/reliability/issues/372
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-10-11 14:45:24 -05:00
daomingq eaf2ffc23a src: dump isolate stats when process exits
When process exits, dump v8 isolate's internal stats for performance
evaluation and debugging.
It fixed the incorrect profiling log output when running V8's builtin
PGO profiling for node.js service type application,which exits by user
pressing CTRL+C etc. keys.

PR-URL: https://github.com/nodejs/node/pull/44534
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-10-11 14:45:24 -05:00
Chengzhong Wu 4e49d5d1b4 inspector: expose inspector.close on workers
Workers can open their own inspector agent with `inspector.open`.
They should be able to close their own inspector agent too with
`inspector.close`.

PR-URL: https://github.com/nodejs/node/pull/44489
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-10-11 14:45:24 -05:00
theanarkh 0beedb7f1c v8: add setHeapSnapshotNearHeapLimit
PR-URL: https://github.com/nodejs/node/pull/44420
Refs: https://github.com/nodejs/node/pull/33010
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2022-10-11 14:45:23 -05:00
Tony Gorez 371804752a test: add more cases for parse-encoding
PR-URL: https://github.com/nodejs/node/pull/44427
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.com>
2022-10-11 14:45:22 -05:00
Tobias Nießen 49cf3459d1 src: rename misleading arg in ClientHelloParser
Despite being named onend_arg, the pointer is passed both to the
onend_cb and to the onhello_cb. Rename it to cb_arg, which matches the
name of the class field cb_arg_.

PR-URL: https://github.com/nodejs/node/pull/44500
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-10-11 14:45:22 -05:00
Chengzhong Wu 0e2c2064bb report: get stack trace with cross origin contexts
When a new context with a different security token is entered, or
when no context is entered, `StackTrace::CurrentStackTrace` need to
be explicitly set with flag `kExposeFramesAcrossSecurityOrigins` to
avoid crashing.

PR-URL: https://github.com/nodejs/node/pull/44398
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2022-10-11 14:45:22 -05:00
legendecas 5355a46840 report: fix missing section javascriptHeap on OOMError
`Environment::GetCurrent` may not available in the context of OOM.
Removes the cyclic `Environment::GetCurrent` and `env->isolate()`
calls to ensure both `isolate` and `env` is present if available.

However, this behavior is not guaranteed. As
`Environment::GetCurrent` didn't allocate new handles in the heap,
when a Context is entered it can still get the valid env pointer.
Removes the unstable assertion of the absence of env in the test.

PR-URL: https://github.com/nodejs/node/pull/44398
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2022-10-11 14:45:22 -05:00
legendecas 2ba547aa5b src: expose environment RequestInterrupt api
Allow add-ons to interrupt JavaScript execution, and wake up loop if it
is currently idle.

PR-URL: https://github.com/nodejs/node/pull/44362
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2022-10-11 14:45:22 -05:00
Tobias Nießen 7100baee40 crypto: use actual option name in error message
oaep_label is the name of the C++ variable. Use oaepLabel instead, which
is the name of the documented option.

PR-URL: https://github.com/nodejs/node/pull/44455
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-10-11 14:45:22 -05:00
theanarkh 8f3e8bb1fd os: add machine method
PR-URL: https://github.com/nodejs/node/pull/44416
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-11 14:45:22 -05:00
Tobias Nießen c736927b0b inspector: prevent integer overflow in open()
PR-URL: https://github.com/nodejs/node/pull/44367
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
2022-10-11 14:45:21 -05:00
Chengzhong Wu 381e11e18e report: expose report public native apis
Allows APM vendors to generate a diagnostic report without calling into
JavaScript. Like, from their own message channels interrupting the
isolate and generating a report on demand.

PR-URL: https://github.com/nodejs/node/pull/44255
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2022-10-11 14:45:21 -05:00
Tobias Nießen b53ea08d7b tls: remove SecureContext setFreeListLength
This function was introduced in 2684c902c4
as an internal helper function. The C++ implementation became a no-op in
a57e2f2138 when building against OpenSSL
1.1.0 (instead of OpenSSL 1.0.2), and eventually became a no-op in all
supported OpenSSL versions in 970ce14f61.
Finally, eb20447407 removed the only call
site of setFreeListLength (which was already a no-op at that point).

Refs: https://github.com/nodejs/node/pull/1529
Refs: https://github.com/nodejs/node/pull/10859
Refs: https://github.com/nodejs/node/pull/19794
Refs: https://github.com/nodejs/node/pull/38116
PR-URL: https://github.com/nodejs/node/pull/44300
Reviewed-By: Feng Yu <F3n67u@outlook.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-10-11 14:45:21 -05:00
legendecas 30cfe0a156 report: print javascript stack on fatal error
Try to print JavaScript stack on fatal error. OOMError needs to be
distinguished from fatal error since no new handle can be created at
that time.

PR-URL: https://github.com/nodejs/node/pull/44242
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2022-10-11 14:45:21 -05:00
Shelley VohrandJoyee Cheung 70662f4058 src: fix cppgc incompatibility in v8
This patch updates the layout of the BaseObjects to make sure
that the first embedder field of them is a "type" pointer, the
first 16 bits of which are the Node.js embedder ID, so that
cppgc will always skip over them. In addition we now use this
field to determine if the native object should be interpreted
as a Node.js embedder object in the serialization and deserialization
callbacks for the startup snapshot to improve the reliability.

Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/43521
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-10-11 14:45:21 -05:00
legendecas 91ef427d2d src: nest namespace report in namespace node
PR-URL: https://github.com/nodejs/node/pull/44069
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-10-11 14:45:21 -05:00
Darshan Sen e7d30b4b49 src: use a typed array internally for process._exiting
This would prevent manual writes to the _exiting JS property on the
process object by passing the data directly via a typed array for
performance.

This change partially addresses this TODO:
https://github.com/nodejs/node/blob/3d575a4f1bd197c3ce669758a2a3c763462a883a/src/api/hooks.cc#L68-L71

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43883
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-10-11 14:45:20 -05:00
Tobias Nießen 579e066c3a crypto: add digest name to INVALID_DIGEST errors
We already do this in some places. This adds the digest name to
remaining uses of ERR_CRYPTO_INVALID_DIGEST except for one occurrence in
crypto_sig.cc that would require significant refactoring due to the
unusual error handling there.

PR-URL: https://github.com/nodejs/node/pull/44468
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-10-11 14:45:20 -05:00
Tobias Nießen d76e7e4e84 src: improve error handling in CloneSSLCerts
If sk_X509_new() returns NULL or if sk_X509_push() fails, return instead
of silently ignoring the error.

PR-URL: https://github.com/nodejs/node/pull/44410
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2022-10-11 14:45:20 -05:00