Skip to content

Commit 2f78c40

Browse files
author
Alexander Paliarush
committed
MAGETWO-45688: Reflected XSS in Cookie HTTP header
- Eliminated direct dependency on Zend\Escaper\Escaper, which caused functional tests failures
1 parent 445b590 commit 2f78c40

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/internal/Magento/Framework/Data/Form/FormKey.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ class FormKey
2323
protected $session;
2424

2525
/**
26-
* @var \Zend\Escaper\Escaper
26+
* @var \Magento\Framework\Escaper
2727
*/
2828
protected $escaper;
2929

3030
/**
3131
* @param \Magento\Framework\Math\Random $mathRandom
3232
* @param \Magento\Framework\Session\SessionManagerInterface $session
33-
* @param \Zend\Escaper\Escaper $escaper
33+
* @param \Magento\Framework\Escaper $escaper
3434
*/
3535
public function __construct(
3636
\Magento\Framework\Math\Random $mathRandom,
3737
\Magento\Framework\Session\SessionManagerInterface $session,
38-
\Zend\Escaper\Escaper $escaper
38+
\Magento\Framework\Escaper $escaper
3939
) {
4040
$this->mathRandom = $mathRandom;
4141
$this->session = $session;
@@ -52,7 +52,7 @@ public function getFormKey()
5252
if (!$this->isPresent()) {
5353
$this->set($this->mathRandom->getRandomString(16));
5454
}
55-
return $this->escaper->escapeHtmlAttr($this->session->getData(self::FORM_KEY));
55+
return $this->escaper->escapeHtml($this->session->getData(self::FORM_KEY));
5656
}
5757

5858
/**

lib/internal/Magento/Framework/Data/Test/Unit/Form/FormKeyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ protected function setUp()
3737
$this->mathRandomMock = $this->getMock('Magento\Framework\Math\Random', [], [], '', false);
3838
$methods = ['setData', 'getData'];
3939
$this->sessionMock = $this->getMock('Magento\Framework\Session\SessionManager', $methods, [], '', false);
40-
$this->escaperMock = $this->getMock('Zend\Escaper\Escaper', ['escapeHtmlAttr'], [], '', false);
41-
$this->escaperMock->expects($this->any())->method('escapeHtmlAttr')->willReturnArgument(0);
40+
$this->escaperMock = $this->getMock('Magento\Framework\Escaper', [], [], '', false);
41+
$this->escaperMock->expects($this->any())->method('escapeHtml')->willReturnArgument(0);
4242
$this->formKey = new FormKey(
4343
$this->mathRandomMock,
4444
$this->sessionMock,

0 commit comments

Comments
 (0)