diff options
Diffstat (limited to 'runtime/ops/process.rs')
-rw-r--r-- | runtime/ops/process.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index 9d166a801..564092454 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -229,9 +229,23 @@ fn create_command( mut args: SpawnArgs, api_name: &str, ) -> Result<CreateCommand, AnyError> { - state - .borrow_mut::<PermissionsContainer>() - .check_run(&args.cmd, api_name)?; + { + let permissions = state.borrow_mut::<PermissionsContainer>(); + permissions.check_run(&args.cmd, api_name)?; + // error the same on all platforms + if permissions.check_run_all(api_name).is_err() + && (args.env.iter().any(|(k, _)| k.trim() == "LD_PRELOAD") + || !args.clear_env + && std::env::vars().any(|(k, _)| k.trim() == "LD_PRELOAD")) + { + // we don't allow users to launch subprocesses with the LD_PRELOAD + // env var set because this allows executing any code + return Err(deno_core::error::custom_error( + "PermissionDenied", + "Requires --allow-all permissions to spawn subprocess with LD_PRELOAD environment variable." + )); + } + } let mut command = std::process::Command::new(args.cmd); |