Skip to content

Commit 2aa4989

Browse files
author
Dale Sikkema
committed
MAGETWO-16192: Security: Clickjacking solution - introduce X-Frame-Options
- add unit test
1 parent f0da50c commit 2aa4989

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/internal/Magento/Framework/App/Response/Http.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public function __construct(
5959
*
6060
* @param string $value
6161
* @return void
62-
* @codeCoverageIgnore
6362
*/
6463
public function setXFrameOptions($value)
6564
{

lib/internal/Magento/Framework/App/Response/XFrameOptPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
/**
1010
* Adds an X-FRAME-OPTIONS header to HTTP responses to safeguard against click-jacking.
11-
* @codeCoverageIgnore
1211
*/
1312
class XFrameOptPlugin
1413
{
@@ -35,6 +34,7 @@ public function __construct($xFrameOpt)
3534
/**
3635
* @param \Magento\Framework\App\Response\Http $subject
3736
* @return void
37+
* @codeCoverageIgnore
3838
*/
3939
public function beforeSendResponse(\Magento\Framework\App\Response\Http $subject)
4040
{

lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,11 @@ public function testWakeUpWith()
271271
\Magento\Framework\App\ObjectManager::setInstance($objectManagerMock);
272272
$this->model->__wakeup();
273273
}
274+
275+
public function testSetXFrameOptions()
276+
{
277+
$value = 'SAMEORIGIN';
278+
$this->model->setXFrameOptions($value);
279+
$this->assertSame($value, $this->model->getHeader(Http::HEADER_X_FRAME_OPT)->getFieldValue());
280+
}
274281
}

0 commit comments

Comments
 (0)