From 20ef4230bbf698dcaf78c1a2b7975bd88842450c Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Sat, 28 Mar 2026 08:49:46 -0600 Subject: [PATCH] Remove process.mainModule --- security/jsLoader.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/jsLoader.ts b/security/jsLoader.ts index 579232874..2a45a300b 100644 --- a/security/jsLoader.ts +++ b/security/jsLoader.ts @@ -17,6 +17,7 @@ import type { CompartmentOptions } from 'ses'; import { mkdirSync, readFileSync, writeFileSync, unlinkSync, openSync, closeSync, statSync } from 'node:fs'; import { join } from 'node:path'; import { EventEmitter } from 'node:events'; +import * as process from 'node:process'; type Lockdown = 'none' | 'freeze' | 'ses'; const APPLICATIONS_LOCKDOWN: Lockdown = env.get(CONFIG_PARAMS.APPLICATIONS_LOCKDOWN); @@ -83,6 +84,7 @@ export async function scopedImport(filePath: string | URL, scope?: ApplicationSc Object.freeze(Intrinsic.prototype); } Object.freeze(Function); + process.mainModule = undefined; // this has dangerous privileges that should not be accessed } } const moduleUrl = (filePath instanceof URL ? filePath : pathToFileURL(filePath)).toString();