12071 Commits
Author SHA1 Message Date
RafaelGSS f7892c16be lib: makeRequireFunction patch when experimental policy
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/373
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 13:31:05 +00:00
RafaelGSSandBradley Farias 83975b7fb4 policy: makeRequireFunction on mainModule.require
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
Co-authored-by: Bradley Farias <bradley.meck@gmail.com>
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/373
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 13:31:05 +00:00
Antoine du Hamel fa115ee8ac module: protect against prototype mutation
Ensures that mutating the `Object` prototype does not influence the
parsing of `package.json` files.

Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/373
PR-URL: https://github.com/nodejs/node/pull/44007
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-02-15 13:31:05 +00:00
Richard Lau a5f8798d7a test: avoid left behind child processes
Extend the Linux logic to all POSIX platforms in
test-child-process-exec-abortcontroller-promisified.

PR-URL: https://github.com/nodejs/node/pull/46276
Fixes: https://github.com/nodejs/build/issues/3154
Refs: https://github.com/nodejs/node/issues/37518
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com>
Reviewed-By: Ruy Adorno <ruyadorno@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-01-22 14:18:30 -05:00
Richard Lau 5b2ea124f3 test: add test to validate changelogs for releases
Add a new test to check that the changelog files have been correctly
updated for releases.

PR-URL: https://github.com/nodejs/node/pull/45325
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2022-12-07 12:54:32 -05:00
Michael Dawson 2dbeb889f6 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
Backport-PR-URL: https://github.com/nodejs/node/pull/45616
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-12-07 08:49:39 -05:00
Richard Lau 9f4e64b603 deps: update timezone to 2022f
PR-URL: https://github.com/nodejs/node/pull/45521
Fixes: https://github.com/nodejs/node/issues/45276
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-11-23 16:28:13 -05:00
Darshan Sen f13f889956 test: add a test to ensure the correctness of timezone upgrades
Currently, there's no way to know if a timezone upgrade PR is correct
without building and testing the change locally. This change provides a
solution for that.

Tested in https://github.com/RaisinTen/node/pull/4.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45299
Backport-PR-URL: https://github.com/nodejs/node/pull/45521
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Fixes: https://github.com/nodejs/node/issues/45276
2022-11-23 16:26:16 -05:00
rogertyang c3a90c4b44 http2: fix memory leak when nghttp2 hd threshold is reached
Refs: https://github.com/nodejs/node/issues/45295
PR-URL: https://github.com/nodejs/node/pull/41502
Backport-PR-URL: https://github.com/nodejs/node/pull/45310
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2022-11-23 16:21:16 -05:00
Tobias Nießen 2b433af094 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:26:28 +00:00
Antoine du Hamel 9487028043 test: fix intl tests on small-icu builds
PR-URL: https://github.com/nodejs/node/pull/41939
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-11-01 00:37:17 -04:00
Daniel Bevenius 4f83d75626 src,doc,test: add --openssl-shared-config option
This commit adds a new command line option named
'--openssl-shared-config' intended to allow reverting to the old OpenSSL
configuration behavior where Node.js would use the configuration section
name (called appname in OpenSSL) 'openssl_conf' which could potentially
be used my other applications..

PR-URL: https://github.com/nodejs/node/pull/43124
Refs: https://github.com/nodejs/node/issues/40366
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Backport-PR-URL: https://github.com/nodejs/node/pull/43782

Refs: https://github.com/nodejs/nodejs.org/pull/4713
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2022-09-23 11:02:07 -04:00
Paolo Insogna a9f1146b88 http: disable chunked encoding when OBS fold is used
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: https://github.com/nodejs-private/node-private/pull/341
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/343
CVE-ID: CVE-2022-32213, CVE-2022-35256
2022-09-22 14:39:40 -04:00
RafaelGSS a1121b456c src: fix IPv4 non routable validation
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: https://github.com/nodejs-private/node-private/pull/337
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/339
CVE-ID: CVE-2022-32212, CVE-2018-7160
2022-09-19 22:11:38 -04:00
Paolo Insogna da0fda0fe8 http: stricter Transfer-Encoding and header separator parsing
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
PR-URL: #315
Backport-PR-URL: #327
CVE-ID: CVE-2022-32215,CVE-2022-32214,CVE-2022-32213
2022-07-06 22:27:55 -05:00
Tobias NießenandRafaelGSS 48c5aa5cab src: fix IPv4 validation in inspector_socket
Co-authored-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs-private/node-private/pull/320
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/325
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: RafaelGSS <rafael.nunu@hotmail.com>
CVE-ID: CVE-2022-32212
2022-07-06 12:02:18 -05:00
Daniel Bevenius 8e8aef836c src,deps,build,test: add OpenSSL config appname
This commit adds the setting of an appname (configuration section
name), 'nodejs_conf', to be used when reading OpenSSL configuration
files.

The motivation for this is that currently the default OpenSSL
configuration, 'openssl_conf', element will be used which may be
undesirable as it might configure OpenSSL in unwanted ways. With this
commit it is still possible to use a default openssl.cnf file but the
only section that Node.js will read from is a section named
'nodejs_conf'.

PR-URL: https://github.com/nodejs/node/pull/43124
Refs: https://github.com/nodejs/node/issues/40366
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>

Backport-PR-URL: https://github.com/nodejs/node/pull/43586
2022-07-06 12:02:18 -05:00
Livia Medeiros 75302d3dce fs: fix write methods param validation and docs
The FS docs wrongfully indicated support for passing object with an own
`toString` function property to `FileHandle.prototype.appendFile`,
`FileHandle.prototype.writeFile`, `FileHandle.prototype.write`,
`fsPromises.writeFile`, and `fs.writeSync`. This commit fixes that, and
adds some test to ensure the actual behavior is aligned with the docs.
It also fixes a bug that makes the process crash if a non-buffer object
was passed to `FileHandle.prototype.write`.

Refs: https://github.com/nodejs/node/pull/34993
PR-URL: https://github.com/nodejs/node/pull/41677
Refs: https://github.com/nodejs/node/issues/41666
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Backport-PR-URL: https://github.com/nodejs/node/pull/42603
2022-05-01 16:44:20 -05:00
Erick Wendel 4203d132b1 child_process: queue pending messages
It fixes the problem of the child process not receiving messages.

Fixes: https://github.com/nodejs/node/issues/41134

PR-URL: https://github.com/nodejs/node/pull/41221
Reviewed-By: Adrian Estrada <edsadr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Backport-PR-URL: https://github.com/nodejs/node/pull/42840
2022-05-01 16:44:20 -05:00
Rich Trott de474c8b6f worker: do not send message if port is closing
Fixes: https://github.com/nodejs/node/issues/42296

PR-URL: https://github.com/nodejs/node/pull/42357
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-05-01 16:44:20 -05:00
Robert Nagy d4171e0eac stream: resume stream on drain
Previously we would just resume "flowing" the stream without
reseting the "paused" state. Fixes this by properly using
pause/resume methods for .pipe.

Fixes: https://github.com/nodejs/node/issues/41785

PR-URL: https://github.com/nodejs/node/pull/41848
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-04-27 20:43:50 -05:00
simon-id 625be7585d lib: add return value for DC channel.unsubscribe
PR-URL: https://github.com/nodejs/node/pull/40433
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2022-01-25 12:49:24 -05:00
JckXia f74fe2a59c src: make napi_create_reference accept symbol
PR-URL: https://github.com/nodejs/node/pull/39926
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-01-25 12:38:26 -05:00
Omar El-Mihilmy fc328f1ab0 fs: nullish coalescing to respect zero positional reads
When the file read position is moved passing zero is
not respected and `null` is used instead. PR fixes the
issues by using nullish coalescing which will return
the rhs only when the lhs is `null` or `undefined`;
respecting the zero.

Fixes: https://github.com/nodejs/node/issues/40715

PR-URL: https://github.com/nodejs/node/pull/40716
Fixes: https://github.com/nodejs/node/issues/40699
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2022-01-25 11:05:39 -05:00
Maël Nison 737df75e17 deps: add corepack
Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: https://github.com/nodejs/node/issues/15244
Refs: https://github.com/nodejs/TSC/issues/904

PR-URL: https://github.com/nodejs/node/pull/39608
Backport-PR-URL: https://github.com/nodejs/node/pull/40479
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-01-25 10:48:47 -05:00
Gang Chen a90defebcf esm: make process.exit() default to exit code 0
Due to a bug in top-level await implementation, it used to default to
exit code 13.

PR-URL: https://github.com/nodejs/node/pull/41388
Backport-PR-URL: https://github.com/nodejs/node/pull/41508
Fixes: https://github.com/nodejs/node/issues/40808
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2022-01-25 08:01:02 -05:00
Dominic Elm b050c65885 src: add option to disable loading native addons
Backport-PR-URL: https://github.com/nodejs/node/pull/40094
PR-URL: https://github.com/nodejs/node/pull/39977
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2022-01-25 07:54:07 -05:00
Vít Ondruch 0d448eaab5 crypto: make FIPS related options always available
There is no reason to hide FIPS functionality behind build flags.
OpenSSL always provide the information about FIPS availability via
`FIPS_mode()` function.

This makes the user experience more consistent, because the OpenSSL
library is always queried and the `crypto.getFips()` always returns
OpenSSL settings.

Fixes: https://github.com/nodejs/node/issues/34903
Backport-PR-URL: https://github.com/nodejs/node/pull/40241
PR-URL: https://github.com/nodejs/node/pull/36341
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2022-01-10 22:56:54 +00:00
Guy Bedford 2c365961d0 module: support pattern trailers for imports field
PR-URL: https://github.com/nodejs/node/pull/40041
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
2022-01-10 22:56:54 +00:00
Guy Bedford 607bc74eae module: support pattern trailers
PR-URL: https://github.com/nodejs/node/pull/39635
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
2022-01-10 22:56:53 +00:00
Tobias Nießen e2a74f3c99 console: fix prototype pollution via console.table
CVE-ID: CVE-2022-21824
PR-URL: https://github.com/nodejs-private/node-private/pull/307
Refs: https://hackerone.com/reports/1431042
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-01-07 15:57:20 +00:00
Michael DawsonandAkshay K 9f2c52617f src: add cve reverts and associated tests
Co-authored-by: Akshay K <iit.akshay@gmail.com>
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/305
PR-URL: https://github.com/nodejs-private/node-private/pull/300
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-01-07 15:57:11 +00:00
Tobias NießenandAkshay K 83d8f880bb tls: fix handling of x509 subject and issuer
When subject and verifier are represented as strings, escape special
characters (such as '+') to guarantee unambiguity. Previously, different
distinguished names could result in the same string when encoded. In
particular, inserting a '+' in a single-value Relative Distinguished
Name (e.g., L or OU) would produce a string that is indistinguishable
from a multi-value Relative Distinguished Name. Third-party code that
correctly interprets the generated string representation as a
multi-value Relative Distinguished Name could then be vulnerable to an
injection attack, e.g., when an attacker includes a single-value RDN
with type OU and value 'HR + CN=example.com', the string representation
produced by unpatched versions of Node.js would be
'OU=HR + CN=example.com', which represents a multi-value RDN.

Node.js itself is not vulnerable to this attack because the current
implementation that parses such strings into objects does not handle '+'
at all. This oversight leads to incorrect results, but at the same time
appears to prevent injection attacks (as described above).

With this change, the JavaScript objects representing the subject and
issuer Relative Distinguished Names are constructed in C++ directly,
instead of (incorrectly) encoding them as strings and then (incorrectly)
decoding the strings in JavaScript.

This addresses CVE-2021-44533.

Co-authored-by: Akshay K <iit.akshay@gmail.com>
CVE-ID: CVE-2021-44533
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/305
PR-URL: https://github.com/nodejs-private/node-private/pull/300
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-01-07 15:57:00 +00:00
Tobias NießenandAkshay K 461a0c674b tls: drop support for URI alternative names
Previously, Node.js incorrectly accepted uniformResourceIdentifier (URI)
subject alternative names in checkServerIdentity regardless of the
application protocol. This was incorrect even in the most common cases.
For example, RFC 2818 specifies (and RFC 6125 confirms) that HTTP over
TLS only uses dNSName and iPAddress subject alternative names, but not
uniformResourceIdentifier subject alternative names.

Additionally, name constrained certificate authorities might not be
constrained to specific URIs, allowing them to issue certificates for
URIs that specify hosts that they would not be allowed to issue dNSName
certificates for.

Even for application protocols that make use of URI subject alternative
names (such as SIP, see RFC 5922), Node.js did not implement the
required checks correctly, for example, because checkServerIdentity
ignores the URI scheme.

As a side effect, this also fixes an edge case. When a hostname is not
an IP address and no dNSName subject alternative name exists, the
subject's Common Name should be considered even when an iPAddress
subject alternative name exists.

It remains possible for users to pass a custom checkServerIdentity
function to the TLS implementation in order to implement custom identity
verification logic.

This addresses CVE-2021-44531.

Co-authored-by: Akshay K <iit.akshay@gmail.com>
CVE-ID: CVE-2021-44531
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/305
PR-URL: https://github.com/nodejs-private/node-private/pull/300
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-01-07 15:56:53 +00:00
Tobias NießenandAkshay K df1b2c33f6 crypto,tls: implement safe x509 GeneralName format
This change introduces JSON-compatible escaping rules for strings that
include X.509 GeneralName components (see RFC 5280). This non-standard
format avoids ambiguities and prevents injection attacks that could
previously lead to X.509 certificates being accepted even though they
were not valid for the target hostname.

These changes affect the format of subject alternative names and the
format of authority information access. The checkServerIdentity function
has been modified to safely handle the new format, eliminating the
possibility of injecting subject alternative names into the verification
logic.

Because each subject alternative name is only encoded as a JSON string
literal if necessary for security purposes, this change will only be
visible in rare cases.

This addresses CVE-2021-44532.

Co-authored-by: Akshay K <iit.akshay@gmail.com>
CVE-ID: CVE-2021-44532
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/305
PR-URL: https://github.com/nodejs-private/node-private/pull/300
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-01-07 15:56:45 +00:00
Francesco Trotta 8894bdd4d8 lib: fix regular expression to detect / and \
PR-URL: https://github.com/nodejs/node/pull/40325
Backport-PR-URL: https://github.com/nodejs/node/pull/40564
Fixes: https://github.com/nodejs/node/issues/40305
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2021-11-26 06:32:44 -05:00
Santiago Gimeno 39583f77d8 worker: avoid potential deadlock on NearHeapLimit
It can happen that the `NearHeapLimit` callback is called while calling
the `oninit()` function on `MessagePort` construction causing a deadlock
when the `Worker::Exit()` method is called, as the `mutex_` was already
held on the `CreateEnvMessagePort()` method. To fix it, just use the
`mutex_` to protect the `child_port_data_` variable and avoid holding it
when creating the `MessagePort`.
Also, return early from `Worker::Run()` if the worker message port
could not be created.

Fixes: https://github.com/nodejs/node/issues/38208

PR-URL: https://github.com/nodejs/node/pull/38403
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2021-11-26 06:32:44 -05:00
Luigi Pinca 704989b698 test: deflake child-process-pipe-dataflow
Fixes: https://github.com/nodejs/node/issues/25988

PR-URL: https://github.com/nodejs/node/pull/40838
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-11-25 12:16:07 -05:00
Greg Ziskind df401cd346 test: update upload.zip to be uncorrupted
PR-URL: https://github.com/nodejs/node/pull/37294
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2021-10-12 10:30:23 -04:00
Matteo Collina 9b92ae2499 http: add regression test for smuggling content length
PR-URL: https://github.com/nodejs-private/node-private/pull/285
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
2021-10-11 16:44:20 +01:00
Matteo Collina f467539719 http: add regression test for chunked smuggling
PR-URL: https://github.com/nodejs-private/node-private/pull/285
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
2021-10-11 16:44:19 +01:00
Nitzan Uziely d2834fb97f fs: improve fsPromises writeFile performance
Increase the write chunk size in fsPromises writeFile
to improve performance.

PR-URL: https://github.com/nodejs/node/pull/37610
Backport-PR-URL: https://github.com/nodejs/node/pull/39993
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-09-07 16:23:25 +02:00
Rich Trott 007f9a0e36 test: fix test-vm-memleak for high baseline platforms
test-vm-memleak always fails on AIX in CI because the test checks that
total memory consumption is less than 64 Mb, but AIX uses over 100 Mb
just as a baseline. So instead, let's compare the memory consumption to
the baseline and make sure it is within 32 Mb.

PR-URL: https://github.com/nodejs/node/pull/38062
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-09-07 11:17:17 +02:00
Rich Trott 0fabd8e755 test: fix flaky test-vm-memleak
Force garbage collection so that the memory leak is more easily
differentiated from ordinary not-garbage-collected memory.

Refs: https://github.com/nodejs/node/pull/34289

PR-URL: https://github.com/nodejs/node/pull/38054
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-09-07 11:16:27 +02:00
Antoine du Hamel 64fb928ec7 test: fix flaky test-child-process-exec-abortcontroller-promisified
Fixes: https://github.com/nodejs/node/issues/37568

PR-URL: https://github.com/nodejs/node/pull/37572
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-09-07 11:14:45 +02:00
bcb85adee6 policy: canonicalize before resolving specifiers
PR-URL: https://github.com/nodejs/node/pull/37863
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: James M Snell <jasnell@gmail.com>

Reviewed-By: Guy Bedford <guybedford@gmail.com>
2021-09-04 15:14:55 +02:00
Bradley Farias d42bbe48c5 esm: use correct URL for error decoration
PR-URL: https://github.com/nodejs/node/pull/37854
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2021-09-04 15:14:54 +02:00
Don Jayamanne 37b4708b19 repl: fix tla function hoisting
PR-URL: https://github.com/nodejs/node/pull/39745
Fixes: https://github.com/nodejs/node/issues/39744
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2021-09-04 15:14:54 +02:00
Tobias Nießen 0ff520cf02 policy: fix integrity when DEFAULT_ENCODING is set
PR-URL: https://github.com/nodejs/node/pull/39750
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-09-04 15:14:53 +02:00
voltrexmaster e660892f1a test: use simplfied validator
The validators test should use the simplified `validateArray()`
validator.

PR-URL: https://github.com/nodejs/node/pull/39753
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-09-04 15:14:53 +02:00