Module http_types::security
source · Expand description
HTTP Security Headers.
Specifications
Example
use http_types::{StatusCode, Response};
let mut res = Response::new(StatusCode::Ok);
http_types::security::default(&mut res);Structs
- Build a
Content-Security-Policyheader. - Define
report-todirective value - Define
endpointsforreport-todirective value - Specify origins that are allowed to see values via the Resource Timing API.
Enums
- Set the frameguard level.
- Set the Referrer-Policy level
- Define source value
Functions
- Apply a set of default protections.
- Disable browsers’ DNS prefetching by setting the
X-DNS-Prefetch-Controlheader. - Mitigates clickjacking attacks by setting the
X-Frame-Optionsheader. - Sets the
Strict-Transport-Securityheader to keep your users onHTTPS. - Prevent browsers from trying to guess (“sniff”) the MIME type, which can have security implications.
- Removes the
X-Powered-Byheader to make it slightly harder for attackers to see what potentially-vulnerable technology powers your site. - Mitigates referrer leakage by controlling the referer[sic] header in links away from pages
- Sets the
X-XSS-Protectionheader to prevent reflected XSS attacks.