Skip to content

Commit 2a1b012

Browse files
committed
module: use primordials in helpers.js
Replace native array method (.push) with primordials (ArrayPrototypePush) in lib/internal/modules/helpers.js for consistency and security. This improves protection against prototype pollution and aligns with the primordials pattern used throughout the codebase.
1 parent 05d6b9b commit 2a1b012

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/internal/modules/helpers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const {
44
ArrayPrototypeForEach,
5+
ArrayPrototypePush,
56
ObjectDefineProperty,
67
ObjectFreeze,
78
ObjectPrototypeHasOwnProperty,
@@ -85,7 +86,7 @@ function initializeCjsConditions() {
8586
...userConditions,
8687
];
8788
if (getOptionValue('--require-module')) {
88-
cjsConditionsArray.push('module-sync');
89+
ArrayPrototypePush(cjsConditionsArray, 'module-sync');
8990
}
9091
ObjectFreeze(cjsConditionsArray);
9192
cjsConditions = new SafeSet(cjsConditionsArray);

0 commit comments

Comments
 (0)