Skip to content

Commit 7598eb7

Browse files
authored
Merge branch 'nodejs:main' into main
2 parents ff421fa + 63eca7f commit 7598eb7

File tree

1,108 files changed

+13086
-10551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,108 files changed

+13086
-10551
lines changed

AUTHORS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,5 +3601,9 @@ Mordy Tikotzky <[email protected]>
36013601
vitpavlenko <[email protected]>
36023602
36033603
Suyash Nayan <[email protected]>
3604+
3605+
3606+
Miguel Teixeira <[email protected]>
3607+
José Dapena Paz <[email protected]>
36043608

36053609
# Generated by tools/update-authors.mjs

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ release.
3535
</tr>
3636
<tr>
3737
<td valign="top">
38-
<b><a href="doc/changelogs/CHANGELOG_V19.md#19.5.0">19.5.0</a></b><br/>
38+
<b><a href="doc/changelogs/CHANGELOG_V19.md#19.6.0">19.6.0</a></b><br/>
39+
<a href="doc/changelogs/CHANGELOG_V19.md#19.5.0">19.5.0</a><br/>
3940
<a href="doc/changelogs/CHANGELOG_V19.md#19.4.0">19.4.0</a><br/>
4041
<a href="doc/changelogs/CHANGELOG_V19.md#19.3.0">19.3.0</a><br/>
4142
<a href="doc/changelogs/CHANGELOG_V19.md#19.2.0">19.2.0</a><br/>
@@ -44,7 +45,8 @@ release.
4445
<a href="doc/changelogs/CHANGELOG_V19.md#19.0.0">19.0.0</a><br/>
4546
</td>
4647
<td valign="top">
47-
<b><a href="doc/changelogs/CHANGELOG_V18.md#18.13.0">18.13.0</a></b><br/>
48+
<b><a href="doc/changelogs/CHANGELOG_V18.md#18.14.0">18.14.0</a></b><br/>
49+
<a href="doc/changelogs/CHANGELOG_V18.md#18.13.0">18.13.0</a><br/>
4850
<a href="doc/changelogs/CHANGELOG_V18.md#18.12.1">18.12.1</a><br/>
4951
<a href="doc/changelogs/CHANGELOG_V18.md#18.12.0">18.12.0</a><br/>
5052
<a href="doc/changelogs/CHANGELOG_V18.md#18.11.0">18.11.0</a><br/>

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ For information about the governance of the Node.js project, see
316316
**Daniel Bevenius** <<[email protected]>> (he/him)
317317
* [danielleadams](https://github.com/danielleadams) -
318318
**Danielle Adams** <<[email protected]>> (she/her)
319+
* [deokjinkim](https://github.com/deokjinkim) -
320+
**Deokjin Kim** <<[email protected]>> (he/him)
319321
* [devnexen](https://github.com/devnexen) -
320322
**David Carlier** <<[email protected]>>
321323
* [devsnek](https://github.com/devsnek) -
@@ -346,8 +348,6 @@ For information about the governance of the Node.js project, see
346348
**Zeyu "Alex" Yang** <<[email protected]>> (he/him)
347349
* [iansu](https://github.com/iansu) -
348350
**Ian Sutherland** <<[email protected]>>
349-
* [indutny](https://github.com/indutny) -
350-
**Fedor Indutny** <<[email protected]>>
351351
* [JacksonTian](https://github.com/JacksonTian) -
352352
**Jackson Tian** <<[email protected]>>
353353
* [JakobJingleheimer](https://github.com/JakobJingleheimer) -
@@ -534,6 +534,8 @@ For information about the governance of the Node.js project, see
534534
**Imran Iqbal** <<[email protected]>>
535535
* [imyller](https://github.com/imyller) -
536536
**Ilkka Myller** <<[email protected]>>
537+
* [indutny](https://github.com/indutny) -
538+
**Fedor Indutny** <<[email protected]>>
537539
* [isaacs](https://github.com/isaacs) -
538540
**Isaac Z. Schlueter** <<[email protected]>>
539541
* [italoacasas](https://github.com/italoacasas) -

SECURITY.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,22 @@ Vulnerabilities related to this case may be fixed by a documentation update.
8282

8383
**Node.js does NOT trust**:
8484

85-
1. The data from network connections that are created through the use of Node.js
86-
APIs and which is transformed/validated by Node.js before being passed to the
87-
application. This includes:
88-
* HTTP APIs (all flavors) client and server APIs.
85+
1. Data received from the remote end of inbound network connections
86+
that are accepted through the use of Node.js APIs and
87+
which is transformed/validated by Node.js before being passed
88+
to the application. This includes:
89+
* HTTP APIs (all flavors) server APIs.
90+
2. The data received from the remote end of outbound network connections
91+
that are created through the use of Node.js APIs and
92+
which is transformed/validated by Node.js before being passed
93+
to the application EXCEPT in respect to payload length. Node.js trusts
94+
that applications make connections/requests which will avoid payload
95+
sizes that will result in a Denial of Service.
96+
* HTTP APIs (all flavors) client APIs.
8997
* DNS APIs.
90-
2. Consumers of data protected through the use of Node.js APIs (for example
98+
3. Consumers of data protected through the use of Node.js APIs (for example
9199
people who have access to data encrypted through the Node.js crypto APIs).
92-
3. The file content or other I/O that is opened for reading or writing by the
100+
4. The file content or other I/O that is opened for reading or writing by the
93101
use of Node.js APIs (ex: stdin, stdout, stderr).
94102

95103
In other words, if the data passing through Node.js to/from the application
@@ -181,6 +189,13 @@ the community they pose.
181189
no scenario that requires modification of that configuration file is
182190
considered a vulnerability.
183191

192+
#### Uncontrolled Resource Consumption (CWE-400) on outbound connections
193+
194+
* If Node.js is asked to connect to a remote site and return an
195+
artifact, it is not considered a vulnerability if the size of
196+
that artifact is large enough to impact performance and or
197+
cause the runtime to run out of resources.
198+
184199
## Receiving security updates
185200

186201
Security notifications will be distributed via the following methods.

benchmark/.eslintrc.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@ env:
55
es6: true
66

77
rules:
8-
comma-dangle: [error, {
9-
arrays: always-multiline,
10-
exports: always-multiline,
11-
functions: only-multiline,
12-
imports: always-multiline,
13-
objects: only-multiline,
14-
}]
158
prefer-arrow-callback: error
9+
10+
overrides:
11+
- files:
12+
- crypto/*.js
13+
- http/*.js
14+
- http2/*.js
15+
- path/*.js
16+
- url/*.js
17+
rules:
18+
comma-dangle: [error, {
19+
arrays: always-multiline,
20+
exports: always-multiline,
21+
functions: only-multiline,
22+
imports: always-multiline,
23+
objects: only-multiline,
24+
}]

benchmark/_http-benchmarkers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
106106
const scheme = options.scheme || 'http';
107107
const env = {
108108
test_url: `${scheme}://127.0.0.1:${options.port}${options.path}`,
109-
...process.env
109+
...process.env,
110110
};
111111

112112
const child = child_process.fork(this.executable,
@@ -203,7 +203,7 @@ exports.run = function(options, callback) {
203203
connections: 100,
204204
duration: 5,
205205
benchmarker: exports.default_http_benchmarker,
206-
...options
206+
...options,
207207
};
208208
if (!options.benchmarker) {
209209
callback(new Error('Could not locate required http benchmarker. See ' +

benchmark/assert/deepequal-map.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function main({ n, len, method, strict }) {
4646
}
4747
case 'deepEqual_mixed': {
4848
const values = array.map(
49-
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]
49+
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123],
5050
);
5151
benchmark(strict ? deepStrictEqual : deepEqual, n, values);
5252
break;
@@ -67,7 +67,7 @@ function main({ n, len, method, strict }) {
6767
}
6868
case 'notDeepEqual_mixed': {
6969
const values = array.map(
70-
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]
70+
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123],
7171
);
7272
const values2 = values.slice(0);
7373
values2[0] = ['w00t', 123];
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
const common = require('../common.js');
3+
const { AsyncLocalStorage, AsyncResource } = require('async_hooks');
4+
5+
/**
6+
* This benchmark verifies the performance of
7+
* `AsyncLocalStorage.getStore()` on propagation through async
8+
* resource scopes.
9+
*
10+
* - AsyncLocalStorage.run()
11+
* - AsyncResource.runInAsyncScope
12+
* - AsyncResource.runInAsyncScope
13+
* ...
14+
* - AsyncResource.runInAsyncScope
15+
* - AsyncLocalStorage.getStore()
16+
*/
17+
const bench = common.createBenchmark(main, {
18+
resourceCount: [10, 100, 1000],
19+
n: [1e4],
20+
});
21+
22+
function runBenchmark(store, n) {
23+
for (let i = 0; i < n; i++) {
24+
store.getStore();
25+
}
26+
}
27+
28+
function runInAsyncScopes(resourceCount, cb, i = 0) {
29+
if (i === resourceCount) {
30+
cb();
31+
} else {
32+
const resource = new AsyncResource('noop');
33+
resource.runInAsyncScope(() => {
34+
runInAsyncScopes(resourceCount, cb, i + 1);
35+
});
36+
}
37+
}
38+
39+
function main({ n, resourceCount }) {
40+
const store = new AsyncLocalStorage();
41+
runInAsyncScopes(resourceCount, () => {
42+
bench.start();
43+
runBenchmark(store, n);
44+
bench.end(n);
45+
});
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
const common = require('../common.js');
3+
const { AsyncLocalStorage } = require('async_hooks');
4+
5+
/**
6+
* This benchmark verifies the performance of
7+
* `AsyncLocalStorage.getStore()` on multiple `AsyncLocalStorage` instances
8+
* nested `AsyncLocalStorage.run()`s.
9+
*
10+
* - AsyncLocalStorage1.run()
11+
* - AsyncLocalStorage2.run()
12+
* ...
13+
* - AsyncLocalStorageN.run()
14+
* - AsyncLocalStorage1.getStore()
15+
*/
16+
const bench = common.createBenchmark(main, {
17+
sotrageCount: [1, 10, 100],
18+
n: [1e4],
19+
});
20+
21+
function runBenchmark(store, n) {
22+
for (let idx = 0; idx < n; idx++) {
23+
store.getStore();
24+
}
25+
}
26+
27+
function runStores(stores, value, cb, idx = 0) {
28+
if (idx === stores.length) {
29+
cb();
30+
} else {
31+
stores[idx].run(value, () => {
32+
runStores(stores, value, cb, idx + 1);
33+
});
34+
}
35+
}
36+
37+
function main({ n, sotrageCount }) {
38+
const stores = new Array(sotrageCount).fill(0).map(() => new AsyncLocalStorage());
39+
const contextValue = {};
40+
41+
runStores(stores, contextValue, () => {
42+
bench.start();
43+
runBenchmark(stores[0], n);
44+
bench.end(n);
45+
});
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
const common = require('../common.js');
3+
const { AsyncLocalStorage, AsyncResource } = require('async_hooks');
4+
5+
/**
6+
* This benchmark verifies the performance degradation of
7+
* async resource propagation on the increasing number of
8+
* active `AsyncLocalStorage`s.
9+
*
10+
* - AsyncLocalStorage.run() * storageCount
11+
* - new AsyncResource()
12+
* - new AsyncResource()
13+
* ...
14+
* - N new Asyncresource()
15+
*/
16+
const bench = common.createBenchmark(main, {
17+
storageCount: [0, 1, 10, 100],
18+
n: [1e3],
19+
});
20+
21+
function runStores(stores, value, cb, idx = 0) {
22+
if (idx === stores.length) {
23+
cb();
24+
} else {
25+
stores[idx].run(value, () => {
26+
runStores(stores, value, cb, idx + 1);
27+
});
28+
}
29+
}
30+
31+
function runBenchmark(n) {
32+
for (let i = 0; i < n; i++) {
33+
new AsyncResource('noop');
34+
}
35+
}
36+
37+
function main({ n, storageCount }) {
38+
const stores = new Array(storageCount).fill(0).map(() => new AsyncLocalStorage());
39+
const contextValue = {};
40+
41+
runStores(stores, contextValue, () => {
42+
bench.start();
43+
runBenchmark(n);
44+
bench.end(n);
45+
});
46+
}

0 commit comments

Comments
 (0)