-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from EC-CUBE/feat_twig_sandbox_4.2
[4.2]twig sandboxの設定を追加
- Loading branch information
Showing
4 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
parameters: | ||
level: 1 | ||
ignoreErrors: | ||
- | ||
message: "#^Function twig_include not found\\.$#" | ||
path: src/Eccube/Twig/Extension/IgnoreTwigSandboxErrorExtension.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of EC-CUBE | ||
* | ||
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
* | ||
* http://www.ec-cube.co.jp/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Eccube\Twig\Sandbox; | ||
|
||
use Twig\Sandbox\SecurityPolicy as BasePolicy; | ||
use Twig\Sandbox\SecurityPolicyInterface; | ||
|
||
class SecurityPolicyDecorator implements SecurityPolicyInterface { | ||
|
||
/** @var BasePolicy */ | ||
private $securityPolicy; | ||
|
||
public function __construct(BasePolicy $securityPolicy) | ||
{ | ||
$this->securityPolicy = $securityPolicy; | ||
} | ||
|
||
public function checkSecurity($tags, $filters, $functions) | ||
{ | ||
$this->securityPolicy->checkSecurity($tags, $filters, $functions); | ||
} | ||
|
||
public function checkMethodAllowed($obj, $method) | ||
{ | ||
// __toStringの場合はチェックをスキップする | ||
if ($method === '__toString') { | ||
return; | ||
} | ||
$this->securityPolicy->checkMethodAllowed($obj, $method); | ||
} | ||
|
||
public function checkPropertyAllowed($obj, $method) | ||
{ | ||
$this->securityPolicy->checkPropertyAllowed($obj, $method); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters