Skip to content

Commit 0d432f6

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into DEVOPS-2174
2 parents 43193de + c33674d commit 0d432f6

File tree

1,117 files changed

+9471
-2314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,117 files changed

+9471
-2314
lines changed

.htaccess

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,15 @@
355355
Require all denied
356356
</IfVersion>
357357
</Files>
358+
<Files auth.json>
359+
<IfVersion < 2.4>
360+
order allow,deny
361+
deny from all
362+
</IfVersion>
363+
<IfVersion >= 2.4>
364+
Require all denied
365+
</IfVersion>
366+
</Files>
358367

359368
# For 404s and 403s that aren't handled by the application, show plain 404 response
360369
ErrorDocument 404 /pub/errors/404.php

.htaccess.sample

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,15 @@
332332
Require all denied
333333
</IfVersion>
334334
</Files>
335+
<Files auth.json>
336+
<IfVersion < 2.4>
337+
order allow,deny
338+
deny from all
339+
</IfVersion>
340+
<IfVersion >= 2.4>
341+
Require all denied
342+
</IfVersion>
343+
</Files>
335344

336345
# For 404s and 403s that aren't handled by the application, show plain 404 response
337346
ErrorDocument 404 /pub/errors/404.php

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.3-develop)](https://travis-ci.org/magento/magento2)
2+
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
23
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
34
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
45
<h2>Welcome</h2>

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function getHtml()
127127

128128
/**
129129
* @param string|null $index
130-
* @return string
130+
* @return array|string|int|float|null
131131
*/
132132
public function getEscapedValue($index = null)
133133
{
@@ -138,6 +138,11 @@ public function getEscapedValue($index = null)
138138
$this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT)
139139
);
140140
}
141+
142+
if (is_string($value)) {
143+
return $this->escapeHtml($value);
144+
}
145+
141146
return $value;
142147
}
143148

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public function getHtml()
140140
/**
141141
* Return escaped value for calendar
142142
*
143-
* @param string $index
144-
* @return string
143+
* @param string|null $index
144+
* @return array|string|int|float|null
145145
*/
146146
public function getEscapedValue($index = null)
147147
{
@@ -150,6 +150,11 @@ public function getEscapedValue($index = null)
150150
if ($value instanceof \DateTimeInterface) {
151151
return $this->_localeDate->formatDateTime($value);
152152
}
153+
154+
if (is_string($value)) {
155+
return $this->escapeHtml($value);
156+
}
157+
153158
return $value;
154159
}
155160

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/DateTest.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ class DateTest extends \PHPUnit\Framework\TestCase
3030
/** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject */
3131
protected $localeDateMock;
3232

33+
/** @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject */
34+
private $escaperMock;
35+
36+
/** @var \Magento\Backend\Block\Context|\PHPUnit_Framework_MockObject_MockObject */
37+
private $contextMock;
38+
3339
protected function setUp()
3440
{
3541
$this->mathRandomMock = $this->getMockBuilder(\Magento\Framework\Math\Random::class)
@@ -58,14 +64,26 @@ protected function setUp()
5864
->setMethods([])
5965
->getMock();
6066

67+
$this->escaperMock = $this->getMockBuilder(\Magento\Framework\Escaper::class)
68+
->disableOriginalConstructor()
69+
->getMock();
70+
71+
$this->contextMock = $this->getMockBuilder(\Magento\Backend\Block\Context::class)
72+
->disableOriginalConstructor()
73+
->getMock();
74+
75+
$this->contextMock->expects($this->once())->method('getEscaper')->willReturn($this->escaperMock);
76+
$this->contextMock->expects($this->once())->method('getLocaleDate')->willReturn($this->localeDateMock);
77+
6178
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
6279
$this->model = $objectManagerHelper->getObject(
6380
\Magento\Backend\Block\Widget\Grid\Column\Filter\Date::class,
6481
[
6582
'mathRandom' => $this->mathRandomMock,
6683
'localeResolver' => $this->localeResolverMock,
6784
'dateTimeFormatter' => $this->dateTimeFormatterMock,
68-
'localeDate' => $this->localeDateMock
85+
'localeDate' => $this->localeDateMock,
86+
'context' => $this->contextMock,
6987
]
7088
);
7189
$this->model->setColumn($this->columnMock);
@@ -98,4 +116,16 @@ public function testGetHtmlSuccessfulTimestamp()
98116
$this->assertContains('id="' . $uniqueHash . '_from" value="' . $yesterday->getTimestamp(), $output);
99117
$this->assertContains('id="' . $uniqueHash . '_to" value="' . $tomorrow->getTimestamp(), $output);
100118
}
119+
120+
public function testGetEscapedValueEscapeString()
121+
{
122+
$value = "\"><img src=x onerror=alert(2) />";
123+
$array = [
124+
'orig_from' => $value,
125+
'from' => $value,
126+
];
127+
$this->model->setValue($array);
128+
$this->escaperMock->expects($this->once())->method('escapeHtml')->with($value);
129+
$this->model->getEscapedValue('from');
130+
}
101131
}

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/DatetimeTest.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ class DatetimeTest extends \PHPUnit\Framework\TestCase
3030
/** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject */
3131
protected $localeDateMock;
3232

33+
/** @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject */
34+
private $escaperMock;
35+
36+
/** @var \Magento\Backend\Block\Context|\PHPUnit_Framework_MockObject_MockObject */
37+
private $contextMock;
38+
3339
protected function setUp()
3440
{
3541
$this->mathRandomMock = $this->getMockBuilder(\Magento\Framework\Math\Random::class)
@@ -50,22 +56,34 @@ protected function setUp()
5056

5157
$this->columnMock = $this->getMockBuilder(\Magento\Backend\Block\Widget\Grid\Column::class)
5258
->disableOriginalConstructor()
53-
->setMethods(['getTimezone', 'getHtmlId', 'getId'])
59+
->setMethods(['getTimezone', 'getHtmlId', 'getId', 'getFilterTime'])
5460
->getMock();
5561

5662
$this->localeDateMock = $this->getMockBuilder(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class)
5763
->disableOriginalConstructor()
5864
->setMethods([])
5965
->getMock();
6066

67+
$this->escaperMock = $this->getMockBuilder(\Magento\Framework\Escaper::class)
68+
->disableOriginalConstructor()
69+
->getMock();
70+
71+
$this->contextMock = $this->getMockBuilder(\Magento\Backend\Block\Context::class)
72+
->disableOriginalConstructor()
73+
->getMock();
74+
75+
$this->contextMock->expects($this->once())->method('getEscaper')->willReturn($this->escaperMock);
76+
$this->contextMock->expects($this->once())->method('getLocaleDate')->willReturn($this->localeDateMock);
77+
6178
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
6279
$this->model = $objectManagerHelper->getObject(
6380
\Magento\Backend\Block\Widget\Grid\Column\Filter\Datetime::class,
6481
[
6582
'mathRandom' => $this->mathRandomMock,
6683
'localeResolver' => $this->localeResolverMock,
6784
'dateTimeFormatter' => $this->dateTimeFormatterMock,
68-
'localeDate' => $this->localeDateMock
85+
'localeDate' => $this->localeDateMock,
86+
'context' => $this->contextMock,
6987
]
7088
);
7189
$this->model->setColumn($this->columnMock);
@@ -98,4 +116,17 @@ public function testGetHtmlSuccessfulTimestamp()
98116
$this->assertContains('id="' . $uniqueHash . '_from" value="' . $yesterday->getTimestamp(), $output);
99117
$this->assertContains('id="' . $uniqueHash . '_to" value="' . $tomorrow->getTimestamp(), $output);
100118
}
119+
120+
public function testGetEscapedValueEscapeString()
121+
{
122+
$value = "\"><img src=x onerror=alert(2) />";
123+
$array = [
124+
'orig_from' => $value,
125+
'from' => $value,
126+
];
127+
$this->model->setValue($array);
128+
$this->escaperMock->expects($this->once())->method('escapeHtml')->with($value);
129+
$this->columnMock->expects($this->once())->method('getFilterTime')->willReturn(true);
130+
$this->model->getEscapedValue('from');
131+
}
101132
}

app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88

99
?>
1010
<?php if ($block->getBugreportUrl()): ?>
11-
<a class="link-report" href="<?= /* @escapeNotVerified */ $block->getBugreportUrl() ?>" id="footer_bug_tracking"><?= /* @escapeNotVerified */ __('Report an Issue') ?></a>
11+
<a class="link-report" href="<?= /* @escapeNotVerified */ $block->getBugreportUrl() ?>" id="footer_bug_tracking" target="_blank">
12+
<?= /* @escapeNotVerified */ __('Report an Issue') ?>
13+
</a>
1214
<?php endif; ?>

app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
class Create extends \Magento\Backup\Controller\Adminhtml\Index
1313
{
1414
/**
15-
* Create backup action
15+
* Create backup action.
1616
*
1717
* @return void|\Magento\Backend\App\Action
1818
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
1919
*/
2020
public function execute()
2121
{
22-
if (!$this->getRequest()->isAjax()) {
22+
if (!$this->isRequestAllowed()) {
2323
return $this->_redirect('*/*/index');
2424
}
2525

@@ -106,4 +106,14 @@ public function execute()
106106

107107
$this->getResponse()->representJson($response->toJson());
108108
}
109+
110+
/**
111+
* Check if request is allowed.
112+
*
113+
* @return bool
114+
*/
115+
private function isRequestAllowed()
116+
{
117+
return $this->getRequest()->isAjax() && $this->getRequest()->isPost();
118+
}
109119
}

0 commit comments

Comments
 (0)