Skip to main content

SsrfReason

Enum SsrfReason 

Source
#[non_exhaustive]
pub enum SsrfReason { NonHttps, IpLiteral, InvalidUrl, Loopback, Private, Imds, MulticastOrReserved, CrossAuthority, }
Expand description

Stable, machine-readable reason an SSRF check rejected a target.

Surfaced by the SsrfPolicy::classify_url / SsrfPolicy::classify_ip / SsrfPolicy::classify_redirect family so callers can react programmatically — and so language bindings can map a rejection to a typed exception — instead of string-matching the free-form detail message. Maps to RFC-ACDP-0006 §7 / RFC-ACDP-0008 §4.8.

#[non_exhaustive]: future spec revisions may add ranges; match with a wildcard arm.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NonHttps

URL scheme is not https (and allow_http is off).

§

IpLiteral

URL embeds an IP literal; a hostname (forcing DNS) is required.

§

InvalidUrl

URL could not be parsed, has no host, or has an invalid hostname.

§

Loopback

Loopback range — IPv4 127.0.0.0/8 or IPv6 ::1.

§

Private

Private range — RFC 1918 (10/8, 172.16/12, 192.168/16), CGNAT 100.64/10, or IPv6 ULA fc00::/7.

§

Imds

Link-local / cloud instance-metadata reach — IPv4 169.254.0.0/16 (incl. 169.254.169.254), IPv6 fe80::/10, and the NAT64 well-known prefix 64:ff9b::/96 (which can translate to IMDS).

§

MulticastOrReserved

Multicast or otherwise reserved/unusable range (0.0.0.0/8, 192.0.0.0/24, 198.18.0.0/15, 224.0.0.0/4, 240.0.0.0/4, IPv6 multicast / unspecified).

§

CrossAuthority

A redirect target whose scheme, host, or effective port differs from the originating request’s authority (RFC-ACDP-0006 §7.5).

Implementations§

Source§

impl SsrfReason

Source

pub fn as_str(&self) -> &'static str

The stable snake_case identifier for this reason — the contract language bindings expose to host code.

Trait Implementations§

Source§

impl Clone for SsrfReason

Source§

fn clone(&self) -> SsrfReason

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SsrfReason

Source§

impl Debug for SsrfReason

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SsrfReason

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SsrfReason

Source§

impl PartialEq for SsrfReason

Source§

fn eq(&self, other: &SsrfReason) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SsrfReason

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.