From ac73b1042b4dda6416ad82d5468c57de6d53d038 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 3 Oct 2024 11:05:46 +0100 Subject: feat(permissions): allow importing from cdn.jsdelivr.net by default (#26013) The exploit `--allow-import` is preventing against requires a compromised host. To make things easier and given its popularity, we're going to have the default `--allow-import` value include `cdn.jsdelivr.net:443`, but this can be overridden by replacing the `--allow-import` value with something else. --- cli/args/flags.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cli/args') diff --git a/cli/args/flags.rs b/cli/args/flags.rs index a4dcb9e91..06ce50783 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -696,9 +696,10 @@ impl PermissionFlags { } let builtin_allowed_import_hosts = [ + "jsr.io:443", "deno.land:443", "esm.sh:443", - "jsr.io:443", + "cdn.jsdelivr.net:443", "raw.githubusercontent.com:443", "gist.githubusercontent.com:443", ]; @@ -3261,7 +3262,7 @@ fn permission_args(app: Command, requires: Option<&'static str>) -> Command { -W, --allow-write[=<...] Allow file system write access. Optionally specify allowed paths. --allow-write | --allow-write="/etc,/var/log.txt" -I, --allow-import[=<...] Allow importing from remote hosts. Optionally specify allowed IP addresses and host names, with ports as necessary. - Default value: deno.land:443,jsr.io:443,esm.sh:443,raw.githubusercontent.com:443,user.githubusercontent.com:443 + Default value: deno.land:443,jsr.io:443,esm.sh:443,cdn.jsdelivr.net:443,raw.githubusercontent.com:443,user.githubusercontent.com:443 --allow-import | --allow-import="example.com,github.com" -N, --allow-net[=<...] Allow network access. Optionally specify allowed IP addresses and host names, with ports as necessary. --allow-net | --allow-net="localhost:8080,deno.land" @@ -3671,7 +3672,7 @@ fn allow_import_arg() -> Arg { .require_equals(true) .value_name("IP_OR_HOSTNAME") .help(cstr!( - "Allow importing from remote hosts. Optionally specify allowed IP addresses and host names, with ports as necessary. Default value: deno.land:443,jsr.io:443,esm.sh:443,raw.githubusercontent.com:443,user.githubusercontent.com:443" + "Allow importing from remote hosts. Optionally specify allowed IP addresses and host names, with ports as necessary. Default value: deno.land:443,jsr.io:443,esm.sh:443,cdn.jsdelivr.net:443,raw.githubusercontent.com:443,user.githubusercontent.com:443" )) .value_parser(flags_net::validator) } -- cgit v1.2.3