The browser's guest list

Content Security Policy Setup: Listen First, Enforce Second, and Stop Trusting Whole Vendors

A Content Security Policy is the rule sheet your site hands every browser: run code from here, send data there, refuse the rest. Most sites send none. Many of the others send one that says yes to everything a favorite vendor serves, which worked fine right up until November 16.

November 19, 2026 · 10 min read

acmebikeworks.com · report-only week two
What the draft policy would have refused
Reports quiet down, then the policy enforces
Sample
  1. Day 1: Content-Security-Policy-Report-Only deployed
  2. Would block script cdn.acme-chatwidget.example
  3. Chat widget has no owner: left blocked, removed
  4. Would block connect to stats.acme-heatmap.example
  5. Inline script in theme footer, no nonce
  6. Footer code moved to a file, nonce added
  7. Day 12: test order through processor test mode
  8. Day 14: no new reports in 72 hours
  9. Day 15: same policy moved to the enforcing header
Illustrative: sample report-only log for a fictional bicycle shop's website

The short answer

Content Security Policy setup means writing the header that tells browsers which scripts may run on your pages and where those pages may send data, then proving it in report-only mode before it enforces. Done well, it allows scripts by nonce rather than by whole vendor domain and avoids 'unsafe-eval'. DataCram sets it up from $575, depending on complexity, with a written estimate before work starts.

On this page
  1. A rule sheet that travels with every page
  2. Why trusting all of Optimizely failed on November 16
  3. Two weeks of listening before the policy says no
  4. Nonces, hashes and the two settings we argue about
  5. What breaks when a policy goes live, and how we keep it standing
  6. Custom sites, WordPress and hosted builders each set limits
  7. Price, promises, and when a policy should wait

A rule sheet that travels with every page

MDN, the web reference maintained by Mozilla, puts it plainly in its CSP guide, last modified March 22, 2026: a policy "consists of a series of instructions from a website to a browser, which instruct the browser to place restrictions on the things that the code comprising the site is allowed to do." The instructions ride along in an HTTP header, a line of text your server sends with each page that visitors never see.

Each instruction is called a directive. Two matter most for the attacks in the news. script-src names where code may come from. connect-src names where the page may send data once it is running. Others cover images, fonts, styles and embedded frames such as a payment box. A site that sends no policy at all is telling the browser that anything goes, and browsers are very literal about that.

A policy does not replace the other jobs in our website security section. It enforces them. The script audit decides which scripts deserve to run; the policy makes the browser refuse everything else, on every visit, without anyone having to remember.

Why trusting all of Optimizely failed on November 16

The attacker did not need to sneak past anyone's allowed list. Report URI, a company that sells script monitoring, found on November 16, 2026 that the malicious loader was written into customers' own Optimizely projects and that Optimizely's network "served exactly what it was given." The hostile code arrived from the very address many of those policies had approved. A rule that says "allow this vendor's domain" allowed the attack too.

How affected organizations' policies fared, as graded by Report URI (November 2026)
What the policy didOrganizationsWhat that meant for visitors
No policy at all68Nothing stood between the payload and the page
Let the code run and send data out50A policy existed and did not stop it
Let the code run, blocked sending data out17Card and cookie theft stopped; wallet swapping did not
Blocked the code24About 15 percent of those graded

Two details from the same analysis should shape any policy written this year. A policy that limited outgoing connections stopped card and cookie theft but not wallet address swapping, which happens inside the page and never needs to phone home. And the 'unsafe-eval' setting let a backup copy of the payload run on HSBC's site even though the policy blocked the main file, per Report URI. Our Optimizely post has the rest of the story.

A policy that trusts a vendor's whole domain is a promise made on the vendor's behalf.

Two weeks of listening before the policy says no

Every strict policy starts life as an observer. The same MDN guide, in its March 2026 revision, describes report-only mode this way: "The policy is not enforced, but any violations are sent to the reporting endpoint specified in the policy." It uses a separate header, Content-Security-Policy-Report-Only, and MDN notes that a report-only policy cannot be delivered in a meta tag in the page. It has to come from the server, or from whatever controls your headers.

Goofy flat sticker of a padlock wearing a teal karate headband, chopping a sneaky gremlin away from a browser window doorway, agave and low hills behind
A good policy watches quietly for two weeks, then refuses strangers without discussion.
  1. 1

    Draft from the audit

    Every keep on the script list becomes an allowed source. Nothing goes in because it might be needed someday.

  2. 2

    Turn on reporting

    MDN recommends the Reporting API, a Reporting-Endpoints header plus the report-to directive, and calls the older report-uri directive deprecated. We declare both until report-to works in every browser your visitors use.

  3. 3

    Deploy in report-only mode

    The site behaves exactly as before. Browsers quietly report each script or connection the draft would have refused.

  4. 4

    Read the reports, all of them

    Some point to a real script we missed. Some come from visitors' own browser add-ons rather than your site. Each one gets a decision: allow it with a reason, or leave it blocked.

  5. 5

    Enforce, and keep listening

    When the reports are quiet, the same policy moves to the enforcing header. Reporting stays on, so a newly blocked script tells you about itself.

Two weeks is our practice, not a rule from any standard. A store with a seasonal promotion may need longer to see every page in use. A brochure site may need less. The point is to let real traffic, not a developer's laptop, tell you what the site actually loads.

Nonces, hashes and the two settings we argue about

The strongest way to allow a script is not by its address but by a one-time code. MDN's March 2026 CSP guide explains nonces like this: the server generates a random value for every response, puts it in the policy and on each script tag it approves, and "The browser compares the two values, and loads the resource only if they match." The value must change on every response and must not be predictable. A stranger who slips a script into the page does not know today's code, so the browser refuses it.

For files that never change, there is a second lock. MDN's Subresource Integrity guide, last modified April 14, 2026, describes a cryptographic hash, a fingerprint of the file, placed on the script tag. If the file's fingerprint does not match, the browser refuses to load it. Any change alters the hash, legitimate updates included, so it does not suit testing tools or tag managers whose files change by design. For a pinned library, it is close to ideal.

What we write into a policy

  • A fresh nonce on every response for scripts we serve
  • connect-src limited to the addresses each kept script needs
  • frame-src limited to your processor's payment frame
  • Integrity hashes on third-party files that never change
  • Reporting on, in both the old and new formats

What we push back on

  • 'unsafe-eval', which MDN says developers should avoid
  • 'strict-dynamic' without a review of what the trusted scripts load
  • A whole vendor domain where a nonce or hash would do
  • Wildcards that allow any subdomain of a busy cloud host
  • Exceptions added to stop a complaint, with no owner or reason

'strict-dynamic' lets a script that carries a valid nonce or hash load further scripts without one. That is convenient for tag managers. MDN warns it "does make your CSP less secure" if those trusted scripts build new script elements from untrusted input. We use it only after reading what the trusted script actually does. When a vendor asks for 'unsafe-eval', we ask the vendor why, and we write the answer down next to the exception.

What breaks when a policy goes live, and how we keep it standing

The common story goes like this. Someone pastes a strict policy from a blog post, the chat bubble disappears, the checkout spins, and the policy is switched off by lunch. The site ends up where 68 of the organizations Report URI graded in November 2026 already were: with no policy at all. Breakage is predictable, which means it is mostly preventable.

Usual casualties of a new policy and how we handle each
What stops workingWhyHow we handle it
Inline scripts in the theme or page builderCode written directly in the page has no address to allowAdd nonces or hashes, or move the code into a file
Tags added through a tag managerScripts appear after the page loads, from many hostsPass the nonce along, or list each kept tag's host
The payment box at checkoutIt loads in a frame from the processor's domainAllow that exact frame source and test a full order
Analytics and conversion reportsBeacons send data to addresses the policy did not listAdd each needed address to connect-src, nothing wider
Fonts, embedded videos and mapsEach loads from its own host under its own directiveAllow them per directive after the audit confirms them

We change one thing at a time, test on a staging copy where one exists, and keep the previous policy ready to restore. Before enforcing, we place a test order through your processor's test mode, submit every form and check that the conversion tags your marketing team relies on still report. If a tag manager cleanup or a move to server-side testing would remove a whole category of exceptions, we say so before writing them.

Custom sites, WordPress and hosted builders each set limits

Where your site runs decides how strict the policy can be. Here is the honest version for each, before anyone quotes you a price.

Custom and Next.js sites

Full control. The server can generate a fresh nonce for each response and the policy can be strict from launch. One trade: a page served as a cached static file cannot carry a new nonce each time, so those pages use hashes instead. This is the strongest position, and the reason we build custom websites the way we do.

WordPress

The header can usually be set at the server or the host. The hard part is the plugins and theme, which add inline scripts that change with each update. Many sites start with a report-only policy and a careful address list, then tighten as risky plugins are replaced or the site moves from WordPress to Next.js.

Hosted site builders

The platform controls the response headers, and many builders do not let a site owner set a full policy at all. We check what your plan actually allows and tell you plainly. Sometimes the strongest step available is cutting scripts and sending card entry to the processor's own page.

If you take cards, the policy also supports the card industry's script rules, and our payment page scripts service covers what your assessor may ask for. A policy does not detect a vendor quietly changing a file it is allowed to serve, which is why script change monitoring sits beside it.

Price, promises, and when a policy should wait

Content Security Policy setup starts from $575, depending on complexity, and you get a written estimate before work starts. The main drivers are the number of page types, how many kept scripts and tag manager tags need rules, whether there is a checkout, and the platform. We respond the same business day; our hours are on the contact page. Ongoing reading of reports and alerts can be added to a hosting and maintenance plan and quoted with the estimate.

  • You have no script list yet. Start with the audit. A policy drafted without one is a guess that either breaks the site or allows everything.
  • The site is compromised right now. Contain and clean first through our tampered script response, or for a classic break-in, malware removal and website security. Then lock it down.
  • Your builder will not let you set headers. Paying us to confirm that is a short call, not a project. Cutting scripts may be the whole job.
  • Your developer already runs an enforced policy with reporting. Ask to see the reports. If someone reads them, you are in good shape.

Questions owners ask about website security

Whatever your policy does not allow. Typically that means scripts from addresses you did not list or that lack today's nonce, connections to unlisted servers, and frames from unknown sites. It cannot stop a script you allowed from misbehaving inside the page, which is why the list of allowed scripts should be short and every entry should have an owner.

It can if it goes straight to enforcement. That is why we start in report-only mode, where the browser reports what it would block without blocking anything. We read the reports, fix the gaps, test checkout and forms, and enforce only once real traffic shows the policy fits the site.

It lets the page run code built from text, which gives an attacker another route around the policy. MDN's CSP guide, last modified March 22, 2026, says developers should avoid it, and Report URI's November 2026 analysis found it let a backup copy of the payload run on one affected site whose policy blocked the main file. We ask the vendor why it is needed and record the answer.

Usually yes, at the server or host level, and report-only mode is a safe start. Strict enforcement is harder, because plugins and themes add inline scripts that change with updates. Many WordPress sites run a careful address list first and tighten over time as plugins are trimmed or replaced.

A one-time code. The server creates a new random value for every page it sends, writes it into the policy and onto each script tag it approves, and the browser runs only scripts whose code matches. A script slipped into the page by someone else does not know the code, so it is refused.

From $575, depending on complexity, with a written estimate before work starts. The number moves with page types, scripts and tags that need rules, checkout, and platform. Ongoing report reading can be added to a hosting and maintenance plan and is quoted with the estimate.

Keep reading

Free · No obligation

Get a policy that holds without breaking checkout

Tell us your platform and what your pages load, if you know. We respond the same business day and send a written estimate before any header changes.

Which of these sounds like you? (pick any)

Rather talk now? Call (210) 346-0848.

CallGet a quote