package middleware import ( "github.com/labstack/echo/v5" ) // SecurityHeadersMiddleware adds security headers to all responses func SecurityHeadersMiddleware() echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c *echo.Context) error { // Add security headers c.Response().Header().Set("X-Content-Type-Options", "nosniff") c.Response().Header().Set("X-Frame-Options", "DENY") c.Response().Header().Set("X-XSS-Protection", "1; mode=block") c.Response().Header().Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload") // script-src notes: 'unsafe-inline' is required by the pre-paint // theme flash guard (inline