pub struct SecurityConfig {
pub allowed_origins: Vec<String>,
}Expand description
Browser-facing defenses for the local proxy.
Loopback is not a boundary against the browser: any page the operator visits can POST to 127.0.0.1 as a CORS simple request, which is sent without a preflight. CORS blocks reading the reply, but the request has already spent the budget and can poison the cache.
Fields§
§allowed_origins: Vec<String>Origins permitted to drive the proxy from a browser, matched exactly
against the Origin header. Empty (the default) accepts no
cross-origin browser traffic; non-browser clients send no such header
and are unaffected either way.
The literal "*" disables the check entirely, re-opening the CSRF hole
for every page the operator visits.
Implementations§
Source§impl SecurityConfig
impl SecurityConfig
Sourcepub fn origin_allowed(&self, origin: &str) -> bool
pub fn origin_allowed(&self, origin: &str) -> bool
True when origin may drive the proxy from a browser.
Sourcepub fn allows_any_origin(&self) -> bool
pub fn allows_any_origin(&self) -> bool
True when the operator has opened the proxy to every origin, which is the only case where browser-origin signals are ignored.
Trait Implementations§
Source§impl Clone for SecurityConfig
impl Clone for SecurityConfig
Source§fn clone(&self) -> SecurityConfig
fn clone(&self) -> SecurityConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more