Skip to content

Commit 3ef2de4

Browse files
committed
Restrict map tile url to https protocol
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
1 parent c741c4d commit 3ef2de4

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public function getPageTitle(): string
419419
/** Get the Content-Security-Policy header */
420420
private function getCspHeader(): string
421421
{
422-
$mapTileUrl = ' tile.openstreetmap.org';
422+
$mapTileUrl = ' https://tile.openstreetmap.org';
423423
$cspAllow = $this->config->config->CSPAllow === '' ? '' : ' ' . $this->config->config->CSPAllow;
424424
$captchaUrl =
425425
$this->config->config->CaptchaLoginPrivateKey === '' ||

tests/unit/HeaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public static function providerForTestGetHttpHeaders(): array
226226
'',
227227
'',
228228
"default-src 'self';"
229-
. " img-src 'self' data: tile.openstreetmap.org;"
229+
. " img-src 'self' data: https://tile.openstreetmap.org;"
230230
. " object-src 'none';"
231231
. " script-src 'self' 'unsafe-inline' 'unsafe-eval';"
232232
. " style-src 'self' 'unsafe-inline';"
@@ -239,7 +239,7 @@ public static function providerForTestGetHttpHeaders(): array
239239
'PublicKey',
240240
'captcha.tld csp.tld',
241241
"default-src 'self' captcha.tld csp.tld example.com example.net;"
242-
. " img-src 'self' data: captcha.tld csp.tld example.com example.net tile.openstreetmap.org;"
242+
. " img-src 'self' data: captcha.tld csp.tld example.com example.net https://tile.openstreetmap.org;"
243243
. " object-src 'none';"
244244
. " script-src 'self' 'unsafe-inline' 'unsafe-eval' captcha.tld csp.tld example.com example.net;"
245245
. " style-src 'self' 'unsafe-inline' captcha.tld csp.tld example.com example.net;"
@@ -252,7 +252,7 @@ public static function providerForTestGetHttpHeaders(): array
252252
'PublicKey',
253253
'captcha.tld csp.tld',
254254
"default-src 'self' captcha.tld csp.tld;"
255-
. " img-src 'self' data: captcha.tld csp.tld tile.openstreetmap.org;"
255+
. " img-src 'self' data: captcha.tld csp.tld https://tile.openstreetmap.org;"
256256
. " object-src 'none';"
257257
. " script-src 'self' 'unsafe-inline' 'unsafe-eval' captcha.tld csp.tld;"
258258
. " style-src 'self' 'unsafe-inline' captcha.tld csp.tld;",

0 commit comments

Comments
 (0)