Skip to content

Commit

Permalink
add security.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Dec 31, 2023
1 parent 52e01d0 commit 4843bec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions assets/security.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Contact: https://ezrizhu.com/contact
Expires: 2025-01-01T05:00:00.000Z
Canonical: https://ezrizhu.com/security.txt
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod feed;
mod webring;
mod pgp;
mod ssh;
mod security;

async fn health() -> Html<String> {
Html(String::from("OK"))
Expand Down Expand Up @@ -99,6 +100,7 @@ async fn main() {
.route("/blog.atom", get(feed::blog_atom::get))
.route("/.well-known/openpgpkey/hu/policy", get(pgp::policy))
.route("/.well-known/openpgpkey/hu/15asjmkpucio5m8a7xznzcxqsqigumxt", get(pgp::pubkey))
.route("/.well-known/security.txt", get(security::securitytxt))
.route("/ssh", get(ssh::sshpub))
.fallback(site::not_found::not_found)
.with_state(state);
Expand Down
12 changes: 12 additions & 0 deletions src/security.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use std::fs;
use axum::{
http::HeaderMap,
};

pub async fn securitytxt() -> (HeaderMap, String) {
let mut resp_header = HeaderMap::new();
resp_header.insert("Content-Type", "text/plain".parse().unwrap());
resp_header.insert("Access-Control-Allow-Origin", "*".parse().unwrap());
let securitytxt = fs::read_to_string("assets/security.txt").unwrap();
(resp_header, securitytxt)
}

0 comments on commit 4843bec

Please sign in to comment.