mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
N°4129 - Security hardening
This commit is contained in:
@@ -1161,6 +1161,14 @@ class Config
|
|||||||
'source_of_value' => '',
|
'source_of_value' => '',
|
||||||
'show_in_conf_sample' => false,
|
'show_in_conf_sample' => false,
|
||||||
),
|
),
|
||||||
|
'security.disable_inline_documents_sandbox' => array(
|
||||||
|
'type' => 'bool',
|
||||||
|
'description' => 'If true then the sandbox for documents displayed in a browser tab will be disabled; enabling scripts and other interactive content. Note that setting this to true will open the application to potential XSS attacks!',
|
||||||
|
'default' => false,
|
||||||
|
'value' => false,
|
||||||
|
'source_of_value' => '',
|
||||||
|
'show_in_conf_sample' => false,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public function IsProperty($sPropCode)
|
public function IsProperty($sPropCode)
|
||||||
|
|||||||
@@ -1295,6 +1295,11 @@ class ObjectController extends AbstractController
|
|||||||
$aHeaders['Content-Type'] = $oDocument->GetMimeType();
|
$aHeaders['Content-Type'] = $oDocument->GetMimeType();
|
||||||
$aHeaders['Content-Disposition'] = (($sOperation === 'display') ? 'inline' : 'attachment') . ';filename="'.$oDocument->GetFileName().'"';
|
$aHeaders['Content-Disposition'] = (($sOperation === 'display') ? 'inline' : 'attachment') . ';filename="'.$oDocument->GetFileName().'"';
|
||||||
|
|
||||||
|
// N°4129 - Prevent XSS attacks & other script executions
|
||||||
|
if (utils::GetConfig()->Get('security.disable_inline_documents_sandbox') === false) {
|
||||||
|
$aHeaders['Content-Security-Policy'] = 'sandbox';
|
||||||
|
}
|
||||||
|
|
||||||
return new Response($oDocument->GetData(), Response::HTTP_OK, $aHeaders);
|
return new Response($oDocument->GetData(), Response::HTTP_OK, $aHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -902,7 +902,12 @@ try
|
|||||||
$sField = utils::ReadParam('field', '');
|
$sField = utils::ReadParam('field', '');
|
||||||
if (!empty($sClass) && ($sClass != 'InlineImage') && !empty($id) && !empty($sField))
|
if (!empty($sClass) && ($sClass != 'InlineImage') && !empty($id) && !empty($sField))
|
||||||
{
|
{
|
||||||
$oPage->add_header('X-Frame-Options:'); // resets header, see N°3416
|
// Resets header, see N°3416
|
||||||
|
$oPage->add_header('X-Frame-Options:');
|
||||||
|
// N°4129 - Prevent XSS attacks & other script executions
|
||||||
|
if (utils::GetConfig()->Get('security.disable_inline_documents_sandbox') === false) {
|
||||||
|
$oPage->add_header('Content-Security-Policy: sandbox;');
|
||||||
|
}
|
||||||
ormDocument::DownloadDocument($oPage, $sClass, $id, $sField, 'inline');
|
ormDocument::DownloadDocument($oPage, $sClass, $id, $sField, 'inline');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user