pub enum Preset {
Strict,
Balanced,
Relaxed,
}Expand description
Security preset levels.
§Examples
use http_security_headers::Preset;
let headers = Preset::Strict.build();Variants§
Strict
Strict security configuration.
Recommended for applications that can enforce strict security policies. May break functionality if not properly configured.
Includes:
- CSP:
default-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none' - HSTS: 1 year, includeSubDomains
- X-Frame-Options: DENY
- X-Content-Type-Options: nosniff
- Referrer-Policy: no-referrer
- COOP: same-origin
- COEP: require-corp
- CORP: same-origin
Balanced
Balanced security configuration.
Provides good security while maintaining compatibility with most applications.
Includes:
- CSP:
default-src 'self'; script-src 'self' 'unsafe-inline'; object-src 'none' - HSTS: 1 year, includeSubDomains
- X-Frame-Options: SAMEORIGIN
- X-Content-Type-Options: nosniff
- Referrer-Policy: strict-origin-when-cross-origin
- COOP: same-origin-allow-popups
Relaxed
Relaxed security configuration.
Provides baseline security with minimal restrictions. Suitable for applications that need maximum compatibility.
Includes:
- HSTS: 6 months
- X-Frame-Options: SAMEORIGIN
- X-Content-Type-Options: nosniff
- Referrer-Policy: strict-origin-when-cross-origin
Implementations§
Trait Implementations§
impl Copy for Preset
impl Eq for Preset
impl StructuralPartialEq for Preset
Auto Trait Implementations§
impl Freeze for Preset
impl RefUnwindSafe for Preset
impl Send for Preset
impl Sync for Preset
impl Unpin for Preset
impl UnwindSafe for Preset
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