Skip to content

Commit

Permalink
Merge pull request from GHSA-c9q3-r4rv-mjm7
Browse files Browse the repository at this point in the history
Co-authored-by: Fabrizio Balliano <fabrizio.balliano@gmail.com>
  • Loading branch information
mark-netalico and fballiano authored Jan 26, 2023
1 parent d16fc6c commit 289bd4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/code/core/Mage/Core/Helper/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public function validateAgainstBlockMethodBlacklist(Mage_Core_Block_Abstract $bl
{
foreach ($this->invalidBlockActions as $action) {
$calledMethod = strtolower($method);
if (($block instanceof $action['block'] && strtolower($action['method']) === $calledMethod)
|| ($block instanceof $action['block']
&& strtolower($action['block'] . '::' . $action['method']) === $calledMethod)
) {
if (str_contains($calledMethod, '::')) {
$calledMethod = explode('::', $calledMethod)[1];
}
if ($block instanceof $action['block'] && strtolower($action['method']) === $calledMethod) {
Mage::throwException(
sprintf('Action with combination block %s and method %s is forbidden.', get_class($block), $method)
);
Expand Down
10 changes: 10 additions & 0 deletions dev/tests/unit/Mage/Core/Helper/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,21 @@ public function forbiddenBlockMethodsDataProvider()
'Mage_Core_Block_Template::fetchView',
[]
],
[
$topmenu,
'Mage_Page_Block_Html_Topmenu_Renderer::fetchView',
[]
],
'parent class name is passed as second arg' => [
$topmenu,
'Mage_Core_Block_Template::fetchView',
[]
],
'parent class name is passed as second arg2' => [
$topmenu,
'Mage_Core_Block_Template::render',
[]
],
];
}

Expand Down

2 comments on commit 289bd4b

@xqiu
Copy link

@xqiu xqiu commented on 289bd4b Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str_contains function is php8 only function, openmage supposed to support php7.3+, this check in should be changed

@kiatng
Copy link
Contributor

@kiatng kiatng commented on 289bd4b Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing functions are handled by polyfill, see PR #2946. So, all is good.

Please sign in to comment.