Skip to content
Snippets Groups Projects
Commit 93b7b68a authored by Thomas Hohn's avatar Thomas Hohn Committed by Benni Mack
Browse files

[BUGFIX] Undefined array key "contentSecurityPolicies"

If the 'contentSecurityPolicies' value is not filled properly
in the site configuration, the call to
$site->getConfiguration()['contentSecurityPolicies'] will fail.
The access should we guarded with a null coalescing operator.

Resolves: #104873
Releases: main, 12.4
Change-Id: Ie49a25d8ca9a194629c4a389b17b299091d44031
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85977


Reviewed-by: default avatarGarvin Hicking <gh@faktor-e.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarGarvin Hicking <gh@faktor-e.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 0696b6e0
Branches
Tags
No related merge requests found
......@@ -114,7 +114,7 @@ final class MutationRepository
$scopedTarget = $this->provideScopeInMap($scope, $this->resolvedMutations);
// fetch site-specific `enforce` and/or `report` disposition configuration
$dispositionMap = $this->dispositionMapFactory->buildDispositionMap(
$site->getConfiguration()['contentSecurityPolicies']
$site->getConfiguration()['contentSecurityPolicies'] ?? []
);
/**
* @var Disposition $disposition
......
......@@ -51,7 +51,7 @@ final readonly class ContentSecurityPolicyHeaders implements MiddlewareInterface
{
$site = $request->getAttribute('site');
$dispositionMap = $this->dispositionMapFactory->buildDispositionMap(
$site instanceof Site ? $site->getConfiguration()['contentSecurityPolicies'] : []
$site instanceof Site ? ($site->getConfiguration()['contentSecurityPolicies'] ?? []) : []
);
// return early in case CSP shall not be used
if ($dispositionMap->keys() === []) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment