From 19deec449428ffac823e2d94de56bc1482a11865 Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Wed, 14 Sep 2022 11:59:20 -0400 Subject: fix(ops): add node.js env variable allowlist (#15893) This commit allows the Node compatibility layer to skip environment variable permission checks when --unstable is passed and the variable name is one that Node uses. Fixes: https://github.com/denoland/deno/issues/15890 --- ext/node/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ext') diff --git a/ext/node/lib.rs b/ext/node/lib.rs index da8ca3003..42348915e 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -8,6 +8,7 @@ use deno_core::url::Url; use deno_core::Extension; use deno_core::OpState; use once_cell::sync::Lazy; +use std::collections::HashSet; use std::path::Path; use std::path::PathBuf; use std::rc::Rc; @@ -59,6 +60,15 @@ pub static NODE_GLOBAL_THIS_NAME: Lazy = Lazy::new(|| { format!("__DENO_NODE_GLOBAL_THIS_{}__", seconds) }); +pub static NODE_ENV_VAR_ALLOWLIST: Lazy> = Lazy::new(|| { + // The full list of environment variables supported by Node.js is available + // at https://nodejs.org/api/cli.html#environment-variables + let mut set = HashSet::new(); + set.insert("NODE_DEBUG".to_string()); + set.insert("NODE_OPTIONS".to_string()); + set +}); + struct Unstable(pub bool); pub fn init( -- cgit v1.2.3