| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dfa4986 commit 3b79e9c
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2732,6 +2732,13 @@ equivalent to using the `--redirect-warnings=file` command-line flag. | |||
| 2732 | 2732 | added: | |
| 2733 | 2733 | - v13.0.0 | |
| 2734 | 2734 | - v12.16.0 | |
| 2735 | + changes: | ||
| 2736 | + - version: | ||
| 2737 | + - REPLACEME | ||
| 2738 | + pr-url: https://github.com/nodejs/node/pull/52905 | ||
| 2739 | + description: | ||
| 2740 | + Remove the possibility to use this env var with | ||
| 2741 | + kDisableNodeOptionsEnv for embedders. | ||
| 2735 | 2742 | --> | |
| 2736 | 2743 | ||
| 2737 | 2744 | 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 | |
|---|---|---|---|
@@ -919,6 +919,15 @@ static ExitCode InitializeNodeWithArgsInternal( | |||
| 919 | 919 | &env_argv, nullptr, errors, kAllowedInEnvvar); | |
| 920 | 920 | if (exit_code != ExitCode::kNoFailure) return exit_code; | |
| 921 | 921 | } | |
| 922 | + } else { | ||
| 923 | + std::string node_repl_external_env = {}; | ||
| 924 | + if (credentials::SafeGetenv("NODE_REPL_EXTERNAL_MODULE", | ||
| 925 | + &node_repl_external_env) || | ||
| 926 | + !node_repl_external_env.empty()) { | ||
| 927 | + errors->emplace_back("NODE_REPL_EXTERNAL_MODULE can't be used with " | ||
| 928 | + "kDisableNodeOptionsEnv"); | ||
| 929 | + return ExitCode::kInvalidCommandLineArgument; | ||
| 930 | + } | ||
| 922 | 931 | } | |
| 923 | 932 | #endif | |
| 924 | 933 | ||
| 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::unique_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