mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: ignore all NODE_ envs from foreign parent in node process (#40881)
This commit is contained in:
5
spec/fixtures/api/fork-with-node-options.js
vendored
5
spec/fixtures/api/fork-with-node-options.js
vendored
@@ -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.
|
||||
|
||||
@@ -673,7 +673,7 @@ describe('node feature', () => {
|
||||
});
|
||||
|
||||
const script = path.join(fixtures, 'api', 'fork-with-node-options.js');
|
||||
const nodeOptionsWarning = 'NODE_OPTIONS is disabled because this process is invoked by other apps';
|
||||
const nodeOptionsWarning = 'Node.js environment variables are disabled because this process is invoked by other apps';
|
||||
|
||||
it('is disabled when invoked by other apps in ELECTRON_RUN_AS_NODE mode', async () => {
|
||||
await withTempDirectory(async (dir) => {
|
||||
|
||||
Reference in New Issue
Block a user