Created
May 11, 2023 09:38
-
-
Save astehlik/8105e17bd237448003f344345b0b398d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Classes/Page/PageRenderer.php 2023-05-11 10:41:55.206722544 +0200 | |
+++ Classes/Page/PageRenderer.php 2023-05-11 10:34:43.011841844 +0200 | |
@@ -2145,7 +2145,7 @@ | |
if ($this->getApplicationType() === 'BE') { | |
$this->javaScriptRenderer->addGlobalAssignment(['TYPO3' => $assignments]); | |
} else { | |
- // @todo apply nonce for CSP (means dropping static `inlineJavascriptWrap`) | |
+ $attributes = $this->nonce !== null ? ['nonce' => $this->nonce->consume()] : []; | |
$out .= $this->wrapInlineScript( | |
sprintf( | |
"var TYPO3 = Object.assign(TYPO3 || {}, %s);\r\n", | |
@@ -2155,7 +2155,8 @@ | |
. "!['__proto__', 'prototype', 'constructor'].includes(entry[0])))", | |
json_encode($assignments) | |
) | |
- ) | |
+ ), | |
+ $attributes | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment