Skip to content

Commit 11de202

Browse files
committed
fix: Fix CSP policy
1 parent a8f3029 commit 11de202

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

website/app/GeoKrety/Assets.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public function __construct(?Template $template = null) {
1313
$nonce = new \Delatbabel\ApiSecurity\Generators\Nonce();
1414
$nonce = $nonce->getNonce();
1515
$this->f3->set('NONCE', $nonce);
16+
$recaptchaHosts = 'https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/';
1617
if (\Multilang::instance()->current === 'inline-translation') {
1718
header(
1819
'Content-Security-Policy: '
@@ -23,6 +24,8 @@ public function __construct(?Template $template = null) {
2324
.sprintf('style-src-elem \'self\' \'unsafe-inline\' %s https://cdn.crowdin.com/jipt/jipt.css https://fonts.googleapis.com/css; ', GK_CDN_SERVER_URL)
2425
.'style-src-attr \'self\' \'unsafe-inline\'; '
2526
.sprintf('connect-src \'self\' %s https://crowdin.com/api/v2/jipt/cookie https://crowdin.com/api/v2/jipt/project/geokrety https://crowdin.com/api/v2/jipt/project/geokrety/strings; ', GK_MINIO_SERVER_URL_EXTERNAL)
27+
."worker-src 'self' blob: $recaptchaHosts; "
28+
."child-src 'self' blob: $recaptchaHosts; "
2629
);
2730

2831
return;
@@ -36,6 +39,8 @@ public function __construct(?Template $template = null) {
3639
.sprintf('style-src-elem \'self\' \'unsafe-inline\' %s; ', GK_CDN_SERVER_URL)
3740
.'style-src-attr \'self\' \'unsafe-inline\'; '
3841
.sprintf('connect-src \'self\' %s; ', GK_MINIO_SERVER_URL_EXTERNAL)
42+
."worker-src 'self' blob: $recaptchaHosts; "
43+
."child-src 'self' blob: $recaptchaHosts; "
3944
);
4045
}
4146

0 commit comments

Comments
 (0)