RafaelGSS
8187a4b9bb
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
2025-01-20 14:52:19 -03:00
Tobias Nießen
42d5821873
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 15:08:21 -03:00
Antoine du Hamel
0b3fb344f7
tools: add polyfilled option to prefer-primordials rule
...
PR-URL: https://github.com/nodejs/node/pull/55318
Backport-PR-URL: https://github.com/nodejs/node/pull/55264
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2024-11-18 10:15:35 +01:00
Antoine du Hamel
00a2fc7166
lib: move Symbol[Async]Dispose polyfills to internal/util
...
PR-URL: https://github.com/nodejs/node/pull/54853
Backport-PR-URL: https://github.com/nodejs/node/pull/55264
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-18 10:15:32 +01:00
Edigleysson Silva (Edy)
426851705c
test_runner: assert entry is a valid object
...
PR-URL: https://github.com/nodejs/node/pull/55231
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-11-17 11:51:46 +01:00
devstone
226836c5ac
worker: throw InvalidStateError in postMessage after close
...
This update addresses expected failures for invalid postMessage
after close in WPT.
PR-URL: https://github.com/nodejs/node/pull/55206
Reviewed-By: Mattias Buelens <mattias@buelens.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
2024-11-17 11:51:43 +01:00
Théo LUDWIG
efdccc88a2
watch: preserve output when gracefully restarted
...
PR-URL: https://github.com/nodejs/node/pull/54323
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-11-17 11:51:42 +01:00
Giovanni
085c3441fe
assert: show the diff when deep comparing data with a custom message
...
Fixes: https://github.com/nodejs/node/issues/48465
PR-URL: https://github.com/nodejs/node/pull/54759
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-17 11:51:41 +01:00
Aviv Keller
3ba2e7bf97
Revert "console: colorize console error and warn"
...
This reverts commit a833c9e0be .
PR-URL: https://github.com/nodejs/node/pull/54677
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2024-11-17 11:51:41 +01:00
Jason Zhang
f10d9ad283
stream: treat null asyncIterator as undefined
...
According to the spec, getIterator should normalize incoming method to
undefined if it is either undefined or null. This PR enforces that spec
compliance with passed WPT.
PR-URL: https://github.com/nodejs/node/pull/55119
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
2024-11-17 11:51:40 +01:00
Aviv Keller
85b3edc83b
repl: catch \v and \r in new-line detection
...
PR-URL: https://github.com/nodejs/node/pull/54512
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-11-17 11:51:37 +01:00
Aviv Keller
397be8a10e
tty: fix links for terminal colors
...
PR-URL: https://github.com/nodejs/node/pull/54596
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-11-17 11:51:37 +01:00
Luke Taher
ac1cb8dfdb
perf_hooks: add missing type argument to getEntriesByName
...
Fixes: https://github.com/nodejs/node/issues/54766
PR-URL: https://github.com/nodejs/node/pull/54767
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-11-17 11:51:37 +01:00
Aviv Keller
27ff2da964
doc: add note about --expose-internals
...
PR-URL: https://github.com/nodejs/node/pull/52861
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-11-17 11:51:36 +01:00
Yagiz Nizipli
8e6b606ac4
lib: remove lib/internal/idna.js
...
PR-URL: https://github.com/nodejs/node/pull/55050
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2024-11-17 11:51:36 +01:00
Filip Skokan
2f678ea53b
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-17 11:51:36 +01:00
Aviv Keller
6e5d524b0f
module: remove duplicated import
...
PR-URL: https://github.com/nodejs/node/pull/54942
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2024-11-17 11:51:35 +01:00
RedYetiDev
b1cad519d7
test_runner: use test: symbol on second print of parent test
...
PR-URL: https://github.com/nodejs/node/pull/54956
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-17 11:51:34 +01:00
Aviv Keller
a3c2ef9e98
util: update ansi regex
...
PR-URL: https://github.com/nodejs/node/pull/54865
Refs: https://github.com/chalk/ansi-regex/pull/58
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-17 11:51:34 +01:00
Yagiz Nizipli
30383ffb9a
zlib: throw brotli initialization error from c++
...
PR-URL: https://github.com/nodejs/node/pull/54698
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-17 11:51:34 +01:00
Khafra
0c1666a52a
events: allow null/undefined eventInitDict
...
PR-URL: https://github.com/nodejs/node/pull/54643
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-17 11:51:33 +01:00
Pietro Marchini
63c8f3d436
test_runner: replace ansi clear with ansi reset
...
PR-URL: https://github.com/nodejs/node/pull/55013
Fixes: https://github.com/nodejs/node/issues/55009
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-11-17 11:51:32 +01:00
Antoine du Hamel
f39ff4d14b
worker: handle --input-type more consistently
...
PR-URL: https://github.com/nodejs/node/pull/54979
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-11-17 11:51:31 +01:00
Khafra
453df77f99
events: return currentTarget when dispatching
...
PR-URL: https://github.com/nodejs/node/pull/54642
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-17 11:51:30 +01:00
Wiyeong Seo
3a682cca03
path: remove repetitive conditional operator in posix.resolve
...
PR-URL: https://github.com/nodejs/node/pull/54835
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-17 11:51:30 +01:00
Jordan Harband
c96e5cb664
lib: the REPL should survive deletion of Array.prototype methods
...
Specifically, `delete Array.prototype.lastIndexOf` immediately crashes
the REPL, as does deletion of a few other Array prototype methods.
PR-URL: https://github.com/nodejs/node/pull/31457
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2024-11-17 11:51:28 +01:00
Jason Zhang and Michaël Zasso
6b3c24dbad
buffer: fix out of range for toString
...
Co-authored-by: Michaël Zasso <targos@protonmail.com >
PR-URL: https://github.com/nodejs/node/pull/54553
Backport-PR-URL: https://github.com/nodejs/node/pull/55213
Fixes: https://github.com/nodejs/node/issues/52298
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Refs: https://github.com/nodejs/node/pull/54553
2024-11-16 11:48:53 +01:00
Chengzhong Wu and Mike Ralphson
9e1c2293bf
vm: harden module type checks
...
Check if the value returned from user linker function is a null-ish
value.
`validateInternalField` should be preferred when checking `this`
argument to guard against null-ish `this`.
Co-authored-by: Mike Ralphson <mike.ralphson@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/52162
Backport-PR-URL: https://github.com/nodejs/node/pull/53109
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
2024-10-02 16:04:22 +02:00
Aviv Keller
b048eaea5c
test_runner: reimplement assert.ok to allow stack parsing
...
PR-URL: https://github.com/nodejs/node/pull/54776
Refs: https://github.com/nodejs/help/issues/4461
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2024-10-02 16:04:21 +02:00
Shima Ryuhei
a9837267cb
repl: avoid interpreting 'npm' as a command when errors are recoverable
...
This change ensures that 'npm' within JavaScript code is not mistakenly
interpreted as an npm command when the error is recoverable.
This allows 'npm' to be treated as expected in such scenarios.
Fixes: https://github.com/nodejs/node/issues/54830
PR-URL: https://github.com/nodejs/node/pull/54848
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com >
2024-10-02 16:04:21 +02:00
jakecastelli and Jason Zhang
fc37b801c8
lib: remove unnecessary async
...
Co-authored-by: Jason Zhang <xzha4350@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54829
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
2024-10-02 16:04:20 +02:00
jazelly and Arrigo Zanette
596940cfa0
http: reduce likelihood of race conditions on keep-alive timeout
...
Fixes: https://github.com/nodejs/node/issues/52649
Refs: https://github.com/nodejs/node/issues/54293
Co-authored-by: Arrigo Zanette <zanettea@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54863
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-10-02 16:04:18 +02:00
jazelly
d86f24787b
lib: make WeakRef safe in abort_controller
...
PR-URL: https://github.com/nodejs/node/pull/54791
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2024-10-02 16:04:17 +02:00
Colin Ihrig
c981e61155
test_runner: improve code coverage cleanup
...
The test runner's code coverage leaves old coverage data in the
temp directory. This commit updates the cleanup logic to:
- Stop code collection. Otherwise V8 would write collection data
again when the process exits.
- Remove the temp directory containing the coverage data.
- Attempt to clean up the coverage data even if parsing the
data resulted in an error.
With this change, I no longer see any coverage data left behind
in the system temp directory.
Refs: https://github.com/nodejs/build/issues/3864
Refs: https://github.com/nodejs/build/issues/3887
PR-URL: https://github.com/nodejs/node/pull/54856
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-10-02 16:04:15 +02:00
Aviv Keller
309cb1cbd2
path: remove StringPrototypeCharCodeAt from posix.extname
...
PR-URL: https://github.com/nodejs/node/pull/54546
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-10-02 16:04:14 +02:00
Gürgün Dayıoğlu
5358601e31
timers: avoid generating holey internal arrays
...
PR-URL: https://github.com/nodejs/node/pull/54771
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-10-02 16:04:14 +02:00
Yagiz Nizipli
f0c55e206d
fs: refactor rimraf to avoid using primordials
...
PR-URL: https://github.com/nodejs/node/pull/54834
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-10-02 16:04:14 +02:00
Antoine du Hamel
0dd4639391
esm: fix support for URL instances in import.meta.resolve
...
PR-URL: https://github.com/nodejs/node/pull/54690
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-10-02 16:04:14 +02:00
Anna Henningsen
bc020f7cb3
tls: add allowPartialTrustChain flag
...
This commit exposes the `X509_V_FLAG_PARTIAL_CHAIN` OpenSSL flag to
users. This is behavior that has been requested repeatedly in the
Github issues, and allows aligning behavior with other TLS libraries
and commonly used applications (e.g. `curl`).
As a drive-by, simplify the `SecureContext` source by deduplicating
call sites at which a new custom certificate store was created for the
`secureContext` in question.
Fixes: https://github.com/nodejs/node/issues/36453
PR-URL: https://github.com/nodejs/node/pull/54790
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-10-02 16:04:13 +02:00
Rafael Gonzaga
77c59224e5
lib: add note about removing node:sys module
...
PR-URL: https://github.com/nodejs/node/pull/54743
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-10-02 07:57:52 +02:00
Wuli
b5bf08f31e
typings: correct param type of SafePromisePrototypeFinally
...
PR-URL: https://github.com/nodejs/node/pull/54727
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-10-02 07:57:48 +02:00
Paolo Insogna
b6ed97c66d
timers: document ref option for scheduler.wait
...
PR-URL: https://github.com/nodejs/node/pull/54605
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-10-02 07:57:48 +02:00
Jason Zhang and Jake Yuesong Li
b8c06dce02
lib: ensure no holey array in fixed_queue
...
Co-authored-by: Jake Yuesong Li <jake.yuesong@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54537
Fixes: https://github.com/nodejs/node/issues/54472
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-10-02 07:57:48 +02:00
mscdex
41f5eacc1a
https: only use default ALPNProtocols when appropriate
...
PR-URL: https://github.com/nodejs/node/pull/54411
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-10-02 07:57:48 +02:00
Antoine du Hamel
f287cd77bd
crypto: remove unused kHashTypes internal
...
PR-URL: https://github.com/nodejs/node/pull/54627
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-10-02 07:57:47 +02:00
Filip Skokan
b85c8ce1fc
lib: refactor SubtleCrypto experimental warnings
...
PR-URL: https://github.com/nodejs/node/pull/54620
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-10-02 07:57:47 +02:00
Rafael Gonzaga
3aaae68ec8
src,lib: add performance.uvMetricsInfo
...
This commit exposes a new API to the perf_hooks.performance
module. This wraps uv_metrics_info into
performance.uvMetricsInfo() function.
PR-URL: https://github.com/nodejs/node/pull/54413
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-10-02 07:57:45 +02:00
Joyee Cheung
2d90340cb3
vm: introduce vanilla contexts via vm.constants.DONT_CONTEXTIFY
...
This implements a flavor of vm.createContext() and friends
that creates a context without contextifying its global object.
This is suitable when users want to freeze the context (impossible
when the global is contextified i.e. has interceptors installed)
or speed up the global access if they don't need the interceptor
behavior.
```js
const vm = require('node:vm');
const context = vm.createContext(vm.constants.DONT_CONTEXTIFY);
// In contexts with contextified global objects, this is false.
// In vanilla contexts this is true.
console.log(vm.runInContext('globalThis', context) === context);
// In contexts with contextified global objects, this would throw,
// but in vanilla contexts freezing the global object works.
vm.runInContext('Object.freeze(globalThis);', context);
// In contexts with contextified global objects, freezing throws
// and won't be effective. In vanilla contexts, freezing works
// and prevents scripts from accidentally leaking globals.
try {
vm.runInContext('globalThis.foo = 1; foo;', context);
} catch(e) {
console.log(e); // Uncaught ReferenceError: foo is not defined
}
console.log(context.Array); // [Function: Array]
```
PR-URL: https://github.com/nodejs/node/pull/54394
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-10-02 07:57:44 +02:00
Rafael Gonzaga
e84812c1b5
lib: respect terminal capabilities on styleText
...
This PR changes styleText API to respect terminal
capabilities and environment variables such as
NO_COLOR, NODE_DISABLE_COLORS, and FORCE_COLOR.
PR-URL: https://github.com/nodejs/node/pull/54389
Fixes: https://github.com/nodejs/node/issues/54365
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Claudio Wunder <cwunder@gnome.org >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2024-10-02 07:57:43 +02:00
Yagiz Nizipli
ecdf6dd444
zlib: simplify validators
...
PR-URL: https://github.com/nodejs/node/pull/54442
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-10-02 07:57:42 +02:00