diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index 13a0515328e349e5ac1a0a71482d2d6a14367b8c..251b9205bba230905f6911bbef93e9d05af0346f 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -113,6 +113,7 @@ public function onRespond(FilterResponseEvent $event) { // XSS and other vulnerabilities. // https://www.owasp.org/index.php/List_of_useful_HTTP_headers $response->headers->set('X-Content-Type-Options', 'nosniff', FALSE); + $response->headers->set('X-Frame-Options', 'SAMEORIGIN', FALSE); // Expose the cache contexts and cache tags associated with this page in a // X-Drupal-Cache-Contexts and X-Drupal-Cache-Tags header respectively. diff --git a/core/modules/system/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php index 209336c2c0a93226178412922c9e0ff874060355..8fbc3f0a5fcd030362225dafea1f67a05acca516 100644 --- a/core/modules/system/src/Tests/Routing/RouterTest.php +++ b/core/modules/system/src/Tests/Routing/RouterTest.php @@ -40,7 +40,7 @@ public function testFinishResponseSubscriber() { $this->assertEqual($headers['x-ua-compatible'], 'IE=edge'); $this->assertEqual($headers['content-language'], 'en'); $this->assertEqual($headers['x-content-type-options'], 'nosniff'); - + $this->assertEqual($headers['x-frame-options'], 'SAMEORIGIN'); $this->drupalGet('router_test/test2'); $this->assertRaw('test2', 'The correct string was returned because the route was successful.');