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
- Day 1: Content-Security-Policy-Report-Only deployed
- Would block script cdn.acme-chatwidget.example
- Chat widget has no owner: left blocked, removed
- Would block connect to stats.acme-heatmap.example
- Inline script in theme footer, no nonce
- Footer code moved to a file, nonce added
- Day 12: test order through processor test mode
- Day 14: no new reports in 72 hours
- Day 15: same policy moved to the enforcing header
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
- A rule sheet that travels with every page
- Why trusting all of Optimizely failed on November 16
- Two weeks of listening before the policy says no
- Nonces, hashes and the two settings we argue about
- What breaks when a policy goes live, and how we keep it standing
- Custom sites, WordPress and hosted builders each set limits
- 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.
| What the policy did | Organizations | What that meant for visitors |
|---|---|---|
| No policy at all | 68 | Nothing stood between the payload and the page |
| Let the code run and send data out | 50 | A policy existed and did not stop it |
| Let the code run, blocked sending data out | 17 | Card and cookie theft stopped; wallet swapping did not |
| Blocked the code | 24 | About 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.

- 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
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
Deploy in report-only mode
The site behaves exactly as before. Browsers quietly report each script or connection the draft would have refused.
- 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
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.
| What stops working | Why | How we handle it |
|---|---|---|
| Inline scripts in the theme or page builder | Code written directly in the page has no address to allow | Add nonces or hashes, or move the code into a file |
| Tags added through a tag manager | Scripts appear after the page loads, from many hosts | Pass the nonce along, or list each kept tag's host |
| The payment box at checkout | It loads in a frame from the processor's domain | Allow that exact frame source and test a full order |
| Analytics and conversion reports | Beacons send data to addresses the policy did not list | Add each needed address to connect-src, nothing wider |
| Fonts, embedded videos and maps | Each loads from its own host under its own directive | Allow 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
- Start with the listThird-Party Script Audit: Every Script on Your Website, Who Owns It, and Whether It StaysWhat scripts are on your website? We load pages in real browsers, list every script with its owner and reach, and mark each one cut, keep or lock down.
- A watchdog for borrowed codeWebsite Script Monitoring: Change Detection for the Code Your Visitors' Browsers Actually ReceiveScript monitoring checks your pages in real browsers on desktop and iPhone and alerts a person when a script's contents, size or destinations change.
- Card rules, in plain EnglishPCI DSS 6.4.3 and 11.6.1: Payment Page Script Records Your Processor Can Actually ReadWhat PCI DSS 6.4.3 and 11.6.1 ask of your payment page, how your checkout setup sets scope, and the records we build. We are not a QSA and do not certify.
- Tests that stay homeServer-Side A/B Testing: Run Experiments Without Handing a Vendor Every PageServer-side A/B testing picks the version before the page is sent, so no testing script runs in the browser. When to switch, when to keep your tool.
- One container, many keysGoogle Tag Manager Audit: Clear Out Dead Tags and Decide Who Gets to PublishA Google Tag Manager audit that removes dead tags, cuts Publish rights to the few who need them and gives every remaining tag a written owner.
- Found it. Now, in order.Malicious JavaScript Injected on Your Website: The First Hours After You Find a Tampered ScriptFound malicious JavaScript or a card skimmer on your site? Preserve it, pull it, find the way in, rotate every key, then call your processor and counsel.
- Everything in Website SecuritySee the section
From the Insights desk
- Next.js or PHP? The Better Question Is Who Patches Your SiteApache, NGINX and PHP all shipped urgent fixes between November 11 and 19, 2026. PHP is not the villain, and Next.js has patch days too. The real difference is who installs the fix, how fast, and how much of your site runs code at all.
- The Optimizely Hack Was Not an Outage. It Was a Delivery.On November 16, a flaw in Optimizely's sign-up flow let an attacker slip card skimmers, wallet swappers and iPhone exploits into the testing scripts of 178 organizations, the BBC and Zoom among them. How it happened, what it did, and the fixes, in order.
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.