Skip to main content

check_base

Function check_base 

Source
pub fn check_base(base: &str) -> Result<(), String>
Expand description

Refuses a base URL that is not plain http(s) with a host. The value reaches curl as an argument, so this is not what keeps a shell safe; it is what keeps file:// and friends from being read as a deployment.

use majordomus_cli::served::check_base;
assert!(check_base("https://majordomus.dev").is_ok());
assert!(check_base("http://127.0.0.1:8080/x").is_ok());
assert!(check_base("file:///etc/passwd").is_err());