pub enum UrlGuardError {
InvalidUrl(String),
LocalhostBadPath(String),
LocalNetworkQueryString,
RedirectToPrivateIp(IpAddr),
IdnaDomain(String),
PrivateHostBlocked(String),
}Expand description
Errors returned by URL validation functions.
Variants§
InvalidUrl(String)
URL failed url::Url::parse or used an unsupported scheme.
LocalhostBadPath(String)
A localhost tracker URL was missing the required /announce path —
BEP 3 trackers must terminate at that path, and accepting bare-host
URLs widens the SSRF surface unnecessarily.
LocalNetworkQueryString
A local-network web seed URL carried a query string. BEP 17/19 web
seeds shouldn’t need one, and allowing them opens an SSRF vector
(smuggling commands via ? to local services).
RedirectToPrivateIp(IpAddr)
In-flight redirect from a public URL landed on a private IP — fired
by the custom reqwest::redirect::Policy returned by
build_redirect_policy. Distinct from Self::PrivateHostBlocked,
which is a pre-flight check on user-supplied URLs.
IdnaDomain(String)
An internationalised domain name was present and IDNA was disallowed by
the active UrlSecurityConfig.
PrivateHostBlocked(String)
M218: a user-typed URL pointed at a private/loopback host. Stricter than
Self::RedirectToPrivateIp (which only fires in-flight); this is the
pre-flight check that rejects http://localhost/, http://192.168.1.1/,
http://0.0.0.0/, http://[::ffff:127.0.0.1]/, etc. before the request
leaves the process.
Trait Implementations§
Source§impl Debug for UrlGuardError
impl Debug for UrlGuardError
Source§impl Display for UrlGuardError
impl Display for UrlGuardError
Source§impl Error for UrlGuardError
impl Error for UrlGuardError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for UrlGuardError
impl RefUnwindSafe for UrlGuardError
impl Send for UrlGuardError
impl Sync for UrlGuardError
impl Unpin for UrlGuardError
impl UnsafeUnpin for UrlGuardError
impl UnwindSafe for UrlGuardError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.