Feature: Content Security Policy rules
See also
This entry records what changed. The policy itself, what it costs, what is deliberately not requested and how to relax or drop it are documented in Content Security Policy.
Description
The extension now declares the Content Security Policy sources its frontend
editing surface needs, in
Configuration/. Nothing has to be enabled for
it: TYPO3 picks the file up automatically for every installation that has
frontend CSP switched on, and installations that have not are unaffected.
Frontend CSP is off by default in TYPO3 v13 and v14. A site enables it either with a feature flag:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['security.frontend.enforceContentSecurityPolicy'] = true;
or, without any feature flag, per site:
enforce: true
What is declared
Four directives, each granting only the site's own origin:
| Directive | Needed for |
|---|---|
script- | The editing module, loaded through the TYPO3 import map. |
style- | The stylesheet of the editing surface. |
connect- | The fetch requests to the editing endpoints. |
img- | Profile images, served from the file storage. |
Nothing is loaded from an external origin, and no directive that would weaken a
policy is requested — in particular no 'unsafe-, no
'unsafe-, and no data: or blob: image sources.
Under the policy TYPO3 itself ships for the frontend, these four add almost
nothing to the emitted header, because they permit what default- already permits. They matter on an installation that narrows
default-, where they are what keeps the editing surface working.
Switching it off or changing it
To keep the policy of every other extension but drop this one, name the composer
package in the site's csp.:
enforce:
packages:
'*': true
sbuerk/modern-extbase-frontend-edit: false
To disable Content Security Policy for a site entirely:
active: false
Warning
inherit is not a way to drop only this extension.
It removes the frontend rules of every package, including the
default- that TYPO3 itself declares, and a site using it
has to grant the four sources above by hand or the editing surface stops
working.
The full set of options — reporting, per site mutations, and the
csp. format — is described in the TYPO3 documentation:
Content Security Policy.