From 2302ce917997e532c1db5b913d5820383156ac26 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Tue, 17 Mar 2026 11:58:46 +0200 Subject: [PATCH] appview/state: serve security.txt at /.well-known/ Signed-off-by: Anirudh Oppiliappan --- appview/state/router.go | 1 + appview/state/state.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/appview/state/router.go b/appview/state/router.go index c5a2fbc3..a76271ac 100644 --- a/appview/state/router.go +++ b/appview/state/router.go @@ -34,6 +34,7 @@ func (s *State) Router() http.Handler { router.Get("/pwa-manifest.json", s.WebAppManifest) router.Get("/robots.txt", s.RobotsTxt) + router.Get("/.well-known/security.txt", s.SecurityTxt) userRouter := s.UserRouter(&middleware) standardRouter := s.StandardRouter(&middleware) diff --git a/appview/state/state.go b/appview/state/state.go index 2395abe6..d22eb3e0 100644 --- a/appview/state/state.go +++ b/appview/state/state.go @@ -226,6 +226,18 @@ func (s *State) Close() error { return s.db.Close() } +func (s *State) SecurityTxt(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.Header().Set("Cache-Control", "public, max-age=86400") // one day + + securityTxt := `Contact: mailto:security@tangled.org +Preferred-Languages: en +Canonical: https://tangled.org/.well-known/security.txt +Expires: 2030-01-01T21:59:00.000Z +` + w.Write([]byte(securityTxt)) +} + func (s *State) RobotsTxt(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") w.Header().Set("Cache-Control", "public, max-age=86400") // one day -- 2.51.2