#[non_exhaustive]pub struct DestinationPolicy {
pub allowed_schemes: Vec<String>,
pub allowed_hosts: Vec<String>,
pub block_link_local: bool,
pub block_metadata: bool,
}Expand description
Destination policy applied to initial request URLs and redirect targets.
By default, HTTP and HTTPS URLs are allowed while link-local and common
cloud metadata destinations are blocked. allowed_hosts is an allow-list:
when it is empty, any non-blocked host is allowed; when it is non-empty, the
URL host must match one of the configured entries. Host entries are exact
matches unless they start with *., in which case only dot-boundary
subdomains match (for example, *.example.com matches api.example.com but
not badexample.com or the apex example.com).
Hostname validation happens before DNS resolution. Use allowed_hosts for
high-trust clients that must not follow attacker-controlled DNS names.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.allowed_schemes: Vec<String>Allowed URL schemes. Empty means all schemes are rejected.
allowed_hosts: Vec<String>Optional host allow-list. Empty means any non-blocked host is allowed.
block_link_local: boolBlock IPv4/IPv6 link-local address literals.
block_metadata: boolBlock common cloud metadata hosts and address literals.
Implementations§
Source§impl DestinationPolicy
impl DestinationPolicy
Sourcepub fn with_allowed_schemes<I, S>(self, schemes: I) -> Self
pub fn with_allowed_schemes<I, S>(self, schemes: I) -> Self
Replace allowed schemes.
Sourcepub fn with_allowed_hosts<I, S>(self, hosts: I) -> Self
pub fn with_allowed_hosts<I, S>(self, hosts: I) -> Self
Replace the host allow-list.
Sourcepub fn with_block_link_local(self, block: bool) -> Self
pub fn with_block_link_local(self, block: bool) -> Self
Set whether link-local address literals are blocked.
Sourcepub fn with_block_metadata(self, block: bool) -> Self
pub fn with_block_metadata(self, block: bool) -> Self
Set whether common cloud metadata hosts are blocked.
Trait Implementations§
Source§impl Clone for DestinationPolicy
impl Clone for DestinationPolicy
Source§fn clone(&self) -> DestinationPolicy
fn clone(&self) -> DestinationPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DestinationPolicy
impl Debug for DestinationPolicy
Source§impl Default for DestinationPolicy
impl Default for DestinationPolicy
impl Eq for DestinationPolicy
Source§impl PartialEq for DestinationPolicy
impl PartialEq for DestinationPolicy
Source§fn eq(&self, other: &DestinationPolicy) -> bool
fn eq(&self, other: &DestinationPolicy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DestinationPolicy
Auto Trait Implementations§
impl Freeze for DestinationPolicy
impl RefUnwindSafe for DestinationPolicy
impl Send for DestinationPolicy
impl Sync for DestinationPolicy
impl Unpin for DestinationPolicy
impl UnsafeUnpin for DestinationPolicy
impl UnwindSafe for DestinationPolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.