From 3e053f8f06cfd83bd3f162ee68a0eca849e50d2a Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Fri, 20 Sep 2024 11:10:46 -0700 Subject: fix(flags): properly error out for urls (#25770) Closes https://github.com/denoland/deno/issues/25760 --- runtime/permissions/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/permissions/lib.rs') diff --git a/runtime/permissions/lib.rs b/runtime/permissions/lib.rs index b5c870a07..c7ef864db 100644 --- a/runtime/permissions/lib.rs +++ b/runtime/permissions/lib.rs @@ -894,6 +894,10 @@ impl QueryDescriptor for NetDescriptor { // TODO(bartlomieju): rewrite to not use `AnyError` but a specific error implementations impl NetDescriptor { pub fn parse(hostname: &str) -> Result { + if hostname.starts_with("http://") || hostname.starts_with("https://") { + return Err(uri_error(format!("invalid value '{hostname}': URLs are not supported, only domains and ips"))); + } + // If this is a IPv6 address enclosed in square brackets, parse it as such. if hostname.starts_with('[') { if let Some((ip, after)) = hostname.split_once(']') { -- cgit v1.2.3