summaryrefslogtreecommitdiff
path: root/runtime/permissions
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/permissions')
-rw-r--r--runtime/permissions/lib.rs4
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(']') {