UUID Generator
Generate cryptographically random version 4 UUIDs in bulk.
Build a Content-Security-Policy header directive by directive.
The CSP Generator builds a Content-Security-Policy directive by directive, explaining each one and flagging the values that quietly undo the protection — unsafe-inline above all.
Content-Security-Policy is the strongest defence against cross-site scripting and the easiest header to get wrong. This builds one directive at a time, explaining what each controls and warning where a value undoes the protection you are adding.
The warnings matter more than the builder. unsafe-inline in script-src defeats essentially the whole policy. unsafe-eval reopens a class of injection. A wildcard source allows any host on the internet. Missing object-src and base-uri leave two well-known bypasses open. The generator flags all of those, offers a nonce-based approach as the alternative to unsafe-inline, and can emit the header in report-only mode so you can watch what a policy would block before enforcing it.
unsafe-inline in script-src removes almost all the protection CSP offers, and the generator says so rather than quietly including it.
object-src 'none' and base-uri 'self' are both prompted for, because leaving them out leaves two documented holes open.
The practical alternative to unsafe-inline, with the server-side pattern explained rather than just named.
Emit the header in the form that reports violations without blocking, which is the only sane way to roll out a first policy.
A strict baseline and a typical-site policy, so you are adjusting something sensible rather than starting from nothing.
A strict baseline, a typical site, or an empty policy to build from scratch.
Add the sources each resource type needs, with the keyword values explained.
Values that weaken the policy are flagged with what they let through.
Collect violation reports before enforcing, so you find what breaks without breaking it.
Because the main thing CSP prevents is injected script running, and unsafe-inline permits exactly that. A policy with unsafe-inline in script-src provides almost no XSS protection at all.
Use a nonce — a random value generated per response, put in the header and on every legitimate script tag. Injected script will not have it and will not run. Hashes work too, for scripts that never change.
object-src 'none' and base-uri 'self'. Both are well-known bypasses: plugins can execute script, and an injected base tag can redirect every relative script URL to an attacker's server.
Yes, always. Content-Security-Policy-Report-Only sends violation reports without blocking anything, so you can find every inline handler and third-party script before a policy breaks your site.
What people who use the CSP Generator think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the CSP Generator. It takes half a minute and no account.
Write the first reviewGenerate cryptographically random version 4 UUIDs in bulk.
AND, OR, XOR, shifts and rotates, at 8 to 64 bits, shown in binary.
Work out a subnet: network, broadcast, host range and usable count.
Tidy a TOML file: consistent quoting, ordered tables, keys before headers.
Network, broadcast and host range from any CIDR block.
Convert HTML into valid JSX, with every attribute renamed correctly.
The full ASCII table with decimal, hex, octal, binary and HTML entities.
Re-indent a stylesheet, or strip it back to one line.