[TASK] Add CSP nonce helper for inline styles in lit-element templates
When using Content-Security-Policy for `style-src` with a `nonce-...` value, it requires that inline styles (those using a `<style>` element) have to be granted with a corresponding `nonce="..."` attribute. Note: 'unsafe-inline' is ignored when using a nonce or hashes. This behavior is decribed in CSP L3 in section 6.7.3.2.:2.1 (https://w3c.github.io/webappsec-csp/#allow-all-inline) > If expression matches the nonce-source or hash-source grammar, > return "Does Not Allow". Even if `<style>` usages in lit-element templates are static in most cases, it is considered a "inline style" in the scope of CSP. This change introduces a work-around, exposing `window.litNonce` in the global JavaScript context. In case a malicous script manages to retrieve this information, it does not really matter, since the malicious script was already executed with a valid nonce before... Resolves: #100140 Releases: main Change-Id: I53c2967f2c80c0f862145a4c94d75a5fc1349205 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78231 Tested-by:core-ci <typo3@b13.com> Reviewed-by:
Benni Mack <benni@typo3.org> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by:
Andreas Fernandez <a.fernandez@scripting-base.de>
Showing
- Build/Sources/TypeScript/backend/element/table-wizard-element.ts 3 additions, 3 deletions...ources/TypeScript/backend/element/table-wizard-element.ts
- Build/Sources/TypeScript/core/lit-helper.ts 34 additions, 1 deletionBuild/Sources/TypeScript/core/lit-helper.ts
- Build/ckeditor5.rollup.config.js 6 additions, 0 deletionsBuild/ckeditor5.rollup.config.js
- Build/ckeditor5.rollup.functions.js 24 additions, 0 deletionsBuild/ckeditor5.rollup.functions.js
- typo3/sysext/backend/Resources/Public/JavaScript/element/table-wizard-element.js 3 additions, 3 deletions...sources/Public/JavaScript/element/table-wizard-element.js
- typo3/sysext/core/Classes/Page/PageRenderer.php 10 additions, 0 deletionstypo3/sysext/core/Classes/Page/PageRenderer.php
- typo3/sysext/core/Resources/Public/JavaScript/lit-helper.js 1 addition, 1 deletiontypo3/sysext/core/Resources/Public/JavaScript/lit-helper.js
- typo3/sysext/rte_ckeditor/Resources/Public/Contrib/ckeditor5-bundle.js 13 additions, 15 deletions...rte_ckeditor/Resources/Public/Contrib/ckeditor5-bundle.js
Please register or sign in to comment