-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Allow strict-dynamic only for applicable CSP directives
Using 'strict-dynamic' (SourceKeyword::strictDynamic) should only be allowed for script-src*[1] directives. Using it for any other directive produces strange side effects, since it implicitly adds a CSP nonce value to that directive when compiling the policy. Thus, this change + ensures 'strict-dynamic' is applicable for script-src* when using Policy::set, Policy::extend or the constructor + removes invalid policy purges when 'strict-dynamic' was used, since that was only valid for CSP level 3 - ignoring these directives is supposed to be handled by the browser[2], not by the server-side API, in order to preserve CSP v1/v2 BC. [1] https://w3c.github.io/webappsec-csp/#allow-all-inline > 'strict-dynamic' only applies to scripts, not other resource types. [2] https://w3c.github.io/webappsec-csp/#strict-dynamic-usage > 8.2. Usage of "'strict-dynamic'" > If present in a script-src or default-src directive, it has two > main effects: > * host-source and scheme-source expressions, as well as the > "'unsafe-inline'" and "'self' keyword-sources will be ignored > when loading script. Resolves: #101460 Releases: main, 12.4 Change-Id: I95f696b92b60efef42367c2536b93b855a52522d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80207 Reviewed-by: Oliver Hader <oliver.hader@typo3.org> Tested-by: core-ci <typo3@b13.com> Tested-by: Benjamin Franzke <ben@bnf.dev> Reviewed-by: Benjamin Franzke <ben@bnf.dev>
- Loading branch information
Showing
3 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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