Skip to main content
SiteIndex
डेवलपरइस्तेमाल के लिए तैयार

Content-Security-Policy का विश्लेषण करें

CSP हेडर को निर्देशों और अनुमत स्रोतों में बाँटकर नियमों की समीक्षा करें।

गाइड

इंटरैक्टिव टूल

अकाउंट की ज़रूरत नहीं
CSP हेडर पार्सर

Paste a policy value, a full response-header block (the Content-Security-Policy line is extracted automatically), or fetch a live URL below.

Security score
60/100 · Grade C
0 critical · 1 warnings · 6 missing baseline directives
Starts at 100: −25 per critical, −10 per warning, −5 per missing directive.
DirectiveSourcesFinding
default-src
'self'
OK
script-src
'self'https://cdn.example.com
OK
img-src
*
Warning
object-src
'none'
OK

Findings and fixes

  • Warningimg-src

    Wildcard * in img-src allows content from any origin on the internet.

    Fix: Replace * in img-src with the specific origins you actually load from, for example https://cdn.example.com.

Missing baseline directives

style-srcconnect-srcfont-srcbase-uriform-actionframe-ancestors

Fetch directives not listed fall back to default-src when one is set; base-uri, form-action, and frame-ancestors have no fallback and should be set explicitly (for example object-src 'none'; base-uri 'self'; frame-ancestors 'none').

How to read a CSP

A Content-Security-Policy is a list of directives separated by semicolons. Each directive names a kind of content (script-src for JavaScript, img-src for images, and so on) followed by the sources it may load from: 'self' means your own origin, a host like https://cdn.example.com allows that host, and 'none' blocks the type entirely. When a directive is missing, browsers fall back to default-src for most fetch types — but not for base-uri, form-action, or frame-ancestors.

'unsafe-inline' and 'unsafe-eval' switch the protection off for the most common attack paths; nonces ('nonce-…') and hashes ('sha256-…') are the safe way to allow specific inline blocks. A sensible minimum policy is: default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self' — then add the hosts you need per directive. To trial a policy without breaking the site, send it as Content-Security-Policy-Report-Only first and watch the reports.

Where do I copy a CSP from?

In your browser's developer tools, open the Network tab, reload, click the main document request, and look under Response Headers — or paste any URL into the fetch box above and the header is loaded for you.

Does a good grade here mean my site is secure?

No. The grade reviews this one header against common weaknesses. It does not test your application code, other headers, or your server configuration, and a strict policy that is wrong for your site can still break pages — deploy changes in report-only mode first.

Why is 'unsafe-inline' scored as critical?

Most CSP deployments exist to stop cross-site scripting. 'unsafe-inline' in script-src lets any injected inline script run, which cancels that protection; security-header scanners and Google's CSP Evaluator treat it the same way.

What is the difference between CSP and CSP Report-Only?

Content-Security-Policy is enforced — violations are blocked. Content-Security-Policy-Report-Only only reports violations to the endpoint you name, so you can find breakage before enforcing.

My framework adds inline scripts. How do I keep them?

Have the framework emit a per-request nonce and add 'nonce-VALUE' to script-src, or precompute 'sha256-…' hashes for static inline blocks. Both let those exact blocks run while everything else stays blocked.

CSP हेडर पार्सर क्या है?

CSP हेडर को निर्देशों और अनुमत स्रोतों में बाँटकर नियमों की समीक्षा करें।

यह कैसे काम करता है

CSP हेडर को निर्देशों और अनुमत स्रोतों में बाँटकर नियमों की समीक्षा करें।

आम इस्तेमाल

CSP हेडर को निर्देशों और अनुमत स्रोतों में बाँटकर नियमों की समीक्षा करें।

सीमाएँ

नतीजे आपके ब्राउज़र, नेटवर्क, इनपुट और बाहरी सेवाओं पर निर्भर कर सकते हैं। यह टूल जानकारी के लिए है और विशेषज्ञ जाँच या पेशेवर सलाह का विकल्प नहीं है।

अक्सर पूछे जाने वाले सवाल
CSP हेडर पार्सर क्या है?
CSP हेडर को निर्देशों और अनुमत स्रोतों में बाँटकर नियमों की समीक्षा करें।

मिलते-जुलते टूल