CSP Violation Report Parser
Turn report-uri and report-to dumps into a count-ranked shortlist of policy fixes.
Violation reports
Triage
Paste CSP violation reports to triage them
Single JSON, JSONL lines, arrays or report-to envelopes — all parsed locally in this tab.
Details
Content-Security-Policy in Report-Only mode emits a JSON violation report for every blocked resource. This tool accepts a single report, a JSONL log, an array export or Reporting-API report-to envelopes, normalizes browser-specific field names, and aggregates the results by effective-directive and host-normalized blocked-uri. Count-ranked groups surface the fixes that remove the most noise first, with sample source-file and line pointers inside each group. Inline, eval, wasm-eval, data:, blob: and extension targets get their own badges and guidance. Filters cover directive, disposition, URI text and the status-code 0 extension-noise heuristic. Markdown and CSV exports are user-initiated; reports may contain internal URLs and referrers, so parsing happens entirely in your browser with no upload and no localStorage persistence.
More examples
JSONL violation dump
{"csp-report":{"document-uri":"https://app.example.test/","effective-directive":"img-src","blocked-uri":"https://cdn.partner.test/logo.png?v=2","status-code":200}}
{"csp-report":{"document-uri":"https://app.example.test/","effective-directive":"script-src","blocked-uri":"inline","source-file":"https://app.example.test/app.js","line-number":42}}One report per line: the parser groups the CDN host and flags the inline script for a hash or nonce.
Host normalization
https://cdn.x.com/a.js?v=2 http://cdn.x.com:443/b.css#fragment
Scheme, port, query and fragment are stripped for grouping, so both URLs count under cdn.x.com while full URIs remain visible in the expanded samples.
Markdown triage summary
# CSP violation triage Parsed 198 reports · 2 skipped · 14 groups ## Top fixes - [ ] add img-src cdn.partner.test — 412 reports
The copyable export turns a wall of JSON into a short, count-ranked checklist for a pull request.
Examples
Two URLs, one group
https://cdn.partner.test/a.png?v=2
http://cdn.partner.test:443/b.png?x=9img-src · cdn.partner.test · count 2Scheme, port and query differences collapse into one actionable fix.
Inline violation with a sample
{"effective-directive":"script-src","blocked-uri":"inline","sample":"track()","source-file":"https://app.example.test/app.js","line-number":42}fix script-src inline — hash or nonce the snippet instead of adding 'unsafe-inline'CSP3 sample and legacy script-sample are both extracted and shown in the expanded group.
Markdown fix list
412 img-src reports for cdn.partner.test- [ ] add img-src cdn.partner.test — 412 reportsThe ranked checklist can be pasted straight into a rollout PR.
About this tool
A Content-Security-Policy in Report-Only mode emits one JSON violation report for every resource it would have blocked. A week of those reports is a wall of JSON; this tool turns it into a short, count-ranked shortlist of policy changes with sample source-file and line pointers for each group.
Paste a single report, a JSONL log, an array export or a batch of report-to envelopes. Field names are normalized across browser versions (hyphenated, snake_case and camelCase), corrupt lines are skipped with their line number, and identical reports are counted rather than silently deduplicated.
Grouping uses effective-directive and a host-normalized blocked-uri: scheme, credentials, port, query and fragment are stripped, while the full URI stays visible in the expanded samples. Inline, eval, wasm-eval, data:, blob: and extension targets get distinct badges and guidance instead of being treated as ordinary hosts.
Violation reports often contain internal URLs, referrers and inline code samples. Parsing happens entirely in the browser: nothing is uploaded, and the input is deliberately not saved to localStorage. Markdown and CSV exports are downloaded only when you ask for them.
What this tool does not do
- This reads reports only; it does not author policies (use csp-builder) or probe a deployed site.
- No live endpoint, network request or persistence: bring your own log file.
- Parsing is synchronous on the main thread; files over 50 MB are rejected with a warning.
- Fix suggestions, source-already-present hints and the status-code 0 filter are labeled heuristics, not guarantees.
- Gzipped log files and trend comparison between two dumps are not supported.
How to use this tool
Load the reports
Paste JSON, JSONL lines or an array, drop a .json/.jsonl/.txt file, or start with the sample dump.
Check the parse stats
The meta line shows parsed reports, skipped lines and group count; expand the skip ledger to see exactly which lines failed and why.
Triage the groups
Expand a row for sample source-file:line pointers, then filter by directive, disposition, URI text or the status-code 0 heuristic.
Copy the fixes
Work through the checked Top fixes list and copy the Markdown summary into a PR or issue; download the CSV for a spreadsheet.
Use cases
Enforcement go/no-go
Aggregate a week of Report-Only logs and fix the highest-count offenders before switching the header to enforcing mode.
Why is my script blocked?
Find the exact source-file and line for a blocked resource, including inline samples, without scrolling raw JSON.
Log-drain cleanup
Triage an exported array or JSONL file before deleting it, and keep the Markdown summary as the record.
Accepted report shapes and grouped targets
| Input shape | How it is handled |
|---|---|
| Single {"csp-report": {…}} object | Parsed as one classic violation report. |
| One report per line (JSONL) | Each line parsed separately; corrupt lines are listed with their line number. |
| Array of reports or report-to envelopes | Arrays and {type: "csp-violation", body: {…}} envelopes are flattened; other report types are skipped. |
| https://cdn.x.com/a.js?v=2 | Grouped under cdn.x.com; full URI kept on the sample. |
| inline / eval / data: / blob: | Separate badges with hash, code-refactor or source-allow guidance. |
Up to 20 sample reports are shown per group; counts always include every matching report.
Common mistakes
Mistake:Adding 'unsafe-inline' to silence inline violations.
Fix:Use a hash or nonce from the offending snippet; the inline badge explains the alternative.
Mistake:Deleting every status-code 0 report as extension noise.
Fix:Treat it as a heuristic: a mixed-status group keeps its genuine reports when the filter is enabled.
Mistake:Pasting an array of reports when each report sits on its own line.
Fix:Use one report per line (JSONL); the format badge and parse error will tell you which shape was detected.
Frequently asked questions
What fields are in a CSP violation report?
Typically document-uri, referrer, violated-directive, effective-directive, original-policy, blocked-uri, status-code and sometimes source-file, line-number, column-number, disposition and a CSP3 sample. This parser accepts hyphenated, snake_case and camelCase spellings and tolerates missing fields.
What does blocked-uri "inline" mean?
The blocked resource was inline code (a script or style attribute or element) rather than an external URL. The fix is usually a hash or a nonce generated for that exact snippet, or moving the code into an external file — not adding 'unsafe-inline'.
Why do reports show status-code 0?
Status-code 0 usually means the browser never made a normal network request: browser extensions, data:/blob: URLs and aborted loads often produce it. It is a useful noise heuristic, not proof the violation is harmless; the exclusion filter applies to individual reports and keeps the rest of a mixed group.
What is the difference between violated-directive and effective-directive?
violated-directive is the directive the browser says was violated, sometimes with its source list, while effective-directive is the specific directive applied, such as script-src-elem. Grouping prefers effective-directive and falls back to violated-directive when it is missing; fix suggestions map -elem/-attr back to script-src or style-src when the original policy declares the base directive.
How do I turn reports into a policy?
Triage the highest-count groups first: add the host to the directive shown in the Top fixes checklist, hash or nonce inline snippets, and remove eval-style code. Then re-run with Report-Only to confirm the counts fall before enforcing the header with a tool such as csp-builder.
Does it support report-to and keep my logs private?
Yes: arrays of {type: "csp-violation", body: {…}} Reporting-API envelopes are accepted alongside classic csp-report payloads, while other report types are skipped. Parsing runs in this tab only — no upload, no URL sharing and no localStorage persistence.
References & standards
Related tools
AES Encryption
Encrypt and decrypt text with AES-GCM and a passphrase, fully in your browser. Uses PBKDF2 key derivation and the Web Crypto API — your data and keys never leave your device.
Android Network Security Config Builder
Generate network_security_config.xml with cleartext rules, trust anchors, certificate pinning and debug-only CAs — plus the manifest snippet and file placement checklist.
Ansible Vault Encrypt/Decrypt
Encrypt secrets into $ANSIBLE_VAULT;1.1;AES256 format or decrypt vault content with its password — locally in your browser, drop-in compatible with ansible-vault.
Argon2 Hash Generator & Verifier
Generate Argon2id/2i/2d hashes with proper m/t/p parameters and verify PHC strings — reference algorithm in your browser, nothing uploaded.
AWS Signature V4 Builder
Build AWS Signature V4 headers and presigned URLs from a canonical request — signed curl, key chain and debug diff, computed locally in your browser.
Basic Auth Generator
Generate an HTTP Basic Authentication header from a username and password. Produces the Authorization header and ready-to-use curl and fetch snippets. Runs fully client-side.