Skip to content

[8.4-stable] feat(csp): send a Content Security Policy with admin responses - #4238

Merged
tvdeyen merged 1 commit into
8.4-stablefrom
backport/8.4-stable/pr-4236
Sep 8, 2026
Merged

[8.4-stable] feat(csp): send a Content Security Policy with admin responses#4238
tvdeyen merged 1 commit into
8.4-stablefrom
backport/8.4-stable/pr-4236

Conversation

@alchemycms-bot

@alchemycms-bot alchemycms-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

Backport

This will backport the following commits from main to 8.4-stable:

Questions ?

Please refer to the Backport tool documentation

Alchemy now sends a Content Security Policy with its own admin
responses, so a mistake that renders content unescaped stays a display
bug instead of becoming script execution in an editor's session.

It is on by default, for new installations and for upgrading
applications alike, because the admin surface Alchemy ships works under
it entirely. The option is documented in the configuration template, so
it reaches existing applications through alchemy:upgrade:config, and the
upgrader raises a todo pointing at it for the rare application that does
have inline scripts in admin views of its own.

The policy is built by a configurable class. Alchemy fills in the host
dependent sources from what it already knows: the asset host, the
preview hosts the page editor loads into an iframe, admin stylesheets
served from another host, and modules pinned to a CDN. Anything beyond
that is a subclass away.

It only applies to Alchemy's own controllers, never to host application
controllers inheriting from the admin base class, and it is skipped
entirely when the host has configured a policy of its own.

The csp-nonce meta tag is added unconditionally because Turbo reads the
nonce from it to authorize the style element it injects for the progress
bar. It renders nothing when no policy is configured.

(cherry picked from commit f0c2ff9)
@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.37%. Comparing base (aff639a) to head (6255c85).
⚠️ Report is 2 commits behind head on 8.4-stable.

Additional details and impacted files
@@              Coverage Diff               @@
##           8.4-stable    #4238      +/-   ##
==============================================
+ Coverage       98.36%   98.37%   +0.01%     
==============================================
  Files             360      361       +1     
  Lines            9580     9644      +64     
==============================================
+ Hits             9423     9487      +64     
  Misses            157      157              
Flag Coverage Δ
mariadb 96.97% <100.00%> (+0.02%) ⬆️
mysql 95.86% <100.00%> (+0.02%) ⬆️
postgresql 95.86% <100.00%> (+0.02%) ⬆️
sqlite 95.86% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen added the security Security related label Sep 8, 2026
@tvdeyen
tvdeyen merged commit 8bb1ca7 into 8.4-stable Sep 8, 2026
26 checks passed
@tvdeyen
tvdeyen deleted the backport/8.4-stable/pr-4236 branch September 8, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant