Skip to content

Commit 4e0dc62

Browse files
committed
Merge tag 'v19.4.10' into 20.0
2 parents f7b3c52 + f0b8bba commit 4e0dc62

File tree

45 files changed

+322
-114
lines changed

Some content is hidden

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

45 files changed

+322
-114
lines changed

.github/changelog/version_19.txt

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11

2-
3-
## v19.4.10 - unreleased
2+
## v19.4.11 - unreleased
3+
4+
## v19.4.10 - 2021-01-21
5+
6+
7+
3 security updates
8+
9+
GHSA-jrgf-vfw2-hj26 CMS Editor code execution
10+
GHSA-hj6w-xrv3-wjj9 Widget instances allows a hacker to inject an executable file on the server
11+
GHSA-99m6-r53j-4hh2 Layout XML RCE Vulnerability
12+
13+
More Changes:
14+
#1246 Adds support for "SameSite" cookie property
15+
#1356 Fixed return type of Mage_Adminhtml_Block_System_Config_Form::_canShowField
16+
#1275 Add start & stop commands to ddev setup in readme
17+
#1273 Update static-code-analyses.yml
18+
#1206 Reduced multiple dispatch events in login form.
19+
#1140 Github Action Labeler Bot
20+
#1337 Allow rewrite of Mage_Core_Model_File_Validator_Image
21+
#1086 Allow debug in admin
22+
#1378 Declare two variables
23+
#1330 Allow min pass length to 5 during login
24+
#1373 Removed 2 unneeded function calls. Local var is already there.
25+
#1390 Fix class name and filename for case sensitive filesystems
26+
#1336 Fix getId() on bool when primary billing address is null
27+
#1370 Fixed adminhtml boxes.css fieldset-wide for note.
28+
#1168 New event "adminhtml_sales_order_create_save_before" when editing an order.
29+
#1393 Fixes PHP7.4 deprecated nested ternary operators
30+
#1403 TypeError: round(): Argument #1 ($num) must be of type int|float
431

532
## v19.4.9 - 2020-12-29
633

@@ -259,4 +286,3 @@ Additionally:
259286

260287

261288
## before
262-
File renamed without changes.

.github/workflows/labeler.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77

88
name: Labeler
99
on:
10-
schedule:
11-
- cron: "0 * * * *"
10+
- pull_request_target
1211

1312
jobs:
14-
execute:
13+
triage:
1514
runs-on: ubuntu-latest
1615
steps:
17-
- uses: jpmcb/prow-github-actions@v1.0.0
16+
- uses: actions/labeler@main
1817
with:
19-
jobs: 'pr-labeler'
20-
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/static-code-analyses.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
max-parallel: 5
1313
matrix:
1414
operating-system: [ubuntu-latest]
15-
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4']
15+
php-versions: ['7.0', '7.4']
1616
steps:
1717
- uses: actions/checkout@v1
1818
- name: Setup PHP
@@ -39,7 +39,7 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
operating-system: [ubuntu-latest]
42-
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
42+
php-versions: ['7.0', '7.4', '8.0']
4343
steps:
4444
- uses: actions/checkout@v1
4545
- name: Setup PHP

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- name: Publish Unit Test Results
3737
uses: EnricoMi/publish-unit-test-result-action@v1.6
3838
if: always()
39+
continue-on-error: true
3940
with:
4041
github_token: ${{ secrets.GITHUB_TOKEN }}
4142
files: output/*.xml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ for more information.
8080
- Clone the repository as described in Installation -> Using Git
8181
- Create a ddev config using ```$ ddev config``` the defaults should be good for you
8282
- Open .ddev/config.yaml and change the php version to 7.2
83+
- Type ```$ ddev start``` to download and start the containers
8384
- Navigate to https://magento-lts.ddev.site
85+
- When you are done you can stop the test system by typing ```$ ddev stop```
8486

8587
## Removed Modules
8688

app/Mage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public static function getOpenMageVersionInfo()
215215
return array(
216216
'major' => '20',
217217
'minor' => '0',
218-
'patch' => '5',
218+
'patch' => '6',
219219
'stability' => '', // beta,alpha,rc
220220
'number' => '', // 1,2,3,0.3.7,x.7.z.92 @see https://semver.org/#spec-item-9
221221
);

app/code/core/Mage/Adminhtml/Block/System/Config/Form.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,14 +627,11 @@ protected function _canShowField($field)
627627

628628
switch ($this->getScope()) {
629629
case self::SCOPE_DEFAULT:
630-
return (int)$field->show_in_default;
631-
break;
630+
return (bool)$field->show_in_default;
632631
case self::SCOPE_WEBSITES:
633-
return (int)$field->show_in_website;
634-
break;
632+
return (bool)$field->show_in_website;
635633
case self::SCOPE_STORES:
636-
return (int)$field->show_in_store;
637-
break;
634+
return (bool)$field->show_in_store;
638635
}
639636
return true;
640637
}

app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,9 @@ public function createOrder()
15691569
if ($oldOrder->getId()) {
15701570
$oldOrder->setRelationChildId($order->getId());
15711571
$oldOrder->setRelationChildRealId($order->getIncrementId());
1572+
1573+
Mage::dispatchEvent('adminhtml_sales_order_create_save_before', ['new_order' => $order, 'old_order' => $oldOrder]);
1574+
15721575
$oldOrder->save();
15731576
$order->save();
15741577
}

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function _getAllowedExtensions()
5252
protected function addValidators(Mage_Core_Model_File_Uploader $uploader)
5353
{
5454
parent::addValidators($uploader);
55-
$validator = new Mage_Core_Model_File_Validator_Image();
55+
$validator = Mage::getModel('core/file_validator_image');
5656
$validator->setAllowedImageTypes($this->_getAllowedExtensions());
5757
$uploader->addValidateCallback(Mage_Core_Model_File_Validator_Image::NAME, $validator, 'validate');
5858
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
class Mage_Adminhtml_Model_System_Config_Source_Cookie_Samesite
4+
{
5+
/**
6+
* @return array[]
7+
*/
8+
public function toOptionArray(): array
9+
{
10+
return [
11+
['value' => 'None', 'label' => Mage::helper('adminhtml')->__('None')],
12+
['value' => 'Strict', 'label' => Mage::helper('adminhtml')->__('Strict')],
13+
['value' => 'Lax', 'label' => Mage::helper('adminhtml')->__('Lax')]
14+
];
15+
}
16+
}

app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Image.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
* @category Mage
3232
* @package Mage_Catalog
33-
* @author Magento Core Team <core@magentocommerce.com>
33+
* @author Magento Core Team <core@magentocommerce.com>
3434
*/
3535
class Mage_Catalog_Model_Category_Attribute_Backend_Image extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
3636
{
@@ -54,14 +54,11 @@ public function afterSave($object)
5454
$path = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS;
5555

5656
try {
57+
$validator = Mage::getModel('core/file_validator_image');
5758
$uploader = new Mage_Core_Model_File_Uploader($this->getAttribute()->getName());
5859
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
5960
$uploader->setAllowRenameFiles(true);
60-
$uploader->addValidateCallback(
61-
Mage_Core_Model_File_Validator_Image::NAME,
62-
new Mage_Core_Model_File_Validator_Image(),
63-
"validate"
64-
);
61+
$uploader->addValidateCallback(Mage_Core_Model_File_Validator_Image::NAME, $validator, 'validate');
6562
$result = $uploader->save($path);
6663

6764
$object->setData($this->getAttribute()->getName(), $result['file']);

app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Image.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
/**
2929
* Product image attribute backend
3030
*
31-
* @category Mage
32-
* @package Mage_Catalog
33-
* @author Magento Core Team <core@magentocommerce.com>
31+
* @category Mage
32+
* @package Mage_Catalog
33+
* @author Magento Core Team <core@magentocommerce.com>
3434
*/
3535
class Mage_Catalog_Model_Resource_Product_Attribute_Backend_Image extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
3636
{
@@ -52,15 +52,12 @@ public function afterSave($object)
5252
}
5353

5454
try {
55+
$validator = Mage::getModel('core/file_validator_image');
5556
$uploader = new Mage_Core_Model_File_Uploader($this->getAttribute()->getName());
5657
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
5758
$uploader->setAllowRenameFiles(true);
5859
$uploader->setFilesDispersion(true);
59-
$uploader->addValidateCallback(
60-
Mage_Core_Model_File_Validator_Image::NAME,
61-
new Mage_Core_Model_File_Validator_Image(),
62-
"validate"
63-
);
60+
$uploader->addValidateCallback(Mage_Core_Model_File_Validator_Image::NAME, $validator, 'validate');
6461
$uploader->save(Mage::getBaseDir('media') . '/catalog/product');
6562

6663
$fileName = $uploader->getUploadedFileName();

app/code/core/Mage/Core/Block/Abstract.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ public function unsetCallChild($alias, $callback, $result, $params)
536536
$params = $args;
537537
}
538538

539+
Mage::helper('core/security')->validateAgainstBlockMethodBlacklist($child, $callback, $params);
539540
if ($result == call_user_func_array(array(&$child, $callback), $params)) {
540541
$this->unsetChild($alias);
541542
}

app/code/core/Mage/Core/Block/Template.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@
3939
*/
4040
class Mage_Core_Block_Template extends Mage_Core_Block_Abstract
4141
{
42-
const XML_PATH_DEBUG_TEMPLATE_HINTS = 'dev/debug/template_hints';
43-
const XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS = 'dev/debug/template_hints_blocks';
44-
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink';
42+
const XML_PATH_DEBUG_TEMPLATE_HINTS_ADMIN = 'dev/debug/template_hints_admin';
43+
const XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS_ADMIN = 'dev/debug/template_hints_blocks_admin';
44+
const XML_PATH_DEBUG_TEMPLATE_HINTS = 'dev/debug/template_hints';
45+
const XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS = 'dev/debug/template_hints_blocks';
46+
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink';
4547

4648
/**
4749
* View scripts directory
@@ -61,6 +63,8 @@ class Mage_Core_Block_Template extends Mage_Core_Block_Abstract
6163

6264
protected $_jsUrl;
6365

66+
protected static $_showTemplateHintsAdmin;
67+
protected static $_showTemplateHintsBlocksAdmin;
6468
protected static $_showTemplateHints;
6569
protected static $_showTemplateHintsBlocks;
6670

@@ -185,6 +189,20 @@ public function getDirectOutput()
185189
return false;
186190
}
187191

192+
/**
193+
* @return bool
194+
*/
195+
public function getShowTemplateHintsAdmin()
196+
{
197+
if (is_null(self::$_showTemplateHintsAdmin)) {
198+
self::$_showTemplateHintsAdmin = Mage::getStoreConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS_ADMIN)
199+
&& Mage::helper('core')->isDevAllowed();
200+
self::$_showTemplateHintsBlocksAdmin = Mage::getStoreConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS_ADMIN)
201+
&& Mage::helper('core')->isDevAllowed();
202+
}
203+
return self::$_showTemplateHintsAdmin;
204+
}
205+
188206
/**
189207
* @return bool
190208
*/
@@ -214,17 +232,19 @@ public function fetchView($fileName)
214232
extract($this->_viewVars, EXTR_SKIP);
215233
$do = $this->getDirectOutput();
216234

235+
$hints = Mage::app()->getStore()->isAdmin() ? $this->getShowTemplateHintsAdmin() : $this->getShowTemplateHints();
236+
217237
if (!$do) {
218238
ob_start();
219239
}
220-
if ($this->getShowTemplateHints()) {
240+
if ($hints) {
221241
echo <<<HTML
222242
<div style="position:relative; border:1px dotted red; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;">
223243
<div style="position:absolute; left:0; top:0; padding:2px 5px; background:red; color:white; font:normal 11px Arial;
224244
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex='999'"
225245
onmouseout="this.style.zIndex='998'" title="{$fileName}">{$fileName}</div>
226246
HTML;
227-
if (self::$_showTemplateHintsBlocks) {
247+
if (Mage::app()->getStore()->isAdmin() ? self::$_showTemplateHintsBlocksAdmin : self::$_showTemplateHintsBlocks) {
228248
$thisClass = get_class($this);
229249
echo <<<HTML
230250
<div style="position:absolute; right:0; top:0; padding:2px 5px; background:red; color:blue; font:normal 11px Arial;
@@ -250,7 +270,7 @@ public function fetchView($fileName)
250270
throw $e;
251271
}
252272

253-
if ($this->getShowTemplateHints()) {
273+
if ($hints) {
254274
echo '</div>';
255275
}
256276

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
class Mage_Core_Helper_Security
4+
{
5+
6+
private $invalidBlockActions
7+
= [
8+
// explicitly not using class constant here Mage_Page_Block_Html_Topmenu_Renderer::class
9+
// if the class does not exists it breaks.
10+
['block' => Mage_Page_Block_Html_Topmenu_Renderer::class, 'method' => 'render'],
11+
['block' => Mage_Core_Block_Template::class, 'method' => 'fetchView'],
12+
];
13+
14+
/**
15+
* @param Mage_Core_Block_Abstract $block
16+
* @param string $method
17+
* @param string[] $args
18+
*
19+
* @throws Mage_Core_Exception
20+
*/
21+
public function validateAgainstBlockMethodBlacklist(Mage_Core_Block_Abstract $block, $method, array $args)
22+
{
23+
foreach ($this->invalidBlockActions as $action) {
24+
if ($block instanceof $action['block'] && strtolower($action['method']) === strtolower($method)) {
25+
Mage::throwException(
26+
sprintf('Action with combination block %s and method %s is forbidden.', get_class($block), $method)
27+
);
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)