Free Content Security Policy (CSP) Checker
Scan your Content Security Policy for unsafe-inline, unsafe-eval, missing object-src and base-uri, and weak sources. Get nonce and strict-dynamic fixes you can ship today.
- CSP directives analysis
- Detect unsafe-inline/eval
- CSP violation detection

What you get for free
18 core security checks via this tool, passive scans, step-by-step remediation, security score on every result.
What Essential adds at $39/mo
+17 advanced checks, continuous monitoring, daily security score history, email alerts, GitHub SAST, board-ready PDFs, SOC 2 / ISO 27001 / PCI reports.
What is Content Security Policy (CSP)?
CSP is a browser security layer that controls where your app can load resources from (scripts, styles, images, frames, etc.). A strict policy prevents XSS and reduces supply‑chain risk by blocking unexpected sources.
Why CSP matters
A strong CSP can neutralize whole classes of injection bugs and mitigate third‑party script risk. It also provides defense in depth when combined with escaping, sanitization, and Trusted Types.
How to fix common failures
- Replace script-src 'unsafe-inline' with nonces (rotate per request)
- Add object-src 'none'; base-uri 'none'; form-action 'self'
- Audit third‑party domains and restrict to explicit allow‑lists
- Enable upgrade-insecure-requests and avoid mixed content
Examples (good vs bad)
Bad: script-src 'self' 'unsafe-inline' https://cdn.example.com
Better: script-src 'self' 'nonce-...' 'strict-dynamic' https://cdn.example.com; object-src 'none'; base-uri 'none'
What this checker validates
- Detects unsafe directives (unsafe-inline, unsafe-eval)
- Flags missing baselines: object-src 'none', base-uri 'none'
- Evaluates nonce/hash usage and recommends strict-dynamic
- Reviews frame-ancestors, form-action, upgrade-insecure-requests
- Monitors CSP console errors to identify blocked legitimate resources
Across 7,440 recent scans, 98.9% are missing a strict Content Security Policy, and 98.0% have no Trusted Types directive.
Implementation examples
Once you've identified the gap, applying the fix is straightforward. Here are the three configurations developers reach for most often.
Nginx
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'nonce-$request_id' 'strict-dynamic'; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests" always;Apache
Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'nonce-%{CSP_NONCE}e' 'strict-dynamic'; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests"Node.js (Express + Helmet)
import crypto from "node:crypto"
import express from "express"
import helmet from "helmet"
const app = express()
app.use((req, res, next) => {
res.locals.cspNonce = crypto.randomBytes(16).toString("base64")
next()
})
app.use(
helmet({
contentSecurityPolicy: {
useDefaults: false,
directives: {
defaultSrc: ["'self'"],
scriptSrc: [
"'self'",
(_req, res) => `'nonce-${(res as express.Response).locals.cspNonce}'`,
"'strict-dynamic'",
],
objectSrc: ["'none'"],
baseUri: ["'none'"],
formAction: ["'self'"],
frameAncestors: ["'none'"],
upgradeInsecureRequests: [],
},
},
}),
)Tool-specific questions
What does a CSP checker test?
Should I use nonces or hashes?
Do I need object-src and base-uri even if unused?
Can I allow *.cdn.com wildcards?
How often should CSP nonces rotate?
How do I migrate from unsafe-inline to nonces?
Why do third-party widgets get blocked?
Does Barrion detect CSP console errors?
Built for the engineers who already have enough to fix.
Real-time results
Comprehensive checks
Step-by-step fixes
More free checks, for the rest of your surface.
Complete Security Scan
Pre-Pentest Security Scan
Security Compliance Checker
WAF Checker
Security Headers Test
TLS/SSL Security Checker
Go deeper on the same topic.
Content Security Policy
Missing Content Security Policy
Content Security Policy Guide
Security Headers Guide
Frequently asked.
What is Barrion and how does it enhance website security?
How safe is Barrion to use for security testing?
What types of security issues does Barrion identify?
What specific security checks does Barrion perform?
What is Barrion's smart crawling?
How often does Barrion perform security scans?
Is Barrion suitable for security testing of all business sizes?
How does Barrion handle data security and privacy during security testing?
What if I'm not satisfied with Barrion's security testing service?
How does Barrion help with SOC 2, ISO 27001, NIS2, and other compliance frameworks?
Anything else? Email contact@barrion.io.
Lock down your CSP, then keep it locked.
Run continuous CSP checks across releases. Catch unsafe-inline regressions before they ship.