Change for insecure images over http

See https://github.com/the-djmaze/snappymail/issues/16#issuecomment-707962963
This commit is contained in:
djmaze 2020-10-15 13:01:14 +02:00
parent 0528bcf911
commit 0dc093b35b
2 changed files with 2 additions and 1 deletions

View file

@ -44,6 +44,7 @@ class Service
$sContentSecurityPolicy = \trim($this->oActions->Config()->Get('security', 'content_security_policy', '')) ?: APP_DEFAULT_CSP;
if ($this->oActions->Config()->Get('security', 'use_local_proxy_for_external_images', '')) {
$sContentSecurityPolicy = preg_replace('/(img-src[^;]+)\\shttps:(\\s|;|$)/D', '$1$2', $sContentSecurityPolicy);
$sContentSecurityPolicy = preg_replace('/(img-src[^;]+)\\shttp:(\\s|;|$)/D', '$1$2', $sContentSecurityPolicy);
}
\header('Content-Security-Policy: '.$sContentSecurityPolicy, true);