app: add security headers middleware

X-Frame-Options: DENY and frame-ancestors 'none' stop clickjacking
of OIDC, register-confirm, and debug HTML pages. nosniff and no-referrer
are cheap defence-in-depth for the same surfaces.

Updates #3157
This commit is contained in:
Kristoffer Dalby 2026-04-17 05:50:09 +00:00
parent 5a7cafdf85
commit 0567cb6da3
3 changed files with 42 additions and 1 deletions

View file

@ -379,7 +379,7 @@ func (h *Headscale) debugHTTPServer() *http.Server {
debugHTTPServer := &http.Server{
Addr: h.cfg.MetricsAddr,
Handler: debugMux,
Handler: securityHeaders(debugMux),
ReadTimeout: types.HTTPTimeout,
WriteTimeout: 0,
}