pub struct SecurityConfig {
pub hsts_max_age: u64,
pub hsts_include_subdomains: bool,
pub hsts_preload: bool,
pub frame_options: FrameOptions,
pub referrer_policy: &'static str,
pub permissions_policy: Option<&'static str>,
pub csp_default: &'static str,
pub csp_docs_override: Option<&'static str>,
pub nosniff: bool,
pub xss_protection: bool,
}Expand description
Full security header configuration.
Every field has a production-safe default. Override only what your deployment requires. See module docs for the default value table.
Fields§
§hsts_max_age: u64HSTS max-age in seconds. Set 0 to disable the header (e.g. in local
dev where TLS is not in use). Default: 31_536_000 (1 year).
hsts_include_subdomains: boolInclude includeSubDomains directive. Default: true.
hsts_preload: boolInclude preload directive (required for HSTS preload submission).
Default: true.
frame_options: FrameOptionsX-Frame-Options policy. Default: FrameOptions::Deny.
referrer_policy: &'static strReferrer-Policy value. Must be a 'static str.
Default: "strict-origin-when-cross-origin".
permissions_policy: Option<&'static str>Permissions-Policy value. None omits the header.
Default: restrictive policy disabling camera, microphone, geolocation,
payment, and USB.
csp_default: &'static strCSP for all routes except /docs. Default: "default-src 'self'".
csp_docs_override: Option<&'static str>CSP override for the /docs Swagger UI route. None uses csp_default.
Default: relaxes script-src and style-src for the unpkg CDN.
nosniff: boolEnable X-Content-Type-Options: nosniff. Default: true.
xss_protection: boolEnable X-XSS-Protection: 1; mode=block. Default: true.
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 moreSource§impl Debug for SecurityConfig
impl Debug for SecurityConfig
Auto Trait Implementations§
impl Freeze for SecurityConfig
impl RefUnwindSafe for SecurityConfig
impl Send for SecurityConfig
impl Sync for SecurityConfig
impl Unpin for SecurityConfig
impl UnsafeUnpin for SecurityConfig
impl UnwindSafe for SecurityConfig
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<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request