INNER CODE UNIT · Rust
reserved_match
ovexro/dockpanel · panel/backend/src/routes/mod.rs:205
fn reserved_match(domain: &str, panel_host: Option<&str>, zones: &[String]) -> bool {
let d = domain.trim().to_lowercase();
if panel_host.is_some_and(|h| h == d) {
return true;
}
zones
.iter()
.any(|r| d == *r || d.ends_with(&format!(".{r}")))
}
/// Validate a value destined for an nginx `add_header Name "<value>" always;`
/// directive (CSP / Permissions-Policy). The value is rendered verbatim inside a
/// double-quoted argument in a `.conf` template, and Tera does NOT autoescape
/// `.conf`, so an unescaped `"` (or a trailing `\`) closes the quoted string
/// early and lets the remainder inject arbitrary nginx directives. `;` is
/// intentionally allowed — a real CSP uses it as a directive separator and it is
/// inert inside the quotes.
pub fn is_safe_header_value(v: &str) -> bool {