Skip to content

Commit fff222d

Browse files
authored
Merge branch 'nodejs:main' into fix/module-esm-silent-failure-61104
2 parents 674c150 + 2696391 commit fff222d

Some content is hidden

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

58 files changed

+7078
-5006
lines changed

SECURITY.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,32 @@ the community they pose.
309309
Node.js releases won't be affected by such vulnerabilities. Users are
310310
responsible for keeping the software they use through Corepack up-to-date.
311311

312+
#### Exposing Application-Level APIs to Untrusted Users (CWE-653)
313+
314+
* Node.js trusts the application code that uses its APIs. When application code
315+
exposes Node.js functionality to untrusted users in an unsafe manner, any
316+
resulting crashes, data corruption, or other issues are not considered
317+
vulnerabilities in Node.js itself. It is the application's responsibility to:
318+
* Validate and sanitize all untrusted input before passing it to Node.js APIs.
319+
* Design appropriate access controls and security boundaries.
320+
* Avoid exposing low-level or dangerous APIs directly to untrusted users.
321+
322+
* Examples of scenarios that are **not** Node.js vulnerabilities:
323+
* Allowing untrusted users to register SQLite user-defined functions that can
324+
perform arbitrary operations (e.g., closing database connections during query
325+
execution, causing crashes or use-after-free conditions).
326+
* Exposing `child_process.exec()` or similar APIs to untrusted users without
327+
proper input validation, allowing command injection.
328+
* Allowing untrusted users to control file paths passed to file system APIs
329+
without validation, leading to path traversal issues.
330+
* Permitting untrusted users to define custom code that executes with the
331+
application's privileges (e.g., custom transforms, plugins, or callbacks).
332+
333+
* These scenarios represent application-level security issues, not Node.js
334+
vulnerabilities. The root cause is the application's failure to establish
335+
proper security boundaries between trusted application logic and untrusted
336+
user input.
337+
312338
## Assessing experimental features reports
313339

314340
Experimental features are eligible for security reports just like any other

benchmark/common.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,9 @@ class Benchmark {
118118
const [, key, value] = match;
119119
if (configs[key] !== undefined) {
120120
cliOptions[key] ||= [];
121-
cliOptions[key].push(
122-
// Infer the type from the config object and parse accordingly
123-
typeof configs[key][0] === 'number' ? +value : value,
124-
);
121+
const configType = typeof configs[key][0];
122+
const configValue = configType === 'number' ? +value : configType === 'boolean' ? value === 'true' : value;
123+
cliOptions[key].push(configValue);
125124
} else {
126125
extraOptions[key] = value;
127126
}
@@ -141,7 +140,7 @@ class Benchmark {
141140
const values = options[key];
142141

143142
for (const value of values) {
144-
if (typeof value !== 'number' && typeof value !== 'string') {
143+
if (typeof value !== 'number' && typeof value !== 'string' && typeof value !== 'boolean') {
145144
throw new TypeError(
146145
`configuration "${key}" had type ${typeof value}`);
147146
}

benchmark/crypto/randomUUID.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ const { randomUUID } = require('crypto');
55

66
const bench = common.createBenchmark(main, {
77
n: [1e7],
8-
disableEntropyCache: [0, 1],
8+
disableEntropyCache: [false, true],
99
});
1010

1111
function main({ n, disableEntropyCache }) {
12-
disableEntropyCache = !!disableEntropyCache;
1312
bench.start();
1413
for (let i = 0; i < n; ++i)
1514
randomUUID({ disableEntropyCache });

benchmark/util/deprecate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
77
n: [1e5],
8-
modifyPrototype: [1, 0],
8+
modifyPrototype: [true, false],
99
emitWarningSync: [1, 0],
1010
}, {
1111
flags: ['--expose-internals'],
@@ -23,7 +23,7 @@ function main({ n, modifyPrototype, emitWarningSync }) {
2323
'This function is deprecated',
2424
'DEP0000',
2525
emitWarningSync,
26-
!!modifyPrototype,
26+
modifyPrototype,
2727
);
2828

2929
let sum = 0;

0 commit comments

Comments
 (0)