opyebCspLab
OPYEB · serverless static tool

A CSP is a policy to verify, not a line to paste

Paste a Content-Security-Policy and it is split into directives, then rebuilt from toggles and source lists. 35 practical audit rules catch 'unsafe-inline', 'unsafe-eval', wildcards, data:, http: mixed content, missing object-src, and nonce without 'strict-dynamic', each with the attack it enables and the value to change. Export the audit as Markdown or JSON, and the policy as Cloudflare _headers, Nginx, Apache or a meta tag.

In one line: CspLab parses, assembles and audits CSP policies locally and emits the deployment format for you, free.

  • 35audit rules
  • 6synthetic presets
  • 5deploy formats
  • 0bytes sent

① Policy input and parser

A header line, a _headers block, an Nginx or Apache directive, a meta tag, or a bare policy string all work. The format is detected, and editing a value re-runs the audit immediately.

Enforced (Content-Security-Policy)

Synthetic presets

Parsed directives

DirectiveSource valuesStatus

Directives are separated by semicolons (;), and source values by spaces. Line breaks are fine.

② Policy builder

Switch a directive off and it leaves the policy; edit a source list and the policy string is rebuilt. The output feeds the deployment formats and the audit below.

Local only

Generated policy


  
DirectiveSource values

Separate source values with spaces. Values that need quotes ('self', 'none', a nonce) must keep them.

③ Audit result

35 practical audit rules run on every change. Findings are ordered by severity, and each carries the bypass scenario and the fix.

—

④ Deployment format converter

Turn the same policy into each server's format. If the input was in audit mode, the Report-Only header name is used.

Zero-API

  

Generated values are a starting point. Check the live response header, and observe in Report-Only before enforcing.

⑤ Export the report

Copy or download the policy, audit and fixes as a Markdown table or JSON. Files are created in your browser and never uploaded.

Markdown preview


How it works

It follows the CSP Level 3 directive and source-expression rules, and every calculation finishes in your browser.

Detect the formatWhether it is a Content-Security-Policy: header, a _headers block, an add_header, a Header always set line or a <meta http-equiv>, only the policy part is kept.
Split the directivesThe policy is split on semicolons, names and source values are separated, duplicates, unknown and empty directives are flagged, and default-src inheritance is resolved.
Audit the patterns'unsafe-inline', 'unsafe-eval', *, data: and http: in the script chain, plus missing object-src, base-uri and frame-ancestors, are graded with a bypass scenario each.
Assemble and exportToggling directives rebuilds the policy string, and the same policy converts to _headers, Nginx, Apache and meta formats for download.

Frequently asked questions

Is the policy I paste sent to a server?

No. This site has no server code, no API and no accounts. Parsing, auditing and conversion run in browser JavaScript only, and your input is not uploaded (advertising and affiliate widgets excluded). Closing the page discards it; localStorage holds only the theme choice.

Does a CSP stop XSS completely?

No. A CSP is one layer. A policy without `'unsafe-inline'` or wildcards blocks much inline-script injection, but server-side output encoding, dependency checks and Trusted Types have to hold too. This tool focuses on weaknesses in the policy itself.

Why is `'unsafe-inline'` together with a nonce dangerous?

CSP Level 3 browsers ignore `'unsafe-inline'` when a nonce or hash is present, so modern browsers use the nonce. Browsers that only support CSP2, and some webviews, still honour `'unsafe-inline'` and run inline scripts. The policy looks locked while staying open.

When do I need `'strict-dynamic'`?

When scripts trusted by a nonce or hash create further scripts and you want those allowed. On its own, without a nonce or hash, there is no root of trust and every script is blocked. That is why the linter rates a nonce-less `'strict-dynamic'` as High.

Are `object-src 'none'` and `base-uri 'none'` really necessary?

Recommended. Without `object-src` the legacy plugin path stays open, and without `base-uri` a single injected `` tag can pull relative-path scripts from an attacker host. Both are one line.

How do I use Report-Only?

Deploy `Content-Security-Policy-Report-Only` first, collect violations and refine the policy without blocking anything. CspLab audits a Report-Only header with the same rules and exports it under the Report-Only name.

How are the score and grade calculated?

Start at 100 and subtract 25 per Critical, 12 per High, 5 per Medium and 1 per Info, stopping at 0. Grades are A (90+), B (75–89), C (55–74) and D (below 55). The score is a quick relative-risk signal; real risk depends on the service.

Does it show what the browser actually blocks?

No. It analyses the policy string; it does not reproduce browser enforcement. Confirm in DevTools and a real deployment, and use Report-Only to observe safely first.

CSP field guides

From inheritance and nonce to deploy formats, ordered by what prevents real incidents.

0 bytes of your input sent to a server (advertising and affiliate widgets excluded)