#106567Backend login broken when applying recommended strict-dynamic CSP mutation
Description
TYPO3 12 introduces a GoogleMapsHelper PHP class that provides recommendations for configuring the Content Security Policy (CSP) when violations are detected in the backend module “Content Security Policy”.
Among the suggestions, the following mutation is recommended by TYPO3 to address issues related to Google Maps:
new Mutation(
MutationMode::Extend,
Directive::ScriptSrcElem,
SourceKeyword::strictDynamic, // requires(!) Nonce everywhere
SourceScheme::https, // thx Google!
SourceKeyword::unsafeEval, // thx Google!
SourceScheme::blob, // thx Google!
),
However, when applying this recommended mutation in TYPO3 13.4.9, the backend login becomes inaccessible. The browser (tested in Google Chrome) blocks required JavaScript files due to the presence of ‘strict-dynamic’ in the script-src-elem directive.
Here are excerpts of the error messages from the browser console:
Refused to load the script 'https://typo313.ddev.site/_assets/1ee1d3e909b58d32e30dcea666dd3224/JavaScript/Contrib/bootstrap.js?bust=1744616604' because it violates the following Content Security Policy directive: "script-src-elem 'self' 'nonce-aui6eSHIzC2VbdLGkCYA__eI24tsAGFdRv528lUt1VDu_OkIf_9YUQ' 'strict-dynamic' https: 'unsafe-eval' blob: 'report-sample'". Note that 'strict-dynamic' is present, so host-based allowlisting is disabled. Understand this error login:1 Refused to load the script 'https://typo313.ddev.site/_assets/081fa96a07de1dccb64a8a83e1567439/JavaScript/login.js?bust=1744616604' because it violates the following Content Security Policy directive: "script-src-elem 'self' 'nonce-aui6eSHIzC2VbdLGkCYA__eI24tsAGFdRv528lUt1VDu_OkIf_9YUQ' 'strict-dynamic' https: 'unsafe-eval' blob: 'report-sample'". Note that 'strict-dynamic' is present, so host-based allowlisting is disabled. Understand this error login:1 Refused to load the script 'https://typo313.ddev.site/_assets/081fa96a07de1dccb64a8a83e1567439/JavaScript/user-pass-login.js?bust=1744616604' because it violates the following Content Security Policy directive: "script-src-elem 'self' 'nonce-aui6eSHIzC2VbdLGkCYA__eI24tsAGFdRv528lUt1VDu_OkIf_9YUQ' 'strict-dynamic' https: 'unsafe-eval' blob: 'report-sample'". Note that 'strict-dynamic' is present, so host-based allowlisting is disabled.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] Backend login broken when applying recommended strict-dynamic CSP mutation Resolves: #106567 Releases: main