fix: ignore all NODE_ envs from foreign parent in node process (#40770)

* fix: ignore all NODE_ envs from foreign parent

* fix: recognize ad-hoc signed binary
This commit is contained in:
Cheng Zhao 2024-01-04 16:34:08 +09:00 committed by GitHub
parent baca2e302d
commit dfce1a9eb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 115 additions and 16 deletions

View file

@ -2,11 +2,14 @@ const { execFileSync } = require('node:child_process');
const path = require('node:path');
const fixtures = path.resolve(__dirname, '..');
const failJs = path.join(fixtures, 'module', 'fail.js');
const env = {
ELECTRON_RUN_AS_NODE: 'true',
// Process will exit with 1 if NODE_OPTIONS is accepted.
NODE_OPTIONS: `--require "${path.join(fixtures, 'module', 'fail.js')}"`
NODE_OPTIONS: `--require "${failJs}"`,
// Try bypassing the check with NODE_REPL_EXTERNAL_MODULE.
NODE_REPL_EXTERNAL_MODULE: failJs
};
// Provide a lower cased NODE_OPTIONS in case some code ignores case sensitivity
// when reading NODE_OPTIONS.