pub fn validate_safe_url(
url: &str,
allowed_hosts: &[String],
block_private: bool,
) -> Result<(), String>Expand description
Validates an RPC URL against security policies
§Arguments
url- The RPC URL to validateallowed_hosts- List of explicitly allowed hostnames/IPs (if non-empty, only these are allowed)block_private- If true, block private IP addresses
§Security Notes
- Cloud metadata endpoints (169.254.169.254, fd00:ec2::254) are ALWAYS blocked
- If
allowed_hostsis non-empty, only hosts in the list are permitted
§Returns
Ok(())if the URL passes validationErr(String)with a description of why validation failed