Summary
Tighten the Content Security Policy and remove unsafe-inline/unsafe-eval to strengthen XSS protection.
Current State
- CSP is set in
pkg/middleware/security.go
- Currently allows
'unsafe-inline' for styles and 'unsafe-eval' + 'unsafe-inline' for scripts
- This significantly weakens XSS protection
Tasks
Why
unsafe-inline and unsafe-eval in CSP effectively disable XSS protection. Tightening CSP is a high-impact security hardening step.
Summary
Tighten the Content Security Policy and remove
unsafe-inline/unsafe-evalto strengthen XSS protection.Current State
pkg/middleware/security.go'unsafe-inline'for styles and'unsafe-eval'+'unsafe-inline'for scriptsTasks
'unsafe-eval'fromscript-src(refactor frontend if needed)'unsafe-inline'inscript-srcwith nonce-based CSPform-action 'self'directivebase-uri 'self'directiveupgrade-insecure-requestswhen TLS is activereport-uriorreport-tofor CSP violation monitoringWhy
unsafe-inlineandunsafe-evalin CSP effectively disable XSS protection. Tightening CSP is a high-impact security hardening step.