Skip to content

Commit f1f9e26

Browse files
committed
MAGETWO-81484: [FG-VD-17-116] Magento Community Edition Denial of Service Vulnerability Notification
1 parent 0f61d2d commit f1f9e26

File tree

7 files changed

+15
-22
lines changed

7 files changed

+15
-22
lines changed

app/code/Magento/Checkout/Block/Cart/Shipping.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public function getJsLayout()
7474
foreach ($this->layoutProcessors as $processor) {
7575
$this->jsLayout = $processor->process($this->jsLayout);
7676
}
77-
return $this->serializer->serialize($this->jsLayout);
77+
78+
return json_encode($this->jsLayout, JSON_HEX_TAG);
7879
}
7980

8081
/**
@@ -94,6 +95,6 @@ public function getBaseUrl()
9495
*/
9596
public function getSerializedCheckoutConfig()
9697
{
97-
return $this->serializer->serialize($this->getCheckoutConfig());
98+
return json_encode($this->getCheckoutConfig(), JSON_HEX_TAG);
9899
}
99100
}

app/code/Magento/Checkout/Block/Cart/Totals.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public function getJsLayout()
6969
foreach ($this->layoutProcessors as $processor) {
7070
$this->jsLayout = $processor->process($this->jsLayout);
7171
}
72-
return parent::getJsLayout();
72+
73+
return json_encode($this->jsLayout, JSON_HEX_TAG);
7374
}
7475

7576
/**

app/code/Magento/Checkout/Block/Onepage.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public function getJsLayout()
7777
foreach ($this->layoutProcessors as $processor) {
7878
$this->jsLayout = $processor->process($this->jsLayout);
7979
}
80-
return $this->serializer->serialize($this->jsLayout);
80+
81+
return json_encode($this->jsLayout, JSON_HEX_TAG);
8182
}
8283

8384
/**
@@ -119,6 +120,6 @@ public function getBaseUrl()
119120
*/
120121
public function getSerializedCheckoutConfig()
121122
{
122-
return $this->serializer->serialize($this->getCheckoutConfig());
123+
return json_encode($this->getCheckoutConfig(), JSON_HEX_TAG);
123124
}
124125
}

app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ public function testGetJsLayout()
9999
->with($this->layout)
100100
->willReturn($layoutProcessed);
101101

102-
$this->serializer->expects($this->once())->method('serialize')->will(
103-
$this->returnValue($jsonLayoutProcessed)
104-
);
105102
$this->assertEquals(
106103
$jsonLayoutProcessed,
107104
$this->model->getJsLayout()
@@ -121,9 +118,6 @@ public function testGetSerializedCheckoutConfig()
121118
{
122119
$checkoutConfig = ['checkout', 'config'];
123120
$this->configProvider->expects($this->once())->method('getConfig')->willReturn($checkoutConfig);
124-
$this->serializer->expects($this->once())->method('serialize')->will(
125-
$this->returnValue(json_encode($checkoutConfig))
126-
);
127121

128122
$this->assertEquals(json_encode($checkoutConfig), $this->model->getSerializedCheckoutConfig());
129123
}

app/code/Magento/Checkout/Test/Unit/Block/OnepageTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ public function testGetJsLayout()
9393
$processedLayout = ['layout' => ['processed' => true]];
9494
$jsonLayout = '{"layout":{"processed":true}}';
9595
$this->layoutProcessorMock->expects($this->once())->method('process')->with([])->willReturn($processedLayout);
96-
$this->serializer->expects($this->once())->method('serialize')->will(
97-
$this->returnValue(json_encode($processedLayout))
98-
);
9996

10097
$this->assertEquals($jsonLayout, $this->model->getJsLayout());
10198
}
@@ -104,9 +101,6 @@ public function testGetSerializedCheckoutConfig()
104101
{
105102
$checkoutConfig = ['checkout', 'config'];
106103
$this->configProviderMock->expects($this->once())->method('getConfig')->willReturn($checkoutConfig);
107-
$this->serializer->expects($this->once())->method('serialize')->will(
108-
$this->returnValue(json_encode($checkoutConfig))
109-
);
110104

111105
$this->assertEquals(json_encode($checkoutConfig), $this->model->getSerializedCheckoutConfig());
112106
}

app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ public function getDocumentElement()
8080
*/
8181
public function appendLayoutConfiguration()
8282
{
83-
$layoutConfiguration = $this->wrapContent(json_encode($this->structure->generate($this->component)));
83+
$layoutConfiguration = $this->wrapContent(
84+
json_encode($this->structure->generate($this->component), JSON_HEX_TAG)
85+
);
8486
$this->template->append($layoutConfiguration);
8587
}
8688

dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/NewsletterTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ public function testRenderingNewsletterBlock()
6565
$this->dispatch('backend/customer/index/edit');
6666
$body = $this->getResponse()->getBody();
6767

68-
$this->assertContains('<span>Newsletter Information<\/span>', $body);
69-
$this->assertContains('<input id=\"_newslettersubscription\"', $body);
68+
$this->assertContains('\u003Cspan\u003ENewsletter Information\u003C\/span\u003E', $body);
69+
$this->assertContains('\u003Cinput id=\"_newslettersubscription\"', $body);
7070
$this->assertNotContains('checked="checked"', $body);
71-
$this->assertContains('<span>Subscribed to Newsletter<\/span>', $body);
72-
$this->assertContains('>No Newsletter Found<', $body);
71+
$this->assertContains('\u003Cspan\u003ESubscribed to Newsletter\u003C\/span\u003E', $body);
72+
$this->assertContains('\u003ENo Newsletter Found\u003C', $body);
7373
}
7474
}

0 commit comments

Comments
 (0)