RafaelGSS
6cc8d58e6f
src: fix HTTP2 mem leak on premature close and ERR_PROTO
...
This commit fixes a memory leak when the socket is
suddenly closed by the peer (without GOAWAY notification)
and when invalid header (by nghttp2) is identified and the
connection is terminated by peer.
Refs: https://hackerone.com/reports/2841362
PR-URL: https://github.com/nodejs-private/node-private/pull/650
Reviewed-By: James M Snell <jasnell@gmail.com >
CVE-ID: CVE-2025-23085
2025-01-20 14:49:43 -03:00
Tobias Nießen
da2d177f91
path: fix path traversal in normalize() on Windows
...
Without this patch, on Windows, normalizing a relative path might result
in a path that Windows considers absolute. In rare cases, this might
lead to path traversal vulnerabilities in user code.
We attempt to detect those cases and return a relative path instead.
PR-URL: https://github.com/nodejs-private/node-private/pull/555
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
CVE-ID: CVE-2025-23084
2025-01-16 10:21:27 -03:00
Antoine du Hamel
3059262185
esm: fix broken assertion in legacyMainResolve
...
PR-URL: https://github.com/nodejs/node/pull/55708
Fixes: https://github.com/nodejs/node/issues/55692
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-11-07 17:51:24 +01:00
Nicolò Ribaudo
ac37e554a5
esm: mark import attributes and JSON module as stable
...
The two proposals reached stage 4 at the October 2024 meeting.
PR-URL: https://github.com/nodejs/node/pull/55333
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-11-02 18:50:27 +01:00
Filip Skokan
c50f01399e
crypto: ensure invalid SubtleCrypto JWK data import results in DataError
...
PR-URL: https://github.com/nodejs/node/pull/55041
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-11-02 18:50:26 +01:00
Filip Skokan
5c46782137
crypto: make deriveBits length parameter optional and nullable
...
PR-URL: https://github.com/nodejs/node/pull/53601
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-11-02 18:50:25 +01:00
Bruce MacNaughton
84b0ead758
esm: fix hook name in error message
...
PR-URL: https://github.com/nodejs/node/pull/50466
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-11-02 18:42:15 +01:00
Antoine du Hamel
c679348f83
errors: use determineSpecificType in more error messages
...
PR-URL: https://github.com/nodejs/node/pull/49580
Fixes: https://github.com/nodejs/node/issues/49576
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
2024-11-02 18:42:15 +01:00
Arsalan Ahmad
0092358d00
http: handle multi-value content-disposition header
...
Headers in nodejs can be arrays and current workaround for
content-disposition header do not take this into account.
This change fixes that and makes sure array values are handled
properly.
PR-URL: https://github.com/nodejs/node/pull/50977
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-07-19 03:15:33 +00:00
RafaelGSS
85abedf1ff
lib,esm: handle bypass network-import via data:
...
PR-URL: https://github.com/nodejs-private/node-private/pull/522
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/602
CVE-ID: CVE-2024-22020
2024-07-02 16:16:05 -03:00
Kumar Rishav
6689a98488
http: remove closeIdleConnections function while calling server close
...
Correcting the https://github.com/nodejs/node/pull/50194 backporting mistake.
closeIdleConnections shouldnot be called while server.close in node v18.
This behavior is for node v19 and above.
Fixes: https://github.com/nodejs/node/issues/52330
Fixes: https://github.com/nodejs/node/issues/51677
PR-URL: https://github.com/nodejs/node/pull/52336
Refs: https://github.com/nodejs/node/pull/50194
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com >
2024-04-17 12:02:53 +00:00
Matteo Collina
270b519971
stream: do not defer construction by one microtick
...
Fixes: https://github.com/nodejs/node/issues/51993
PR-URL: https://github.com/nodejs/node/pull/52005
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2024-03-23 18:42:18 +00:00
Kumar Rishav
d9ea6c1f8d
tls: fix order of setting cipher before setting cert and key
...
Set the cipher list and cipher suite before anything else
because @SECLEVEL=<n> changes the security level and
that affects subsequent operations.
Fixes: https://github.com/nodejs/node/issues/36655
Fixes: https://github.com/nodejs/node/issues/49549
Refs: https://github.com/orgs/nodejs/discussions/49634
Refs: https://github.com/orgs/nodejs/discussions/46545
Refs: https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_security_level.html
PR-URL: https://github.com/nodejs/node/pull/50186
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2024-03-19 16:12:59 +00:00
Antoine du Hamel
26e8f7793e
fs: introduce dirent.parentPath
...
The goal is to replace `dirent.path` using a name that's less likely to
create confusion.
`dirent.path` value has not been stable, moving it to a different
property name should avoid breaking some upgrading user expectations.
PR-URL: https://github.com/nodejs/node/pull/50976
Backport-PR-URL: https://github.com/nodejs/node/pull/51021
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
2024-03-18 16:55:24 +00:00
Joyee Cheung
fe66e9d06e
vm: reject in importModuleDynamically without --experimental-vm-modules
...
Users cannot access any API that can be used to return a module or
module namespace in this callback without --experimental-vm-modules
anyway, so this would eventually lead to a rejection. This patch
rejects in this case with our own error message and use a constant
host-defined option for the rejection, so that scripts with the
same source can still be compiled using the compilation cache
if no `import()` is actually called in the script.
PR-URL: https://github.com/nodejs/node/pull/50137
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-03-15 17:56:10 +00:00
Joyee Cheung
052e095c6b
vm: use internal versions of compileFunction and Script
...
Instead of using the public versions of the vm APIs internally,
use the internal versions so that we can skip unnecessary
argument validation.
The public versions would need special care to the generation
of host-defined options to hit the isolate compilation cache
when imporModuleDynamically isn't used, while internally it's
almost always used, so this allows us to handle the host-defined
options separately.
PR-URL: https://github.com/nodejs/node/pull/50137
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-03-15 17:56:06 +00:00
Joyee Cheung
9f7899ed0a
vm: unify host-defined option generation in vm.compileFunction
...
Set a default host-defined option for vm.compileFunction so that
it's consistent with vm.Script.
PR-URL: https://github.com/nodejs/node/pull/50137
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-03-15 17:56:02 +00:00
Joyee Cheung
6291c107d0
vm: use default HDO when importModuleDynamically is not set
...
This makes it possile to hit the in-isolate compilation cache when
host-defined options are not necessary.
PR-URL: https://github.com/nodejs/node/pull/49950
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2024-03-15 17:55:58 +00:00
Joyee Cheung
a86a2e14a3
module: use symbol in WeakMap to manage host defined options
...
Previously when managing the importModuleDynamically callback of
vm.compileFunction(), we use an ID number as the host defined option
and maintain a per-Environment ID -> CompiledFnEntry map to retain
the top-level referrer function returned by vm.compileFunction() in
order to pass it back to the callback, but it would leak because with
how we used v8::Persistent to maintain this reference, V8 would not
be able to understand the cycle and would just think that the
CompiledFnEntry was supposed to live forever. We made an attempt
to make that reference known to V8 by making the CompiledFnEntry weak
and using a private symbol to make CompiledFnEntry strongly
references the top-level referrer function in
https://github.com/nodejs/node/pull/46785 , but that turned out to be
unsound, because the there's no guarantee that the top-level function
must be alive while import() can still be initiated from that
function, since V8 could discard the top-level function and only keep
inner functions alive, so relying on the top-level function to keep
the CompiledFnEntry alive could result in use-after-free which caused
a revert of that fix.
With this patch we use a symbol in the host defined options instead of
a number, because with the stage-3 symbol-as-weakmap-keys proposal
we could directly use that symbol to keep the referrer alive using a
WeakMap. As a bonus this also keeps the other kinds of referrers
alive as long as import() can still be initiated from that
Script/Module, so this also fixes the long-standing crash caused by
vm.Script being GC'ed too early when its importModuleDynamically
callback still needs it.
PR-URL: https://github.com/nodejs/node/pull/48510
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/44211
Refs: https://github.com/nodejs/node/issues/42080
Refs: https://github.com/nodejs/node/issues/47096
Refs: https://github.com/nodejs/node/issues/43205
Refs: https://github.com/nodejs/node/issues/38695
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2024-03-15 17:55:29 +00:00
Jithil P Ponnan
5b5e5192f7
lib: fix compileFunction throws range error for negative numbers
...
PR-URL: https://github.com/nodejs/node/pull/49855
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Fixes: https://github.com/nodejs/node/issues/49848
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-03-15 17:55:00 +00:00
Matteo Collina
f31d47e135
zlib: pause stream if outgoing buffer is full
...
Signed-off-by: Matteo Collina <hello@matteocollina.com >
PR-URL: https://github.com/nodejs-private/node-private/pull/540
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Ref: https://hackerone.com/reports/2284065
PR-URL: https://github.com/nodejs-private/node-private/pull/542
CVE-ID: CVE-2024-22025
2024-02-12 16:19:03 +01:00
Paolo Insogna
911cb33cda
http: add maximum chunk extension size
...
PR-URL: https://github.com/nodejs-private/node-private/pull/520
Refs: https://github.com/nodejs-private/node-private/pull/518
CVE-ID: CVE-2024-22019
2024-02-12 12:02:19 +01:00
Nitzan Uziely
29697229b6
https: fix connection checking interval not clearing on server close
...
The connection interval should close when httpsServer.close is called
similarly to how it gets cleared when httpServer.close is called.
Fixes: https://github.com/nodejs/node/issues/48373
PR-URL: https://github.com/nodejs/node/pull/48383
Backport-PR-URL: https://github.com/nodejs/node/pull/50194
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2023-11-27 12:10:34 +01:00
Benjamin Gruenbaum
fae60c5841
stream: use bitmap in readable state
...
PR-URL: https://github.com/nodejs/node/pull/49745
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-27 11:57:24 +01:00
Colin Ihrig
4b2e258c76
test_runner,test: fix flaky test-runner-cli-concurrency.js
...
This test was flaky on Windows when trying to clean up the
tmp directory, probably because it relied on child processes
timing out and being killed.
This commit updates the test to check for debug output
from the test runner. This should be adequate because the
original change was effectively:
let concurrency = getOptionValue('--test-concurrency') || true;
The test runner now logs the value of the concurrency variable.
Fixes: https://github.com/nodejs/node/issues/50101
PR-URL: https://github.com/nodejs/node/pull/50108
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2023-11-27 11:57:21 +01:00
cjihrig
428301ad27
test_runner, cli: add --test-concurrency flag
...
This commit adds a new --test-concurrency CLI flag that controls
the parallelism of the test runner CLI.
PR-URL: https://github.com/nodejs/node/pull/49996
Fixes: https://github.com/nodejs/node/issues/49487
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-11-27 11:57:21 +01:00
Colin Ihrig
54168b7364
test_runner: add test location for FileTests
...
This commit adds the previously missing test location for
FileTest tests.
Fixes: https://github.com/nodejs/node/issues/49926
Fixes: https://github.com/nodejs/node/issues/49927
PR-URL: https://github.com/nodejs/node/pull/49999
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-27 11:57:21 +01:00
Colin Ihrig
1d9c37161d
test_runner: replace spurious if with else
...
There is an `if` statement that likely should have been
an `else` in the original PR.
Refs: https://github.com/nodejs/node/pull/48915
PR-URL: https://github.com/nodejs/node/pull/49943
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Raz Luvaton <rluvaton@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
2023-11-27 11:57:21 +01:00
Moshe Atlow
b283ae4238
test_runner: accept testOnly in run
...
PR-URL: https://github.com/nodejs/node/pull/49753
Fixes: https://github.com/nodejs/node/issues/49733
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Raz Luvaton <rluvaton@gmail.com >
2023-11-27 11:57:20 +01:00
Moshe Atlow
103c4a088a
test_runner: catch reporter errors
...
PR-URL: https://github.com/nodejs/node/pull/49646
Fixes: https://github.com/nodejs/node/issues/48937
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2023-11-27 11:57:20 +01:00
Moshe Atlow
059b1945d8
test_runner: add junit reporter
...
PR-URL: https://github.com/nodejs/node/pull/49614
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2023-11-27 11:57:19 +01:00
Caio Borghi
76a35632d3
test_runner: add jsdocs to mock.js
...
PR-URL: https://github.com/nodejs/node/pull/49555
Reviewed-By: Erick Wendel <erick.workspace@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-11-27 11:57:19 +01:00
Erick Wendel
ba57c24fde
test_runner: fix invalid timer call
...
Signed-off-by: Erick Wendel <erick.workspace@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/49477
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-27 11:57:19 +01:00
Erick Wendel
5949ae016f
test_runner: add jsdocs to MockTimers
...
Signed-off-by: Erick Wendel <erick.workspace@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/49476
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-11-27 11:57:19 +01:00
Moshe Atlow
429846f258
test_runner: fix typescript coverage
...
PR-URL: https://github.com/nodejs/node/pull/49406
Fixes: https://github.com/nodejs/node/issues/49398
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2023-11-27 11:57:18 +01:00
Erick Wendel
760c98280e
test_runner: preserve original property descriptor
...
PR-URL: https://github.com/nodejs/node/pull/49433
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Raz Luvaton <rluvaton@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-27 11:57:18 +01:00
Chemi Atlow
95cc98e14b
test_runner: expose spec reporter as newable function
...
Fixes: https://github.com/nodejs/node/issues/48112
Ref: https://github.com/nodejs/node/pull/48208
PR-URL: https://github.com/nodejs/node/pull/49184
Refs: https://github.com/nodejs/node/pull/48208
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-27 11:57:17 +01:00
Colin Ihrig
d83964031b
test_runner: reland run global after() hook earlier
...
This commit reverts the revert in
bb52656fc6 . It also includes the
fix for the issue that required the revert
(https://github.com/nodejs/node/pull/49059#issuecomment-1675171959 )
and an additional common.mustCall() in the added test.
Refs: https://github.com/nodejs/node/pull/49059
Refs: https://github.com/nodejs/node/pull/49110
PR-URL: https://github.com/nodejs/node/pull/49116
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-11-27 11:57:17 +01:00
cjihrig
d61a505546
test_runner: expose location of tests
...
This commit adds each test's line and column number to the reporter
output. This will aid in debugging test suite failures when error
stacks are not helpful, test suites are large, or tests have the
same name. This data is also exposed on the spec reporter.
This commit also replaces the filename that was previously being
reported, with the filename where the test actually exists. These
are normally correct, but could be wrong if tests were run from
a file other than the user's entrypoint.
PR-URL: https://github.com/nodejs/node/pull/48975
Fixes: https://github.com/nodejs/node/issues/48457
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-27 11:57:17 +01:00
Moshe Atlow
00c70e12f7
test_runner: dont set exit code on todo tests
...
PR-URL: https://github.com/nodejs/node/pull/48929
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-11-27 11:57:17 +01:00
Raz Luvaton
71f7ed728d
test_runner: fix global after not failing the tests
...
PR-URL: https://github.com/nodejs/node/pull/48913
Backport-PR-URL: https://github.com/nodejs/node/pull/49225
Fixes: https://github.com/nodejs/node/issues/48867
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-11-27 11:57:16 +01:00
LiviaMedeiros
ac27431372
url: validate pathToFileURL(path) argument as string
...
PR-URL: https://github.com/nodejs/node/pull/49161
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-11-27 11:57:14 +01:00
Tim Perry
daca87bbef
net: use asserts in JS Socket Stream to catch races in future
...
PR-URL: https://github.com/nodejs/node/pull/49400
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-27 11:57:14 +01:00
Tim Perry
03063bd022
net: fix crash due to simultaneous close/shutdown on JS Stream Sockets
...
A JS stream socket wraps a stream, exposing it as a socket for something
on top which needs a socket specifically (e.g. an HTTP server).
If the internal stream is closed in the same tick as the layer on top
attempts to close this stream, the race between doShutdown and doClose
results in an uncatchable exception. A similar race can happen with
doClose and doWrite.
It seems legitimate these can happen in parallel, so this resolves that
by explicitly detecting and handling that situation: if a close is in
progress, both doShutdown & doWrite allow doClose to run
finishShutdown/Write for them, cancelling the operation, without trying
to use this._handle (which will be null) in the meantime.
PR-URL: https://github.com/nodejs/node/pull/49400
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-27 11:57:13 +01:00
Erick Wendel
11fbd924ed
test_runner: add support for setImmediate
...
PR-URL: https://github.com/nodejs/node/pull/49397
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2023-11-27 11:57:12 +01:00
Khafra
ee4fc7d78c
stream: use Buffer.from when constructor is a Buffer
...
When using BYOB streams, it's possible for the constructor in
readableByteStreamControllerConvertPullIntoDescriptor to be a node
Buffer. If it is, use `Buffer.from` over `new ctor`.
Fixes https://github.com/nodejs/node/issues/49245
PR-URL: https://github.com/nodejs/node/pull/49250
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2023-11-26 20:32:40 +01:00
Antoine du Hamel
d4f26f4651
policy: fix path to URL conversion
...
PR-URL: https://github.com/nodejs/node/pull/49133
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-26 20:32:39 +01:00
Deokjin Kim
69b7f91a92
fs: remove redundant code in readableWebStream()
...
Remove redundant code by moving it to outside of `if/else`. Plus,
make `options` optional in doc.
PR-URL: https://github.com/nodejs/node/pull/49298
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-26 20:32:39 +01:00
Raz Luvaton and Robert Nagy
651e4504ce
stream: add highWaterMark for the map operator
...
this is done so we don't wait for the first items to
finish before starting new ones
Fixes: https://github.com/nodejs/node/issues/46132
Co-authored-by: Robert Nagy <ronagy@icloud.com >
PR-URL: https://github.com/nodejs/node/pull/49249
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2023-11-26 20:32:38 +01:00
Antoine du Hamel
879b958184
worker: protect against user mutating well-known prototypes
...
PR-URL: https://github.com/nodejs/node/pull/49270
Fixes: https://github.com/nodejs/node/issues/49259
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2023-11-26 20:32:38 +01:00