Skip to content

Commit a0afd3b

Browse files
Merge pull request from GHSA-c9q3-r4rv-mjm7
Co-authored-by: Fabrizio Balliano <[email protected]>
1 parent 8980f5e commit a0afd3b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

app/code/core/Mage/Core/Helper/Security.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public function validateAgainstBlockMethodBlacklist(Mage_Core_Block_Abstract $bl
4343
{
4444
foreach ($this->invalidBlockActions as $action) {
4545
$calledMethod = strtolower($method);
46-
if (($block instanceof $action['block'] && strtolower($action['method']) === $calledMethod)
47-
|| ($block instanceof $action['block']
48-
&& strtolower($action['block'] . '::' . $action['method']) === $calledMethod)
49-
) {
46+
if (str_contains($calledMethod, '::')) {
47+
$calledMethod = explode('::', $calledMethod)[1];
48+
}
49+
if ($block instanceof $action['block'] && strtolower($action['method']) === $calledMethod) {
5050
Mage::throwException(
5151
sprintf('Action with combination block %s and method %s is forbidden.', get_class($block), $method)
5252
);

dev/tests/unit/Mage/Core/Helper/Security.php

+10
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,21 @@ public function forbiddenBlockMethodsDataProvider()
6565
'Mage_Core_Block_Template::fetchView',
6666
[]
6767
],
68+
[
69+
$topmenu,
70+
'Mage_Page_Block_Html_Topmenu_Renderer::fetchView',
71+
[]
72+
],
6873
'parent class name is passed as second arg' => [
6974
$topmenu,
7075
'Mage_Core_Block_Template::fetchView',
7176
[]
7277
],
78+
'parent class name is passed as second arg2' => [
79+
$topmenu,
80+
'Mage_Core_Block_Template::render',
81+
[]
82+
],
7383
];
7484
}
7585

0 commit comments

Comments
 (0)