-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #3893 Add SourcePolicyInterface to selectively enable the San…
…dbox based on a template's Source (YSaxon) This PR was squashed before being merged into the 2.x branch. Discussion ---------- Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source This is needed to patch some downstream vulnerabilities which I won't describe here. I wrote `@fabpot` an email about this with more details a few weeks ago. Generally the Sandbox can be enabled for a given template in either of two ways: * Globally * Including the template from another template in which we use the sandbox tag or parameter This pull request adds a third way * Using a SourcePolicy to selectively sandbox templates based on their Source object Commits ------- a18da16 Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source
- Loading branch information
Showing
4 changed files
with
85 additions
and
12 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
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,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Twig\Sandbox; | ||
|
||
use Twig\Source; | ||
|
||
/** | ||
* Interface for a class that can optionally enable the sandbox mode based on a template's Twig\Source. | ||
* | ||
* @author Yaakov Saxon | ||
*/ | ||
interface SourcePolicyInterface | ||
{ | ||
public function enableSandbox(Source $source): bool; | ||
} |
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