Security headers middleware: CSP, Referrer-Policy, nosniff (#59) #76

Merged
poslop merged 1 commits from issue-59-security-headers into main 2026-09-09 14:26:01 +00:00
Owner

Adds web.SecurityHeaders middleware (issue #59):

  • Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; frame-ancestors 'none' (page scripts are inline)
  • Referrer-Policy: no-referrer
  • X-Content-Type-Options: nosniff

Applied to all rendered HTML responses (page templates + inline can page); /api and /raw pass through unchanged. Closes #59.

Adds `web.SecurityHeaders` middleware (issue #59): - Content-Security-Policy: `default-src 'self'; script-src 'self' 'unsafe-inline'; frame-ancestors 'none'` (page scripts are inline) - Referrer-Policy: no-referrer - X-Content-Type-Options: nosniff Applied to all rendered HTML responses (page templates + inline can page); `/api` and `/raw` pass through unchanged. Closes #59.
poslop added 1 commit 2026-09-09 14:16:58 +00:00
security headers middleware: CSP, Referrer-Policy, nosniff on HTML pages (#59)
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 30s
e08cafe9c8
- web.SecurityHeaders middleware wired into the chi router
- Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' (page scripts are inline); frame-ancestors 'none'
- Referrer-Policy: no-referrer, X-Content-Type-Options: nosniff
- Applied only to text/html responses; JSON API and /raw pass through unchanged
- Regression test internal/web/securityheaders_test.go
poslop merged commit 44fe3c5772 into main 2026-09-09 14:26:01 +00:00
Sign in to join this conversation.