Skip to content

Commit

Permalink
Backport fixes from 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed May 29, 2021
1 parent baa41ac commit 167b592
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions modules/cms/controllers/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ protected function makeExportFormWidget($theme)

public function index_onLoadImportForm()
{
if (\Cms\Helpers\Cms::safeModeEnabled()) {
throw new ApplicationException(trans('cms::lang.cms_object.safe_mode_enabled'));
}

$theme = $this->findThemeObject();
$this->vars['widget'] = $this->makeImportFormWidget($theme);
$this->vars['themeDir'] = $theme->getDirName();
Expand All @@ -274,6 +278,10 @@ public function index_onLoadImportForm()

public function index_onImport()
{
if (\Cms\Helpers\Cms::safeModeEnabled()) {
throw new ApplicationException(trans('cms::lang.cms_object.safe_mode_enabled'));
}

$theme = $this->findThemeObject();
$widget = $this->makeImportFormWidget($theme);

Expand Down
8 changes: 6 additions & 2 deletions modules/system/twig/SecurityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ final class SecurityPolicy implements SecurityPolicyInterface
* @var array List of forbidden methods.
*/
protected $blockedMethods = [
// \October\Rain\Extension\ExtendableTrait
// Prevent manipulating Twig itself
'getTwig',

// Prevent dynamic methods and props
'addDynamicMethod',
'addDynamicProperty',

// \October\Rain\Support\Traits\Emitter
// Prevent binding event logic
'bindEvent',
'bindEventOnce',

// Eloquent & Halcyon data modification
'insert',
'update',
'delete',
'write',
];

/**
Expand Down

0 comments on commit 167b592

Please sign in to comment.