Skip to main content

validate_url_shape

Function validate_url_shape 

Source
pub fn validate_url_shape(url: &str) -> Result<Url, SsrfError>
Expand description

Parse and statically validate a CIMD client_id URL: require https, forbid userinfo/query/fragment, require a non-root path component, require a host, and reject the private-TLD/loopback host denylist. If the host is an IP literal it is additionally run through check_ip_not_private.

This performs no DNS — see the module doc for what callers must do after resolving a domain-name host.

§Errors

Returns SsrfError when any static rule is violated.