Toolvore

Content Security Policy Generator

Build a restrictive CSP HTTP header from exact HTTPS origins, review each directive and download a policy for report-only testing.

This tool processes its input contents in your browser instead of sending them to a processing service. Page, asset and fixed usage-measurement requests are described on the Privacy page.

Build a restrictive CSP HTTP header from exact HTTPS origins, review each directive and download a policy for report-only testing.

How to use it

  1. 1Review each resource list and enter exact HTTPS origins.
  2. 2Build the policy and read its restrictions and delivery assumptions.
  3. 3Copy the complete value for report-only testing on your own site.

Example

Input
Script origins 'self' https://cdn.example.com
Output
script-src 'self' https://cdn.example.com

This is one directive in the full generated policy. Other directives retain their separate sources. A CDN origin does not identify or verify every script hosted there.

What happens to your data

Policy entries and generated HTTP values stay in this browser tab. No entered origin is contacted or saved as input history. Optional activity records exclude origin lists.

Last updated November 2026

Build a restrictive Content Security Policy header from the origins your page needs. Start with explicit script, style, image, font, connection, frame and form sources, review the generated directive list and test the policy in report-only mode before enforcement.

How it works

The builder starts with default-src 'none', base-uri 'self', object-src 'none' and frame-ancestors 'none'. Script, style, image, font, connection and form directives initially permit 'self'. The frame list starts empty and produces frame-src 'none'. Upgrade insecure requests is enabled initially and can be cleared deliberately. Each visible list controls its own directive instead of silently sharing a broad wildcard across resource types.

Enter one exact HTTPS origin per line, such as https://cdn.example.com. The builder accepts a supported self keyword and permits data: for images or fonts when you deliberately add it. It rejects credentials, paths, query strings, fragments, wildcards, inline/eval allowances and arbitrary raw directive text. A canonical origin removes an unneeded default HTTPS port and normalizes the host through the URL parser. Repeated sources within one directive are deduplicated. Empty lists become 'none'. Up to 32 source entries per directive keep the policy bounded.

The result is the full header value, which can first be delivered through Content-Security-Policy-Report-Only. It is not a server configuration file or a deployment action. A report endpoint is outside this builder. Observe your browser console and your own reporting setup, then confirm the resources required for real routes, sign-in flows, embedded frames, workers and third-party integrations before enforcing it. Some directives need an HTTP header and cannot be delivered equivalently in a meta element.

This template blocks inline scripts/styles and embedding your page in other sites. That restriction can break an existing application until its real loading strategy and dependencies are reviewed. An allowed CDN origin may host many resources, so listing it does not independently prove the safety of every hosted script. The builder does not fetch your page, inspect dependencies, validate a deployment or award a security-compliance rating. Security policies need application-specific testing and ongoing maintenance.

Copy and download contain the same complete header value. A separate JSON report contains directive/source counts and the assumptions behind the template, without entered origins. Changing a source list or the upgrade setting removes the old result so an earlier policy cannot be confused with the current choice.

Reading, parsing and generation run in this browser tab. Source text and generated files are held in memory, with no source upload or saved history. Optional workflow measurement records fixed counts and outcomes without JSON keys, link destinations or source values. The separate MCP operation processes explicitly supplied arguments on Toolvore's server under its published smaller limits.

Worked example: Permit one script origin deliberately

Input
Script origins 'self' https://cdn.example.com
Result
script-src 'self' https://cdn.example.com

This is one directive in the full generated policy. Other directives retain their separate sources. A CDN origin does not identify or verify every script hosted there.

Common use cases

  • Prepare a conservative policy for review before a new static site launches.
  • Keep script, font, image and API origins explicit during integration work.
  • Identify when an existing page requires an inline-script strategy outside this builder.
  • Share a complete policy candidate with a developer who controls HTTP headers.

Frequently asked questions

Will this automatically secure my site?+

A generated header is a candidate for application-specific review. Test real user flows, understand each allowed origin and maintain the policy as dependencies change.

Can I paste the result into a meta tag?+

Use HTTP headers when possible. Certain directives and report-only behavior require header delivery and do not have equivalent meta support.

Why are inline scripts and styles blocked?+

The builder provides a restrictive origin-based template. Nonces, hashes and unsafe-inline are outside its supported fields and require a deliberate implementation strategy.

Does the tool inspect my website?+

It builds from the entries you supply. It does not open a destination, discover dependencies, change a server or verify compliance.