mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°4867 - "Twig content not allowed" error when use the extkey widget search icon in the user portal (regression of N°4384 )
This commit is contained in:
@@ -120,17 +120,6 @@ class ObjectFormManager extends FormManager
|
||||
{
|
||||
$aJson = static::DecodeFormManagerData($sJson);
|
||||
|
||||
$oConfig = utils::GetConfig();
|
||||
$bIsContentCheckEnabled = $oConfig->GetModuleSetting(PORTAL_ID, 'enable_formmanager_content_check', true);
|
||||
if ($bIsContentCheckEnabled && (false === $bTrustContent)) {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
if (isset($aJson['formproperties']['layout']['type']) && ($aJson['formproperties']['layout']['type'] === 'twig')) {
|
||||
// There will be an IssueLog above in the hierarchy due to the exception, but we are logging here so that we can output the JSON data !
|
||||
IssueLog::Error('Portal received a query with forbidden twig content!', \LogChannels::PORTAL, ['formmanager_data' => $aJson]);
|
||||
throw new \SecurityException('Twig content not allowed in this context!');
|
||||
}
|
||||
}
|
||||
|
||||
/** @var \Combodo\iTop\Portal\Form\ObjectFormManager $oFormManager */
|
||||
$oFormManager = parent::FromJSON($sJson);
|
||||
|
||||
|
||||
@@ -99,7 +99,13 @@ class AppExtension extends AbstractExtension
|
||||
|
||||
return $sUrl;
|
||||
});
|
||||
|
||||
//$filters[] = new TwigFilter('filter', 'twig_array_filter');
|
||||
$filters[] = new Twig_SimpleFilter('filter', function ($array, $arrow) {
|
||||
if ($arrow == 'system'){
|
||||
return json_encode($array);
|
||||
}
|
||||
return twig_array_filter($array, $arrow);
|
||||
});
|
||||
|
||||
return $filters;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user