Skip to content

fix: replace deprecated useNonce asset option with csp#19

Merged
konradmichalik merged 1 commit into
mainfrom
feature/asset-css-csp-option
Jun 19, 2026
Merged

fix: replace deprecated useNonce asset option with csp#19
konradmichalik merged 1 commit into
mainfrom
feature/asset-css-csp-option

Conversation

@konradmichalik

Copy link
Copy Markdown
Contributor

Summary

  • Replace the deprecated `useNonce` asset option with `csp` in the CSS asset ViewHelper, removing the TYPO3 v14 deprecation warning "The option key "useNonce" for assets is deprecated, use "csp" instead." (raised by `AssetRenderer`), which is slated for removal in v15.
  • Add a dedicated `csp` ViewHelper argument matching the TYPO3 core CSS asset ViewHelper.
  • Keep `useNonce` as a deprecated, backward-compatible argument that maps onto `csp` (since it was already shipped in 2.0.0), to be removed in 3.0.0.

Changes

  • `Classes/ViewHelpers/Asset/CssViewHelper.php`
    • New `csp` argument (bool, default `null`).
    • `useNonce` argument kept but marked `@deprecated` (default changed to `null` to detect explicit use); maps to `csp` only when explicitly set.
    • Asset `$options` now pass `csp` instead of the deprecated `useNonce` key to `addStyleSheet()`/`addInlineStyleSheet()`.

Notes

  • CSP/nonce behaviour is unchanged; existing `useNonce="…"` calls keep working.
  • composer constraints and ext_emconf untouched.
  • No analogous ScriptViewHelper exists yet — same mapping should be applied if one is added later.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6bba38ee-370f-4fb0-b696-3317ad4aeb9b

📥 Commits

Reviewing files that changed from the base of the PR and between 7f89f88 and 5ecae80.

📒 Files selected for processing (1)
  • Classes/ViewHelpers/Asset/CssViewHelper.php
 ________________________________________________________________________________________________________________________________
< Test state coverage, not code coverage. Identify and test significant program states. Just testing lines of code isn't enough. >
 --------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/asset-css-csp-option

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@konradmichalik
konradmichalik requested a review from Mainbird June 18, 2026 11:16
@konradmichalik
konradmichalik merged commit d046c37 into main Jun 19, 2026
2 checks passed
@Mainbird
Mainbird deleted the feature/asset-css-csp-option branch June 22, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants