Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove --allow-run warning when using deno without args or subcommand #25684

9 changes: 7 additions & 2 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1702,8 +1702,13 @@ fn warn_insecure_allow_run_flags(flags: &Flags) {
return;
};

// discourage using --allow-run without an allow list
if allow_run_list.is_empty() {
let is_no_args_deno = match flags.subcommand.clone() {
DenoSubcommand::Repl(repl_flags) => repl_flags.is_default_command,
_ => false,
};
// discourage using --allow-run without an allow list, but
// allow it when no args deno is used [deno] without subcommand
if allow_run_list.is_empty() && !is_no_args_deno {
Copy link
Member

@dsherret dsherret Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change this to instead set flags.permissions.allow_all = true;:

deno/cli/args/flags.rs

Lines 1370 to 1376 in f360cae

flags.permissions.allow_net = Some(vec![]);
flags.permissions.allow_env = Some(vec![]);
flags.permissions.allow_run = Some(vec![]);
flags.permissions.allow_read = Some(vec![]);
flags.permissions.allow_sys = Some(vec![]);
flags.permissions.allow_write = Some(vec![]);
flags.permissions.allow_ffi = Some(vec![]);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's actually a flags.allow_all(); and I think internally that should just set flags.permissions.allow_all = true only.

log::warn!(
"{} --allow-run can be trivially exploited. Prefer specifying an allow list (https://docs.deno.com/runtime/fundamentals/security/#running-subprocesses)",
colors::yellow("Warning")
Expand Down