4 releases
0.1.3 | Jan 5, 2024 |
---|---|
0.1.2 | Dec 30, 2023 |
0.1.1 | Dec 30, 2023 |
0.1.0 | Dec 30, 2023 |
#14 in #ntex
36 downloads per month
115KB
2K
SLoC
ntex-helmet
- Security Middleware for ntex
web framework
ntex-helmet
is a security middleware for the ntex
web framework. It's based on the helmet middleware for Node.js.
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
:
[dependencies]
ntex-helmet = "0.1"
Example
use ntex::web::{self, App, HttpResponse};
use ntex_helmet::Helmet;
#[ntex::main]
fn main() {
let app = App::new()
.wrap(Helmet::default())
.service(web::resource("/").to(|| HttpResponse::Ok()));
// ...
}
License
This project is licensed under the MIT license.
Dependencies
~15–27MB
~499K SLoC