N°4129 - Security hardening

This commit is contained in:
Molkobain
2021-08-18 15:57:18 +02:00
parent 834ac00d37
commit 92a9a8c65f
3 changed files with 19 additions and 1 deletions

View File

@@ -1295,6 +1295,11 @@ class ObjectController extends AbstractController
$aHeaders['Content-Type'] = $oDocument->GetMimeType();
$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);
}