pub struct ValidatedUrl {
pub url: Url,
pub addresses: Vec<SocketAddr>,
}Available on crate feature
web only.Expand description
A URL that has passed SSRF validation, together with the exact IP addresses it resolved to.
The caller must connect to one of ValidatedUrl::addresses (e.g. by
pinning them via reqwest::ClientBuilder::resolve_to_addrs) rather than
re-resolving the host. Re-resolving opens a DNS-rebinding TOCTOU hole: the
attacker-controlled record can pass validation here and then rebind to a
blocked address (169.254.169.254, 127.0.0.1, …) before the connection is
made.
Fields§
§url: UrlThe validated URL.
addresses: Vec<SocketAddr>The vetted socket addresses the host resolved to. Pin these for the actual request so the connection targets exactly what was validated.
Trait Implementations§
Source§impl Clone for ValidatedUrl
impl Clone for ValidatedUrl
Source§fn clone(&self) -> ValidatedUrl
fn clone(&self) -> ValidatedUrl
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValidatedUrl
impl RefUnwindSafe for ValidatedUrl
impl Send for ValidatedUrl
impl Sync for ValidatedUrl
impl Unpin for ValidatedUrl
impl UnsafeUnpin for ValidatedUrl
impl UnwindSafe for ValidatedUrl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more