Skip to content

Commit 0f72ad3

Browse files
committed
Merge branch 'develop' of github.corp.ebay.com:magento2/magento2ce into bugfixes
2 parents c180afb + 6a99883 commit 0f72ad3

File tree

124 files changed

+2393
-664
lines changed

Some content is hidden

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

124 files changed

+2393
-664
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ atlassian*
4747
/var/*
4848
!/var/.htaccess
4949
/vendor
50+
!/vendor/.htaccess

.htaccess

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,83 @@
171171
</IfModule>
172172

173173
###########################################
174-
## Deny access to release notes to prevent disclosure of the installed Magento version
174+
## Deny access to root files to hide sensitive application information
175+
RedirectMatch 404 /\.git
175176

176-
<Files RELEASE_NOTES.txt>
177-
Order allow,deny
178-
Deny from all
177+
<Files composer.json>
178+
order allow,deny
179+
deny from all
179180
</Files>
180-
############################################
181+
<Files composer.lock>
182+
order allow,deny
183+
deny from all
184+
</Files>
185+
<Files .gitignore>
186+
order allow,deny
187+
deny from all
188+
</Files>
189+
<Files .htaccess>
190+
order allow,deny
191+
deny from all
192+
</Files>
193+
<Files .htaccess.sample>
194+
order allow,deny
195+
deny from all
196+
</Files>
197+
<Files .php_cs>
198+
order allow,deny
199+
deny from all
200+
</Files>
201+
<Files .travis.yml>
202+
order allow,deny
203+
deny from all
204+
</Files>
205+
<Files CHANGELOG.md>
206+
order allow,deny
207+
deny from all
208+
</Files>
209+
<Files CONTRIBUTING.md>
210+
order allow,deny
211+
deny from all
212+
</Files>
213+
<Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
214+
order allow,deny
215+
deny from all
216+
</Files>
217+
<Files COPYING.txt>
218+
order allow,deny
219+
deny from all
220+
</Files>
221+
<Files Gruntfile.js>
222+
order allow,deny
223+
deny from all
224+
</Files>
225+
<Files LICENSE.txt>
226+
order allow,deny
227+
deny from all
228+
</Files>
229+
<Files LICENSE_AFL.txt>
230+
order allow,deny
231+
deny from all
232+
</Files>
233+
<Files nginx.conf.sample>
234+
order allow,deny
235+
deny from all
236+
</Files>
237+
<Files package.json>
238+
order allow,deny
239+
deny from all
240+
</Files>
241+
<Files php.ini.sample>
242+
order allow,deny
243+
deny from all
244+
</Files>
245+
<Files README.md>
246+
order allow,deny
247+
deny from all
248+
</Files>
249+
250+
################################
181251
## If running in cluster environment, uncomment this
182252
## http://developer.yahoo.com/performance/rules.html#etags
183253

.htaccess.sample

Lines changed: 79 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
############################################
3737
## adjust memory limit
3838

39-
php_value memory_limit 256M
39+
php_value memory_limit 768M
4040
php_value max_execution_time 18000
4141

4242
############################################
@@ -65,13 +65,6 @@
6565
SecFilterScanPOST Off
6666
</IfModule>
6767

68-
<IfModule mod_headers.c>
69-
############################################
70-
## prevent clickjacking
71-
72-
Header set X-Frame-Options SAMEORIGIN
73-
</IfModule>
74-
7568
<IfModule mod_deflate.c>
7669

7770
############################################
@@ -136,9 +129,11 @@
136129
RewriteRule .* - [L,R=405]
137130

138131
############################################
139-
## always send 404 on missing files in these folders
132+
## redirect for mobile user agents
140133

141-
RewriteCond %{REQUEST_URI} !^/pub/(media|js)/
134+
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
135+
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
136+
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
142137

143138
############################################
144139
## never rewrite for existing files, directories and links
@@ -175,16 +170,84 @@
175170
</IfModule>
176171

177172
###########################################
178-
## Deny access to release notes to prevent disclosure of the installed Magento version
173+
## Deny access to root files to hide sensitive application information
174+
RedirectMatch 404 /\.git
179175

180-
<Files RELEASE_NOTES.txt>
181-
Order allow,deny
182-
Deny from all
176+
<Files composer.json>
177+
order allow,deny
178+
deny from all
179+
</Files>
180+
<Files composer.lock>
181+
order allow,deny
182+
deny from all
183+
</Files>
184+
<Files .gitignore>
185+
order allow,deny
186+
deny from all
187+
</Files>
188+
<Files .htaccess>
189+
order allow,deny
190+
deny from all
191+
</Files>
192+
<Files .htaccess.sample>
193+
order allow,deny
194+
deny from all
195+
</Files>
196+
<Files .php_cs>
197+
order allow,deny
198+
deny from all
199+
</Files>
200+
<Files .travis.yml>
201+
order allow,deny
202+
deny from all
203+
</Files>
204+
<Files CHANGELOG.md>
205+
order allow,deny
206+
deny from all
207+
</Files>
208+
<Files CONTRIBUTING.md>
209+
order allow,deny
210+
deny from all
211+
</Files>
212+
<Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
213+
order allow,deny
214+
deny from all
215+
</Files>
216+
<Files COPYING.txt>
217+
order allow,deny
218+
deny from all
219+
</Files>
220+
<Files Gruntfile.js>
221+
order allow,deny
222+
deny from all
223+
</Files>
224+
<Files LICENSE.txt>
225+
order allow,deny
226+
deny from all
227+
</Files>
228+
<Files LICENSE_AFL.txt>
229+
order allow,deny
230+
deny from all
231+
</Files>
232+
<Files nginx.conf.sample>
233+
order allow,deny
234+
deny from all
235+
</Files>
236+
<Files package.json>
237+
order allow,deny
238+
deny from all
239+
</Files>
240+
<Files php.ini.sample>
241+
order allow,deny
242+
deny from all
243+
</Files>
244+
<Files README.md>
245+
order allow,deny
246+
deny from all
183247
</Files>
184248

185-
############################################
249+
################################
186250
## If running in cluster environment, uncomment this
187251
## http://developer.yahoo.com/performance/rules.html#etags
188252

189253
#FileETag none
190-

app/code/Magento/Backend/Block/Widget/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ public function setSaveParametersInSession($flag)
760760
*/
761761
public function getJsObjectName()
762762
{
763-
return $this->getId() . 'JsObject';
763+
return preg_replace("~[^a-z0-9_]*~i", '', $this->getId()) . 'JsObject';
764764
}
765765

766766
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function getColumn()
6767
*/
6868
protected function _getHtmlName()
6969
{
70-
return $this->getColumn()->getId();
70+
return $this->escapeHtml($this->getColumn()->getId());
7171
}
7272

7373
/**
@@ -77,7 +77,7 @@ protected function _getHtmlName()
7777
*/
7878
protected function _getHtmlId()
7979
{
80-
return $this->getColumn()->getHtmlId();
80+
return $this->escapeHtml($this->getColumn()->getHtmlId());
8181
}
8282

8383
/**
@@ -88,7 +88,7 @@ protected function _getHtmlId()
8888
*/
8989
public function getEscapedValue($index = null)
9090
{
91-
return htmlspecialchars((string)$this->getValue($index));
91+
return $this->escapeHtml((string)$this->getValue($index));
9292
}
9393

9494
/**
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\Unit\Block\Widget\Grid\Column\Filter;
8+
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
10+
11+
class TextTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/** @var \Magento\Backend\Block\Widget\Grid\Column\Filter\Text*/
14+
protected $block;
15+
16+
/** @var ObjectManagerHelper */
17+
protected $objectManagerHelper;
18+
19+
/** @var \Magento\Backend\Block\Context|\PHPUnit_Framework_MockObject_MockObject */
20+
protected $context;
21+
22+
/** @var \Magento\Framework\DB\Helper|\PHPUnit_Framework_MockObject_MockObject */
23+
protected $helper;
24+
25+
/** @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject */
26+
protected $escaper;
27+
28+
protected function setUp()
29+
{
30+
$this->context = $this->getMockBuilder('Magento\Backend\Block\Context')
31+
->setMethods(['getEscaper'])
32+
->disableOriginalConstructor()
33+
->getMock();
34+
$this->escaper = $this->getMock('Magento\Framework\Escaper', ['escapeHtml'], [], '', false);
35+
$this->helper = $this->getMock('Magento\Framework\DB\Helper', [], [], '', false);
36+
37+
$this->context->expects($this->once())->method('getEscaper')->willReturn($this->escaper);
38+
39+
$this->objectManagerHelper = new ObjectManagerHelper($this);
40+
$this->block = $this->objectManagerHelper->getObject(
41+
'Magento\Backend\Block\Widget\Grid\Column\Filter\Text',
42+
[
43+
'context' => $this->context,
44+
'resourceHelper' => $this->helper
45+
]
46+
);
47+
}
48+
49+
public function testGetHtml()
50+
{
51+
$resultHtml = '<input type="text" name="escapedHtml" ' .
52+
'id="escapedHtml" value="escapedHtml" ' .
53+
'class="input-text admin__control-text no-changes" data-ui-id="filter-escapedhtml" />';
54+
55+
$column = $this->getMockBuilder('Magento\Backend\Block\Widget\Grid\Column')
56+
->setMethods(['getId', 'getHtmlId'])
57+
->disableOriginalConstructor()
58+
->getMock();
59+
60+
$this->block->setColumn($column);
61+
62+
$this->escaper->expects($this->any())->method('escapeHtml')->willReturn('escapedHtml');
63+
$column->expects($this->any())->method('getId')->willReturn('id');
64+
$column->expects($this->once())->method('getHtmlId')->willReturn('htmlId');
65+
66+
$this->assertEquals($resultHtml, $this->block->getHtml());
67+
}
68+
}

0 commit comments

Comments
 (0)