Skip to content

Commit

Permalink
Fix for ignored CPS_NONCE in ContentSecurity Header
Browse files Browse the repository at this point in the history
We should use 'cspNonceManager' for requesting the NONCE value, because it is doing the same as before, except that it honors a CPS_NONCE environment variable if available.

Signed-off-by: Holger Hees <holger.hees@gmail.com>
  • Loading branch information
HolgerHees authored Feb 14, 2024
1 parent 3fb1674 commit 5cf8647
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function afterController($controller, $methodName, Response $response): R
$defaultPolicy = $this->contentSecurityPolicyManager->mergePolicies($defaultPolicy, $policy);

if ($this->cspNonceManager->browserSupportsCspV3()) {
$defaultPolicy->useJsNonce($this->csrfTokenManager->getToken()->getEncryptedValue());
$defaultPolicy->useJsNonce($this->cspNonceManager->getNonce());
}

$response->setContentSecurityPolicy($defaultPolicy);
Expand Down

0 comments on commit 5cf8647

Please sign in to comment.