Generate a strict Content Security Policy
Say what your site uses and get a policy you can ship. It starts strict, with a nonce or hash, and falls back to a host list if you need one. Everything runs in this tab. Nothing is sent.
What does your site use?
One per line, like sha256-AbC...=
Where your scripts load from. One per line.
Hosted CSS, such as a font provider. One per line.
Where font files load from. One per line.
Images from other sites or a CDN. One per line.
Videos, maps, payment frames. One per line.
Where your pages call fetch, XHR or websockets. One per line.
One per line.
One per line. Forms may always post to your own site.
Your policy
This policy was edited or loaded, so changes to the answers do not touch it. The outputs and warnings follow the text above.
Header value
Send this as a response header. It enforces the policy.
Report-Only header
Same policy, report only. Start here.
Meta tag
For hosts where you cannot set headers.
Before you ship it
A new policy can break a page that worked. Three habits keep that from reaching your visitors.
1
Ship it as Report-Only first
Send the Report-Only header for a week and watch the browser console. Fix what it flags. Then switch to the real header.
2
Make a new nonce on every response
The policy shows {NONCE} as a placeholder. Never ship it as written, and never reuse one value. Your server makes a fresh random value for each response and puts it in the header and in every script tag.
3
Use a header when you can
The meta tag cannot set frame-ancestors, report-uri or sandbox, and it cannot be Report-Only. Use it only when you cannot set response headers, as on some static hosts.
What it cannot do
The generated policy is a starting point. Read these before you enforce it.
- It does not read your site
- The tool knows only what you tell it. A script it does not know about will break when you enforce the policy. This is why Report-Only comes first.
- Static sites cannot use a nonce
- A nonce must change on every response. If your pages are static files, choose hashes. Hash mode needs the sha256 of each inline script, and the hash changes whenever the script does.
- Strict mode leaves script hosts out
- With strict-dynamic, a browser trusts scripts that a nonced script loads and ignores host lists. So script hosts are not printed in strict mode. Put the nonce on each script tag you write.
- Inline styles stay loose
- Allowing inline styles needs unsafe-inline in style-src. That is weaker than a nonce. Leave the option off if your styles live in files.
A CSP guards the page, not the door
It protects a visitor's browser. Here is what that covers and what it leaves open.
1
What a CSP protects
A Content-Security-Policy tells a visitor's browser which scripts it may run and where it may send data. It limits what an injected script can do on your page.
2
What a CSP does not do
A CSP does nothing about clients that call your login or API directly. A script, a stuffing tool or a scraper never loads your page, so it never reads your policy.
3
What camada adds
camada works on the server side. An SDK in your app sends one redacted event per request, and camada reviews that traffic every few minutes. A client that attacks your login or API can be blocked on later requests. It does not replace a CSP, and it does not see page scripts in the visitor's browser.
Questions about CSP
More free tools: all developer tools.
- What is a strict CSP?
- A strict CSP trusts scripts by a nonce or a hash instead of by host name, and adds strict-dynamic so those trusted scripts can load others. It is harder to bypass than a list of allowed hosts, because attackers often find a script on an allowed host that they can abuse.
- Why are there no https: or unsafe-inline fallbacks?
- Some guides add https: and unsafe-inline as a fallback for old browsers. Both are ignored by current browsers when a nonce and strict-dynamic are present, and the CSP analyzer flags a broad https: in script-src. This policy leaves them out so it passes the analyzer clean.
- When should I use the allowlist policy?
- Use it when you cannot add a nonce or hashes, for example when you do not control the HTML. List every script host you use. Expect to revisit the list whenever a vendor changes its hosts.
- Does my policy leave my computer?
- No. The policy is built and checked by a script in this tab, and the page makes no network request. The "Test this policy" link puts the policy in the part of the URL after the #. Browsers never send that part to a server.
- Can I edit a policy I already have?
- Yes. Paste it into the policy box. It accepts a bare policy, a Content-Security-Policy header line, a Report-Only line or a meta tag. The warnings update as you type. Changing an answer above rebuilds the policy and replaces what is in the box.
- What does the Report-Only version do?
- The browser reports what the policy would have blocked and lets everything load. Use it to find breakage before you enforce. To receive reports you need an endpoint and a report-uri directive.
- Which browsers support nonces and strict-dynamic?
- Current Chrome, Edge, Firefox and Safari support both. A browser that does not support strict-dynamic ignores it. Injected inline scripts are still blocked, but scripts loaded by a nonced script are blocked there too.
Use it from an AI agent
This page is also Markdown at /tools/csp-generator.md. Agents can also run the check itself, without the form.
audit_cspon the MCP server at https://www.camada.app/mcp, and in this tab through WebMCPTakes
policy, json_api?. Audit a Content-Security-Policy: a header value, a full "Content-Security-Policy: ..." line or a <meta> tag. Returns a row per key directive (ok, warn or info) with the reason, the warnings with fixes, any duplicated directives, and the policy as a header, a Report-Only header and a meta tag. Same rules as https://www.camada.app/tools/csp-generator and /tools/security-headers.
The MCP server needs no key. Every agent tool on this site is listed in the server card and on the tools page.
Related tools
- CSP & security headers
Fetch live response headers or paste curl output. Flag unsafe-inline CSP rules, check HSTS and nosniff, and hash inline scripts.
- Website security check
Enter a URL to trace HTTPS redirects, check CSP and OWASP headers, and audit cookie flags. Also checks robots.txt, llms.txt, and security.txt.
- Login page check
Review your login page for HTTPS, form fields, cookie flags, and security headers. Paste two responses to spot account enumeration.
Cover the routes a CSP cannot.
Install the SDK on the Free plan to score 100,000 events a month with no card.
Free needs no card. A 14-day trial of Starter or Growth needs a card. Nothing is charged today. Cancel before the trial ends (the date is shown in the app) and you pay nothing. Otherwise the plan's monthly price starts on day 15.