How to Roll Out CSP: What to Check in Report-Only Before Enforcement
Before enforcing a Content Security Policy, you need to understand which restrictions will affect working product flows. Content-Security-Policy-Report-Only lets you observe violations without blocking under the policy being tested. The team's task is to check not just the messages, but also report delivery, response headers, network dependencies and how scripts are allowed. Below is a testing sequence for your own test environment using fictional data.
Define the boundary the policy tests
Report-Only shows violations of the policy being tested but does not enforce it by blocking. A working interface therefore does not mean the restrictions are ready to enforce: a flow can complete successfully while also generating violation messages. Check both outcomes: product behavior and CSP observations.
Separate two decisions: which sources and connections the application intends to trust, and how it handles untrusted input. CSP complements input sanitization; it does not replace it. An absence of messages cannot confirm protection against XSS or justify skipping checks of how user data is handled.
Check headers and report delivery
Deliver the policy through an HTTP response header. Testing should cover all request responses, not just the main document. List the responses involved in your selected flows and compare the headers actually received with the expected configuration. Fix any gaps before assessing whether the policy is ready.
Report-Only violations appear in the console, while report-to and report-uri are used to send reports to an endpoint. The report-to value must reference an endpoint name from the Reporting-Endpoints header. Check this link and verify that reports actually arrive: including the directive in the configuration alone is not enough to verify delivery.
For backward compatibility, OWASP recommends including both reporting directives. Browsers that support report-to use it and ignore report-uri. Record separately in your test plan which reporting configuration you tested and what results you obtained.
Review network dependencies using a fictional example
Imagine a fictional service called Draft that a team is testing in its own environment. It loads a document list through fetch and updates statuses through WebSocket. All documents and accounts in this example are test data. The team opens the list, changes a status and matches these actions to Report-Only messages.
For these dependencies, check connect-src: this directive governs fetch, XHR, EventSource, beacon and WebSocket connections. If an action produces a violation, determine whether the corresponding connection is an intended product dependency. Then fix the address in the application or adjust the policy permissions according to the agreed trust decision.
Do not automatically allow every address found in a report. For each change, record the dependency's purpose, the affected flow and the reason for allowing it. This review helps prepare specific changes instead of expanding the policy without a clear rationale.
Check nonces, hashes and page embedding
If the policy uses a nonce, its value must differ for every HTTP response and be unpredictable. Compare values across several responses and check how they are generated. Observing that values change is not enough to conclude that they are unpredictable. Fix any reuse or predictable generation you find before enforcing the policy.
If external scripts are allowed by hash, also check that their markup includes the integrity attribute: it is required for this method. Review the markup alongside the header so that the assessment covers more than the server configuration.
Consider page embedding requirements separately. default-src does not replace frame-ancestors: this directive does not fall back to the default-src value. If the product needs embedding restrictions, set them explicitly through frame-ancestors.
Prepare a safe test and a remediation sequence
Run the checks in an environment you own, using test data. List user actions, expected connections and responses to be checked in advance. After each change, repeat the relevant flow, inspect the console and verify report receipt. This provides a clear link between the rule, the observation and the fix.
First, close gaps in observation: missing headers and report delivery problems. Then review violations in required flows, check nonces and inspect external script markup. Keep embedding restrictions and untrusted input handling as separate items. Assign an owner to each item and record the retest result.
Move to enforcement with clear limitations
The basis for moving to enforcement should be a review of the selected flows and fixes, rather than simply a quiet console. Record exactly what was tested and what remained outside the scope. Results from a limited test run do not justify promising security for the entire application.
You can use Content-Security-Policy and Content-Security-Policy-Report-Only at the same time. This lets you retain an existing, less restrictive enforced policy while observing a stricter one before the next change. If you need help reviewing the configuration and setting priorities, start with a free audit of your website or the web portion of your product at CheckMyApp.