EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Image fix
Yurii205a8f02d6bc
diff --git a/application/Espo/EntryPoints/Image.php b/application/Espo/EntryPoints/Image.phpindex f2edfee252..0295f7c59b 100644--- a/application/Espo/EntryPoints/Image.php+++ b/application/Espo/EntryPoints/Image.php@@ -48,7 +48,6 @@ use Espo\Core\Utils\Metadata;use Espo\Entities\Attachment;use GdImage;-use RuntimeException;use Throwable;class Image implements EntryPoint@@ -152,10 +151,13 @@ class Image implements EntryPoint$fileName = str_replace("\"", "\\\"", $fileName ?? '');+ $csp = "default-src 'none'; script-src 'none'; object-src 'none'; form-action 'none'; " .+ "style-src 'unsafe-inline'; sandbox;";+$response->setHeader('Content-Disposition', 'inline;filename="' . $fileName . '"')->setHeader('Content-Length', (string) $fileSize)- ->setHeader('Content-Security-Policy', "default-src 'self'; script-src 'none'; object-src 'none';");+ ->setHeader('Content-Security-Policy', $csp);if (!$noCacheHeaders) {$response->setHeader('Cache-Control', 'private, max-age=864000, immutable');