Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,199 of 9,199 pages
About the help in other languages
All help pages

From report-only to an enforced CSP

A staged plan for public bodies to move the Content Security Policy of the administration, and later of public siteaccesses, from report-only to enforce - template audit, collecting reports, one siteaccess first…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/government/security/csp-from-report-only-to-enforce.md

On this page

From report-only to an enforced CSP

This page is for administrators and developers who turn the Content Security Policy from a reporting tool into a protection. Enforcing is a decision per siteaccess, made after an audit; the project's step-by-step procedure is in Switching to enforce, step by step. This page turns it into a plan with milestones that fits a public body's change process.

Contents

  1. Phase 1: Audit the templates
  2. Phase 2: Collect real reports
  3. Phase 3: Enforce one siteaccess
  4. Phase 4: Enforce the administration
  5. Phase 5: Public siteaccesses
  6. Rollback
  7. Related pages

Phase 1: Audit the templates

Run the project's test with every extension of the installation, as the administration renders them:

CSP_ALL_EXTENSIONS=1 php vendor/bin/phpunit tests/tests/design/AdminContentSecurityPolicyTest.php

Each failure line is a template with inline code that an enforced policy would break. Fix extensions in their own repositories: scripts into files loaded with ezscript, values into data-* attributes, handlers into listeners, menu items into data-menu-*.

Milestone: the list of remaining findings, each with an owner.

Phase 2: Collect real reports

Point reports at the site's own collector, in the administration siteaccess's site.ini.append.php:

[ContentSecurityPolicy]
ReportEndpoint=enabled

Clear the INI cache (php bin/php/ezcache.php --clear-tag=ini) and reload PHP (restart Velocity). Use the administration for a few days: every extension's pages, the editors, dialogs and context menus (handler attributes are reported only when they run). Read Setup > Log files > "Content Security Policy reports" (csp.log).

Milestone: no report for the pages your staff use, or a decision for each source.

Phase 3: Enforce one siteaccess

Enforce a second administration siteaccess that only the web team uses, with the same designs and extensions:

# settings/siteaccess/<test admin siteaccess>/site.ini.append.php
[ContentSecurityPolicy]
Mode=enforce
ReportEndpoint=enabled

Work in it for a week. Where something must stay, loosen only that directive for that siteaccess, for example with AdditionalSources[]=script-src https://maps.example.org or, for TinyMCE 3, 'unsafe-inline' in script-src and style-src.

Milestone: a week of normal work without breakage.

Phase 4: Enforce the administration

Set Mode=enforce on the main administration siteaccess, clear the INI cache, reload PHP-FPM and restart Velocity (./console exp:velocity deploy --allow-root-user does all of it). Classic designs (ReportOnlyDesigns[]) stay report-only for users who pick them. Keep ReportEndpoint=enabled and read the reports weekly.

Phase 5: Public siteaccesses

Public designs and rich text output (styles from content, embedded players) are not checked by the project's test. Start each public siteaccess with Mode=report-only and ReportEndpoint=enabled, fix your design, add the hosts of embeds you keep, and enforce when the reports are quiet. A stricter companion can measure the next step: ReportOnlyDirectives[style-src]='self' beside an enforced policy that still allows inline styles.

Rollback

Set Mode=report-only in the siteaccess, clear the INI cache, reload PHP-FPM and restart Velocity. Nothing else changes (Enforcing: rollback). Write the rollback into your change request before you enforce.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x