From 4842e96e13d71d0d03c5df2abd718148ab8baeeb Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Fri, 19 Jun 2020 15:18:39 +0200 Subject: [PATCH] Prevent that users configure a pathprefix for the service uri. --- src/daemon/config.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/daemon/config.rs b/src/daemon/config.rs index 1a60e27a..86a12ea6 100644 --- a/src/daemon/config.rs +++ b/src/daemon/config.rs @@ -426,6 +426,14 @@ impl Config { if !self.service_uri.ends_with('/') { return Err(ConfigError::other("service URI must end with '/'")); + } else { + uri::Https::from_str(&self.service_uri).map_err(|_| { + ConfigError::Other(format!("Invalid service uri: {}", self.service_uri)) + })?; + + if self.service_uri.as_str().matches('/').count() != 3 { + return Err(ConfigError::other("Service URI MUST specify a host name only, e.g. https://rpki.example.com:3000/")); + } } if !self.rrdp_service_uri().to_string().ends_with('/') {