Send a Content-Security-Policy and security headers on every response
- 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>
This commit is contained in:
1 parent
6912d045cf
commit
2a53675ce5
15 files changed
+290
-66
No files matched your search
@@ -86,7 +86,7 @@ class EmbedTest extends TestCase
|
||||
$this->assertResponseContains('Wie <geht> es?');
|
||||
$this->assertResponseContains('data-embed');
|
||||
$this->assertResponseNotContains($token);
|
||||
$this->assertHeader('Content-Security-Policy', 'frame-ancestors *');
|
||||
$this->assertHeaderContains('Content-Security-Policy', 'frame-ancestors *');
|
||||
$this->assertNull($this->_response->getHeaderLine('X-Frame-Options') ?: null);
|
||||
$this->assertHeader('Referrer-Policy', 'no-referrer');
|
||||
$this->assertNull($this->reload($poll)->current_slide_id, 'viewing alone does not go live');
|
||||
|
||||
Reference in new issue
Block a user