Red Center Studio
Back to Apify Actors Apify Actor / Site security

Write a starting Content-Security-Policy for up to 50 websites in one run.

An Apify Actor that reads a website's public pages and writes a ready-to-paste starting Content-Security-Policy, with server snippets that deploy it as Report-Only first. It never changes the site. It is for site owners, agencies and developers who want a first draft instead of writing one by hand.

  • Pay per policy built
  • Report-Only first: test before you enforce
  • Runs from Apify, an API call or an AI assistant

$0.01 USD per site. No subscription. You need a free Apify account.

What it reports

What you get for each site.

A policy from your pages

It reads the homepage and other pages found in its links and sitemap, one for each kind of address, up to 15 by default and 50 at most, and sorts the origins they load into directives.

Inline scripts by hash

A SHA-256 hash for inline scripts, up to 100, so the policy does not add 'unsafe-inline' for scripts. Inline event handlers such as onclick are counted and explained.

Known services

For a short list of services, such as Google Tag Manager, Stripe.js and YouTube embeds, it adds hosts that static HTML cannot show and says why.

Your current policy

The policy headers the homepage sends now, and what the site loads that they would block.

Server snippets

Report-Only snippets for a Cloudflare _headers file, nginx, Apache and netlify.toml, plus an HTML meta tag. A meta tag cannot be Report-Only, so it always enforces.

Two modes and warnings

Compatible mode allows inline styles when the site uses them. Strict mode never adds 'unsafe-inline' and warns what to move out of the HTML. Warnings also cover eval-like code and resources loaded over http.

Output

Real output from a test run.

InputStatusSitePages readReport-Only headerBlocked by current policyInline scriptsUnsafe inline neededWarningsError
https://redcenterstudio.comokhttps://redcenterstudio.com2Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' 'sha256-/aDReT...{"count":12,"hashes":["'sha256-/aDReTAQHvEjUmWEz8w+2g+emwe9QJjCkVkz6gR+ZJg='","'sha256-LH...trueMany different inline scripts usually means the HTML generates them per page. A hash only...

The columns of the dataset table in Apify Console.

Cost

What a month costs.

100 x $0.01 policy-built
$1.00
Failed sites
$0.00
Subscription
None
Estimated total
$1.00 USD

Charged by Apify to your Apify account. Each website that returns a policy row is billable. Error rows are not charged. Apify adds its own small start event to each run. You can set a spending limit for each run on Apify, and the Actor stops cleanly when it is reached.

Use it from anywhere

Connect it to an AI assistant or your code.

{
  "mcpServers": {
    "csp-builder": {
      "url": "https://mcp.apify.com?tools=bodacious_mistral/csp-builder"
    }
  }
}

This is Apify's own MCP server with this Actor as its tool. Your client opens an Apify sign-in the first time, so no token sits in the file. In Claude, add the url as a custom connector. In Claude Code: claude mcp add --transport http csp-builder "https://mcp.apify.com?tools=bodacious_mistral/csp-builder"

From the same studio

Keep an eye on the site.

Site Watch checks a website from Claude: domain and SSL expiry, DNS and email security and AI crawler access, with uptime on paid plans. It does not check Content-Security-Policy or other headers. A free plan is available.

Frequently asked questions

Can I enforce the policy straight away?

Do not start there. It is a starting point. Deploy the Report-Only header for about a week, watch for violations, fix or allow what is reported, and then enforce.

Does it run JavaScript?

No. It reads the HTML and up to 10 stylesheets from the same site. It does not run scripts or open script files, so something a script loads later can be missing from the policy. The Report-Only period is how you catch it.

What if my inline scripts change on every request?

A hash matches one exact piece of text. For scripts your server builds on each request, use a fresh nonce instead.

What am I charged for?

One policy built event for each website that returns a policy row. Error rows are free, such as a homepage that cannot be reached, answers with an error status or is not HTML. Apify adds its own small start event to each run, and you can set a maximum cost per run.

What are the limits?

Up to 50 websites per run, 3 at a time by default, with up to 50 pages and about 60 seconds for each site. Only public pages are read.

More Actors from the studio: AI visibility audit, Bubble® migration audit, Make.com blueprint analysis, Schema builder, MCP server grader, Trust center finder, Bubble app inspector, Agent endpoint scan, URL parity check. All of them: Red Center Studio on Apify.