| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c61f909 commit 7aa9519
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2921,6 +2921,13 @@ equivalent to using the `--redirect-warnings=file` command-line flag. | |||
| 2921 | 2921 | added: | |
| 2922 | 2922 | - v13.0.0 | |
| 2923 | 2923 | - v12.16.0 | |
| 2924 | + changes: | ||
| 2925 | + - version: | ||
| 2926 | + - REPLACEME | ||
| 2927 | + pr-url: https://github.com/nodejs/node/pull/52905 | ||
| 2928 | + description: | ||
| 2929 | + Remove the possibility to use this env var with | ||
| 2930 | + kDisableNodeOptionsEnv for embedders. | ||
| 2924 | 2931 | --> | |
| 2925 | 2932 | ||
| 2926 | 2933 | Path to a Node.js module which will be loaded in place of the built-in REPL. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -921,6 +921,15 @@ static ExitCode InitializeNodeWithArgsInternal( | |||
| 921 | 921 | &env_argv, nullptr, errors, kAllowedInEnvvar); | |
| 922 | 922 | if (exit_code != ExitCode::kNoFailure) return exit_code; | |
| 923 | 923 | } | |
| 924 | + } else { | ||
| 925 | + std::string node_repl_external_env = {}; | ||
| 926 | + if (credentials::SafeGetenv("NODE_REPL_EXTERNAL_MODULE", | ||
| 927 | + &node_repl_external_env) || | ||
| 928 | + !node_repl_external_env.empty()) { | ||
| 929 | + errors->emplace_back("NODE_REPL_EXTERNAL_MODULE can't be used with " | ||
| 930 | + "kDisableNodeOptionsEnv"); | ||
| 931 | + return ExitCode::kInvalidCommandLineArgument; | ||
| 932 | + } | ||
| 924 | 933 | } | |
| 925 | 934 | #endif | |
| 926 | 935 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,8 +35,15 @@ NODE_MAIN(int argc, node::argv_type raw_argv[]) { | |||
| 35 | 35 | std::shared_ptr<node::InitializationResult> result = | |
| 36 | 36 | node::InitializeOncePerProcess( | |
| 37 | 37 | args, | |
| 38 | - {node::ProcessInitializationFlags::kNoInitializeV8, | ||
| 39 | - node::ProcessInitializationFlags::kNoInitializeNodeV8Platform}); | ||
| 38 | + { | ||
| 39 | + node::ProcessInitializationFlags::kNoInitializeV8, | ||
| 40 | + node::ProcessInitializationFlags::kNoInitializeNodeV8Platform, | ||
| 41 | + // This is used to test NODE_REPL_EXTERNAL_MODULE is disabled with | ||
| 42 | + // kDisableNodeOptionsEnv. If other tests need NODE_OPTIONS | ||
| 43 | + // support in the future, split this configuration out as a | ||
| 44 | + // command line option. | ||
| 45 | + node::ProcessInitializationFlags::kDisableNodeOptionsEnv, | ||
| 46 | + }); | ||
| 40 | 47 | ||
| 41 | 48 | for (const std::string& error : result->errors()) | |
| 42 | 49 | fprintf(stderr, "%s: %s\n", args[0].c_str(), error.c_str()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -151,3 +151,21 @@ for (const extraSnapshotArgs of [ | |||
| 151 | 151 | [ '--', ...runEmbeddedArgs ], | |
| 152 | 152 | { cwd: tmpdir.path }); | |
| 153 | 153 | } | |
| 154 | + | ||
| 155 | + // Guarantee NODE_REPL_EXTERNAL_MODULE won't bypass kDisableNodeOptionsEnv | ||
| 156 | + { | ||
| 157 | + spawnSyncAndExit( | ||
| 158 | + binary, | ||
| 159 | + ['require("os")'], | ||
| 160 | + { | ||
| 161 | + env: { | ||
| 162 | + ...process.env, | ||
| 163 | + 'NODE_REPL_EXTERNAL_MODULE': 'fs', | ||
| 164 | + }, | ||
| 165 | + }, | ||
| 166 | + { | ||
| 167 | + status: 9, | ||
| 168 | + signal: null, | ||
| 169 | + stderr: `${binary}: NODE_REPL_EXTERNAL_MODULE can't be used with kDisableNodeOptionsEnv\n`, | ||
| 170 | + }); | ||
| 171 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments