Skip to content

Commit e3916b2

Browse files
committed
fix: add enforced Content-Security-Policy header to override Cloudflare's report-only connect-src 'none'
1 parent 4ebbcee commit e3916b2

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

internal/middleware/security.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func SecurityHeaders(next http.Handler) http.Handler {
2222
w.Header().Set("X-DNS-Prefetch-Control", "off")
2323
w.Header().Set("Permissions-Policy", "camera=(), microphone=(), geolocation=()")
2424
w.Header().Set("Referrer-Policy", "strict-origin-when-cross-origin")
25+
w.Header().Set("Content-Security-Policy", "default-src 'self'; script-src 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net https://unpkg.com; style-src 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' https://img.zero-host.org data:; font-src 'self' https://fonts.gstatic.com; connect-src 'self' https://cap.zero-host.org; frame-src blob:; worker-src blob:; base-uri 'self'; form-action 'self'")
2526
next.ServeHTTP(w, r)
2627
})
2728
}

0 commit comments

Comments
 (0)