Send a Content-Security-Policy and security headers on every response #35

Merged
gnilebein merged 1 commits from feature/security-headers into main 2026-11-08 22:59:06 +01:00
Owner
  • New SecurityHeadersMiddleware (outermost): CSP with a per-request script
    nonce, framing (SAMEORIGIN, embeds via frame-ancestors), nosniff,
    Referrer- and Permissions-Policy. JSON, files and error pages are covered
    now, not only rendered HTML; headers set by controllers still win.
  • The inline theme script carries the nonce; flash messages are dismissed
    via data-dismiss instead of inline onclick handlers, and the flash
    elements share one template.
  • reCAPTCHA sources are only allowed when it is enabled.
  • The embed CSRF exception and framing use the same isEmbed() check.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

- New SecurityHeadersMiddleware (outermost): CSP with a per-request script nonce, framing (SAMEORIGIN, embeds via frame-ancestors), nosniff, Referrer- and Permissions-Policy. JSON, files and error pages are covered now, not only rendered HTML; headers set by controllers still win. - The inline theme script carries the nonce; flash messages are dismissed via data-dismiss instead of inline onclick handlers, and the flash elements share one template. - reCAPTCHA sources are only allowed when it is enabled. - The embed CSRF exception and framing use the same isEmbed() check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gnilebein added 1 commit 2026-11-08 22:58:58 +01:00
Send a Content-Security-Policy and security headers on every response
CI / Deploy / deploy (push) Skipped
CI / Deploy / test (push) Successful in 1m1s
2a53675ce5
- New SecurityHeadersMiddleware (outermost): CSP with a per-request script
  nonce, framing (SAMEORIGIN, embeds via frame-ancestors), nosniff,
  Referrer- and Permissions-Policy. JSON, files and error pages are covered
  now, not only rendered HTML; headers set by controllers still win.
- The inline theme script carries the nonce; flash messages are dismissed
  via data-dismiss instead of inline onclick handlers, and the flash
  elements share one template.
- reCAPTCHA sources are only allowed when it is enabled.
- The embed CSRF exception and framing use the same isEmbed() check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gnilebein merged commit d6ace26459 into main 2026-11-08 22:59:06 +01:00
gnilebein deleted branch feature/security-headers 2026-11-08 22:59:06 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gnilebein/Plenario#35