Privacy and Security

Reading CSP Violation Reports Without Drowning in Them

Turn thousands of Content Security Policy violation reports into a short list of real problems, ignore extension noise and tighten your policy safely.

Saizul Amin
Saizul Amin3 Nov 2026 · 4 min read
Reading CSP Violation Reports Without Drowning in Them

Reading CSP Violation Reports Without Drowning in Them

Turning on Content Security Policy reporting feels like progress until the first morning after. A medium-sized site can collect thousands of reports overnight, and most teams open the log once, see a wall of JSON and never look again. That is a pity, because those reports are the cheapest way to find out what a policy would break, what third parties your pages really load and, occasionally, an injection attempt. This guide explains how to read them in a structured way.

Start in report-only mode

Never enforce a new policy blind. Send it first as Content-Security-Policy-Report-Only with a report-uri or report-to directive. Browsers apply the policy in their heads, block nothing, and post a report for every load that would have been refused. Run that for at least a week so you see weekly jobs, rarely used pages and marketing campaigns.

Know the two report formats

Older browsers and the report-uri directive send one JSON object per violation, wrapped in a csp-report key, with fields such as document-uri, effective-directive and blocked-uri. The newer Reporting API, used with report-to, batches reports in an array where each item has type csp-violation and a body with documentURL, effectiveDirective and blockedURL. Your collector may store either or both. A good analysis treats them the same.

Group before you read

Individual reports are almost useless. What matters is the pair of directive and blocked source. Fourteen reports of script-src-elem blocking the same tag manager are one decision, not fourteen. Reduce external URLs to their origin, because policies allow origins rather than paths, and count how many distinct pages each pair affects. A problem on the checkout page deserves more attention than one on an old blog post.

Separate noise from signal

A large share of reports has nothing to do with your site. Password managers, ad blockers, translation add-ons and shopping helpers inject scripts into every page, and your policy rightly blocks them. Their reports point at chrome-extension, moz-extension or safari-web-extension URLs. Others mention about:blank or browser-internal schemes. Loosening a policy for these makes the site weaker and does nothing for users. Tag them and hide them.

Decide what each remaining group needs

For every real group, ask which of four cases it is.

  • A third party you use on purpose. Add its origin to the specific directive, for example script-src for a payment widget or img-src for an analytics pixel. Do not add it to default-src, which would allow it everywhere.
  • Your own origin. If 'self' is blocked, the directive simply forgot it.
  • Inline code. The blocked value is inline. Resist 'unsafe-inline'. Add a nonce that your server generates per response, a hash of the exact snippet, or move the code into a file.
  • eval or new Function. Find the library responsible. 'unsafe-eval' disables an important protection; many libraries have a CSP-compatible build.

If a blocked origin is one you have never heard of and appears on a few pages only, treat it as a possible injection and investigate before allowing anything.

Understand which directive really applies

Browsers fall back from specific directives to general ones. A report for script-src-elem is governed by script-src-elem if you set it, otherwise script-src, otherwise default-src. When you fix a group, edit the directive that actually applies. If the only match is default-src, create the specific directive instead, seeded with the default-src values, so other resource types stay as strict as before.

Check the result for weak spots

After the changes, read the policy once more. Common gaps are a missing object-src 'none', a missing base-uri, no frame-ancestors, and no reporting directive at all, which means you lose visibility the moment you switch to enforcement.

Doing it with a browser tool

The CSP Violation Report Analyzer follows exactly this process. Paste an export from your collector in either format, and it groups reports, labels extension noise, counts pages, and keeps any script samples. On the policy tab it works out the governing directive for each group, proposes changes with a risk label, lets you tick the ones you accept, and prints an updated policy plus a report-only header line to deploy next. Everything stays in the browser, which matters because reports contain your URLs and sometimes fragments of user data in query strings.

A sensible rhythm

Review the grouped reports weekly while in report-only mode, enforce when the list is down to noise and known items, and keep reporting on. After every release that adds a third party, check again. A policy that is reviewed this way stays tight without breaking the site.

Limits

Reports describe what browsers saw, not what is safe. Allowing an origin is a trust decision only you can make, and nonces or hashes have to be implemented in your application. Use the reports as evidence, not as instructions.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages