From 2a1b0129168a1b3171c12b4f10c74946e77fc477 Mon Sep 17 00:00:00 2001 From: Ayoub Mabrouk Date: Mon, 29 Dec 2025 02:53:52 +0100 Subject: [PATCH] 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. --- lib/internal/modules/helpers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/modules/helpers.js b/lib/internal/modules/helpers.js index b04ac126cd35b9..bc9199259a5eb2 100644 --- a/lib/internal/modules/helpers.js +++ b/lib/internal/modules/helpers.js @@ -2,6 +2,7 @@ const { ArrayPrototypeForEach, + ArrayPrototypePush, ObjectDefineProperty, ObjectFreeze, ObjectPrototypeHasOwnProperty, @@ -85,7 +86,7 @@ function initializeCjsConditions() { ...userConditions, ]; if (getOptionValue('--require-module')) { - cjsConditionsArray.push('module-sync'); + ArrayPrototypePush(cjsConditionsArray, 'module-sync'); } ObjectFreeze(cjsConditionsArray); cjsConditions = new SafeSet(cjsConditionsArray);