helmet-core - Security Middleware for popular Rust web frameworks
ntex-helmetis a security middleware for thentexweb framework.actix-web-helmetis a security middleware for theactix-webweb framework.rocket-helmetis a security middleware for therocketweb framework.warp-helmetis a security middleware for thewarpweb framework.axum-helmetis a security middleware for theaxumweb framework.poem-helmetis a security middleware for thepoemweb framework.salvo-helmetis a security middleware for thesalvoweb framework.tide-helmetis a security middleware for thetideweb framework.
It works by setting HTTP headers for you. These headers can help protect your app from some well-known web vulnerabilities:
- Cross-Origin-Embedder-Policy
- Cross-Origin-Opener-Policy
- Cross-Origin-Resource-Policy
- Origin-Agent-Cluster
- Referrer-Policy
- Strict-Transport-Security
- X-Content-Type-Options
- X-DNS-Prefetch-Control
- X-Download-Options
- X-Frame-Options
- X-Permitted-Cross-Domain-Policies
- X-XSS-Protection
- X-Powered-By
- Content-Security-Policy
Usage
Add this to your Cargo.toml:
[]
= "1.0.1"
Implementing the middleware is different for each framework. See the README for your framework of choice to see how to use it.
Example
If your framework already has a *-helmet crate, prefer that. Otherwise, you
can wrap helmet_core::Helmet yourself — the headers field is a
Vec<(&'static str, String)> that you copy onto each response.
use Helmet;
let helmet = default;
;
License
This project is licensed under the MIT license.