Skip to main content

validate_url_scheme

Function validate_url_scheme 

Source
pub fn validate_url_scheme(url: &Url) -> AptosResult<()>
Expand description

Validates that a URL uses a safe scheme (http or https).

§Security

This prevents SSRF attacks via dangerous URL schemes like file://, gopher://, etc. For production use, HTTPS is strongly recommended. HTTP is permitted (e.g., for local development) but no host restrictions are enforced by this function.

§Errors

Returns AptosError::Config if the URL scheme is not http or https.