diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2024-09-20 11:10:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-20 11:10:46 -0700 |
commit | 3e053f8f06cfd83bd3f162ee68a0eca849e50d2a (patch) | |
tree | 969507fb482f8a5ea4f71872f4934035bb598ac1 /runtime/permissions | |
parent | 92fc702cec555a08c38509bfb10edd3d163af241 (diff) |
fix(flags): properly error out for urls (#25770)
Closes https://github.com/denoland/deno/issues/25760
Diffstat (limited to 'runtime/permissions')
-rw-r--r-- | runtime/permissions/lib.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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<Self, AnyError> { + 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(']') { |