Review main Abandoned

92739[BUGFIX] Allow nonce usage in CSP for style-src-elem

Torben Hansen CR 0 V 0 Normal +74 −67 updated 02/10/26, 09:54

Commit message

The `ErrorPageController` uses a Fluid template to render
a template for the general error page. This template
contains inline CSS to add styling to the error page.
When the default CSP is active, the CSS is not processed
by the web browser because the default CSP does not
allow inline CSS.

With this patch, the default CSP is extended to
allow `style-src-elem` when a valid nonce is provided.
In addition, the `ErrorPageController` now uses a
nonce to include the inline CSS for the error page.

Review

  • Code review CR 0
  • Verified V 0
    • core-ci +1 CI

Issues 1

Files 3

Review log 710

  1. Torben Hansen uploaded patch set 1 02/07/26, 14:18

  2. core-ci voted on patch set 1 V -1 02/07/26, 14:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95382

  3. Torben Hansen uploaded patch set 2 V -1 02/07/26, 18:00

  4. core-ci voted on patch set 2 V +1 02/07/26, 18:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95384

  5. Torben Hansen uploaded patch set 3 V +1 02/07/26, 18:15

  6. core-ci voted on patch set 3 V +1 02/07/26, 18:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95385

  7. Oliver Hader commented on patch set 3 02/09/26, 19:19

    I'd opt for avoiding to change to global CSP configuration for the frontend. Instead, I would * inject `\TYPO3\CMS\Core\Security\ContentSecurityPolicy\PolicyRegistry $policyRegistry` to the `ErrorPageController` constructor * dynamically apply the mutation there, e.g. ``` $this->policyRegistry->appendMutationCollection( new MutationCollection( new Mutation( MutationMode::Extend, Directive::StyleSrcElem, SourceKeyword::nonceProxy ) ) ); ```
  8. Oliver Hader commented on patch set 3 02/09/26, 19:21

    Reply Unresolved

    However, I was was not able to find CSP headers when the `ErrorPageController` was used on accessing a non-existing page in the frontend. The `PageResolver` middleware is executed before the `ContentSecurityPolicyHeaders` middleware.
  9. Oliver Hader commented on patch set 3 02/09/26, 23:08

    Unresolved

    I've created an alternative approach, that provides a generic approach for applying CSP to the `ErrorController`, not just for the underlying `ErrorPageController`. → https://review.typo3.org/c/Packages/TYPO3.CMS/+/92760
  10. Torben Hansen abandoned the change 02/10/26, 09:54