diff --git a/main.go b/main.go index fcee75e..365c5e6 100644 --- a/main.go +++ b/main.go @@ -125,13 +125,15 @@ func main() { }, })) - // Global headers (from GotHub) + // Global HTTP headers server.Use(func(c *fiber.Ctx) error { c.Set("X-Frame-Options", "SAMEORIGIN") - c.Set("X-XSS-Protection", "1; mode=block") c.Set("X-Content-Type-Options", "nosniff") c.Set("Referrer-Policy", "no-referrer") c.Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload") + // -- Allowing inline styles may be simpler and avoid breakage, but you lose a lot of the protection that CSP provides + // src: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles + c.Set("Content-Security-Policy", "default-src 'none'; script-src 'self' 'sha256-hyWmaJx4D/wwnSlHuylUcUEAHy4waDmxU5jgvi3ilCs='; style-src 'self' 'unsafe-inline'; img-src 'self' https:; connect-src 'self'; frame-ancestors 'self'; object-src 'none'") return c.Next() }) diff --git a/views/layout.jet.html b/views/layout.jet.html index c6366d6..58cb3ce 100644 --- a/views/layout.jet.html +++ b/views/layout.jet.html @@ -7,8 +7,6 @@ - -