Rich Trott
996b85b5c2
test,doc,lib: adjust object literal newlines for lint rule
...
Before enabling object-curly-newline for our ESLint rules, adjust files
to comply with it.
Refs: https://eslint.org/docs/rules/object-curly-newline
PR-URL: https://github.com/nodejs/node/pull/37040
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-26 16:49:18 -08:00
James M Snell
bb13469acb
crypto: add generatePrime/checkPrime
...
APIs for generating and checking pseudo-random primes
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36997
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-01-26 07:37:18 -08:00
Nitzan Uziely
21c8c7e511
dgram: support AbortSignal in createSocket
...
PR-URL: https://github.com/nodejs/node/pull/37026
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-25 20:36:00 +02:00
Mattias Runge-Broberg
d7640a37b2
readline: add history event and option to set initial history
...
Add a history event which is emitted when the history has
been changed. This enables persisting of the history in
some way but also to allows a listener to alter the
history. One use-case could be to prevent passwords from
ending up in the history.
A constructor option is also added to allow for setting
an initial history list when creating a Readline interface.
PR-URL: https://github.com/nodejs/node/pull/33662
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-25 06:47:05 -08:00
Antoine du Hamel
a87190b00c
fs: use throwIfNoEntry option on statSync calls
...
PR-URL: https://github.com/nodejs/node/pull/36975
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-24 08:59:44 -08:00
raisinten
85e6089c4d
lib: refactor to use optional chaining in internal/options.js
...
PR-URL: https://github.com/nodejs/node/pull/36939
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-24 08:19:32 -08:00
ZiJian Liu
dbdc14b0e8
crypto: throw error on invalid object in diffieHellman()
...
PR-URL: https://github.com/nodejs/node/pull/37016
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-23 04:23:25 -08:00
ZiJian Liu
0e7e91f397
quic: remove duplicate checks
...
PR-URL: https://github.com/nodejs/node/pull/37017
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-23 04:19:01 -08:00
Mattias Runge-Broberg
19981ed76e
readline: add support for the AbortController to the question method
...
In some cases a question asked needs to be canceled. For instance
it might be desirable to cancel a question when a user presses
ctrl+c and triggers the SIGINT event.
Also an initial empty string was set for this.line since the
cursor methods fail if line is not initialized.
Added custom promisify support to the question method.
PR-URL: https://github.com/nodejs/node/pull/33676
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-23 13:57:59 +02:00
Carlos Fuentes
2242cbb253
child_process: allow promisified exec to be cancel
...
Using new AbortController, add support for promisified
exec to be cancelled.
PR-URL: https://github.com/nodejs/node/pull/34249
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-22 20:03:09 -08:00
ZiJian Liu
08dd4b1723
lib: refactor to use validateString
...
PR-URL: https://github.com/nodejs/node/pull/37006
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-22 19:56:34 -08:00
ZiJian Liu
e884fd7d34
lib: refactor to use validateNumber
...
PR-URL: https://github.com/nodejs/node/pull/36993
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-22 19:54:34 -08:00
Darshan Sen
ae5e95f9c5
fs: refactor to remove redundant validation
...
The function makeCallback already calls validateCallback, so the call
inside copyFile can be removed.
PR-URL: https://github.com/nodejs/node/pull/36984
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-22 19:51:57 -08:00
ZiJian Liu
cb5668be99
lib: refactor to use validateBoolean
...
PR-URL: https://github.com/nodejs/node/pull/36983
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-22 19:39:47 -08:00
James M Snell
96f3977ded
process: runtime deprecate changing process.config
...
The fact that `process.config` is mutable has long made it
unreliable when it really should just work. Start the process
of deprecating the ability to change it.
Fixes: https://github.com/nodejs/node/issues/7803
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36902
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-01-22 11:34:12 -08:00
ZiJian Liu
e279304954
lib: refactor to use validateArray
...
PR-URL: https://github.com/nodejs/node/pull/36982
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-20 22:41:00 +01:00
ExE Boss
e9944e9a38
util: prefer Reflect.ownKeys(…)
...
PR-URL: https://github.com/nodejs/node/pull/36740
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-20 01:25:17 +01:00
Juan José Arboleda
acbd3a4740
lib: remove non used getter in lib/perf_hooks.js
...
PR-URL: https://github.com/nodejs/node/pull/36907
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-19 12:11:11 +01:00
Ian Storm Taylor
fc3f1c3c71
http: attach request as res.req
...
This change makes it possible for userland http-related modules
to pave over edge cases that require referencing the original request
when handling a response--making a "Lodash for HTTP" library possible.
More information and research in https://github.com/nodejs/node/issues/28673
Fixes: https://github.com/nodejs/node/issues/28673
PR-URL: https://github.com/nodejs/node/pull/36505
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2021-01-19 00:33:04 +01:00
Robert Nagy
708728ddcc
http: abortIncoming only on socket close
...
Don't call abortIncombin twice for same socket, i.e. both during
'end' and 'close'.
PR-URL: https://github.com/nodejs/node/pull/36821
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-18 14:01:16 -08:00
James M Snell
d4bea09a0a
buffer: introduce Blob
...
The `Blob` object is an immutable data buffer. This is a first step
towards alignment with the `Blob` Web API.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36811
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-18 13:55:25 -08:00
ZiJian Liu
59af4e6acd
perf_hooks: throw ERR_INVALID_ARG_VALUE if histogram.percentile param is NaN
...
Fixes: https://github.com/nodejs/node/issues/36936
PR-URL: https://github.com/nodejs/node/pull/36937
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-01-18 13:32:27 -08:00
raisinten
9a18bf2f8c
repl: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36663
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-18 13:29:43 -08:00
Antoine du Hamel
88153dc175
module: simplify tryStatSync with throwIfNoEntry option
...
PR-URL: https://github.com/nodejs/node/pull/36971
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-18 11:04:14 -08:00
ZiJian Liu
06c46934c1
events: remove error listener on signal abort
...
Fixes: https://github.com/nodejs/node/issues/36949
PR-URL: https://github.com/nodejs/node/pull/36969
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-18 10:53:03 -08:00
James M Snell
bd899bc656
crypto: experimental (Ed/X)25519/(Ed/X)448 support
...
Implements initial experimental support for Curve25519 and
Curve448 support for both ECDH and sign/verify in Web Crypto.
Introduced as a Node.js-specific extension to Web Crypto.
Signed-off-by: James M Snell <jasnell@gmail.com >
Fixes: https://github.com/nodejs/node/issues/36076
PR-URL: https://github.com/nodejs/node/pull/36879
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2021-01-18 08:12:08 -08:00
Filip Skokan
f8ab632d56
buffer: add base64url encoding option
...
PR-URL: https://github.com/nodejs/node/pull/36952
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-01-18 12:08:20 +01:00
ZiJian Liu
95660832d1
url: align url format behavior with browsers
...
Fixes: https://github.com/nodejs/node/issues/36887
PR-URL: https://github.com/nodejs/node/pull/36903
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2021-01-18 11:50:04 +01:00
Antoine du Hamel
983e9222ca
lib: expose primordials object
...
Expose the internal `primordials` object to help with Node.js core
development.
```console
$ node --expose-internals -r internal/test/binding lib/fs.js
(node:5299) internal/test/binding: These APIs are for internal testing
only. Do not use them.
(Use `node --trace-warnings ...` to show where the warning was created)
```
PR-URL: https://github.com/nodejs/node/pull/36872
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-18 11:43:32 +01:00
ExE Boss
78ca54ce15
lib: refactor primordials.makeSafe to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36865
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-18 11:37:56 +01:00
zhangyongsheng
7efada695f
url: expose urlToHttpOptions utility
...
PR-URL: https://github.com/nodejs/node/pull/35960
Fixes: https://github.com/nodejs/node/issues/34349
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-01-17 17:06:22 +08:00
Robert Nagy
e39a3f86bf
http: refactor ClientRequest destroy
...
PR-URL: https://github.com/nodejs/node/pull/36863
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-16 17:07:35 +01:00
Robert Nagy
963dec304d
http: cleanup ClientRequest oncreate
...
PR-URL: https://github.com/nodejs/node/pull/36862
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Daniele Belardi <dwon.dnl@gmail.com >
2021-01-16 16:32:13 +01:00
Antoine du Hamel
0fd9bbbb24
http2: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36700
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-15 19:23:32 +01:00
Mateusz Krawczuk
8cf5281da2
tls: use recently added matching SecureContext in default SNICallback
...
PR-URL: https://github.com/nodejs/node/pull/36072
Fixes: https://github.com/nodejs/node/issues/34110
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-01-15 04:48:41 -08:00
Tobias Nießen and Andrey Pechkurov
4db9854d6e
crypto: fix randomInt bias
...
Co-authored-by: Andrey Pechkurov <apechkurov@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36894
Refs: https://github.com/nodejs/node/pull/34600
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-14 22:21:55 +01:00
Filip Skokan
1772ae7029
crypto: add keyObject.asymmetricKeyDetails for asymmetric keys
...
This API exposes key details. It is conceptually different from the
previously discussed keyObject.fields property since it does not give
access to information that could compromise the security of the key, and
the obtained information cannot be used to uniquely identify a key.
The intended purpose is to determine "security properties" of keys, e.g.
to generate a new key pair with the same parameters, or to decide
whether a key is secure enough.
closes #30045
PR-URL: https://github.com/nodejs/node/pull/36188
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-14 14:24:48 +01:00
Antoine du Hamel
e2b954b149
lib: refactor source_map to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36733
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-13 20:59:39 +01:00
Antoine du Hamel
251a0ffd80
zlib: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36722
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-01-13 15:52:07 +01:00
Antoine du Hamel
3a44f37ef6
lib: refactor source_map to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36734
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-01-13 15:50:53 +01:00
Antoine du Hamel
e70e793404
vm: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36752
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-13 15:49:28 +01:00
Antoine du Hamel
7c37e046eb
worker: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36735
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-13 15:43:00 +01:00
raisinten
72b678a0b3
fs: allow position parameter to be a BigInt in read and readSync
...
Fixes: https://github.com/nodejs/node/issues/36185
PR-URL: https://github.com/nodejs/node/pull/36190
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-13 15:19:50 +01:00
ExE Boss
1a0c5d57aa
lib: simplify primordials.uncurryThis
...
PR-URL: https://github.com/nodejs/node/pull/36866
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-01-12 14:47:37 +01:00
Guy Bedford
2e909c4fcc
module: fix Windows folder exports deprecation warning
...
PR-URL: https://github.com/nodejs/node/pull/36859
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2021-01-12 14:45:51 +01:00
Robert Nagy
1b669b2c12
http: don't cork noop .end()
...
Calling .end() a second time should be a noop and not
leave the socket corked.
Fixes: https://github.com/nodejs/node/issues/36620
PR-URL: https://github.com/nodejs/node/pull/36633
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com >
2021-01-12 11:00:02 +01:00
Robert Nagy
52546c091d
stream: finished waits for 'close' on OutgoingMessage
...
Don't invoke finished callback until OutgoingMessagehas
emitted 'close'.
PR-URL: https://github.com/nodejs/node/pull/36648
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-11 11:39:33 -08:00
James M Snell
03c056401f
crypto: implement basic secure heap support
...
Adds two new command line arguments:
* `--secure-heap=n`, which causes node.js to initialize
an openssl secure heap of `n` bytes on openssl initialization.
* `--secure-heap-min=n`, which specifies the minimum allocation
from the secure heap.
* A new method `crypto.secureHeapUsed()` that returns details
about the total and used secure heap allocation.
The secure heap is an openssl feature that allows certain kinds
of potentially sensitive information (such as private key
BigNums) to be allocated from a dedicated memory area that is
protected against pointer over- and underruns.
The secure heap is a fixed size, so it's important that users
pick a large enough size to cover the crypto operations they
intend to utilize.
The secure heap is disabled by default.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36779
Refs: https://github.com/nodejs/node/pull/36729
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-01-11 10:39:00 -08:00
James M Snell
b4378aa38a
crypto: fixup bug in keygen error handling
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36779
Refs: https://github.com/nodejs/node/pull/36729
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-01-11 10:38:58 -08:00
Robert Nagy
a4fce32eab
stream: fix .end() error propagation
...
PR-URL: https://github.com/nodejs/node/pull/36817
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-01-11 17:57:05 +01:00