CSP for a TypeScript Playground: Before and After

Running a TypeScript playground is where nice, clean CSP ideas go to get punched in the face. You want a browser app that accepts arbitrary code, transpiles it, maybe runs it in a preview, stores snippets, loads analytics, and still keeps a tight Content Security Policy. That combination gets messy fast. I’ve built this kind of thing before, and the first version usually cheats: unsafe-inline, unsafe-eval, and a quiet promise to “fix it later.” ...

October 21, 2026 · 7 min · headertest.com

CSP for Stitches: Locking Down CSS-in-JS

If you use Stitches, CSP gets awkward fast. The problem is simple: Stitches is a CSS-in-JS library, and CSP is usually hostile to anything that injects styles at runtime. That does not mean they cannot work together. It means you need to be deliberate about how styles are rendered, when they are injected, and which CSP directives you allow. I’ve seen teams ship a pretty solid script-src policy, then quietly leave style-src 'unsafe-inline' forever because CSS-in-JS made cleanup feel painful. That is usually where the security story falls apart. ...

October 20, 2026 · 7 min · headertest.com

CSP for C3.js: Common Mistakes and Fixes

C3.js is handy because it gets you from raw data to charts fast. It’s also one of those libraries that tends to expose every weak spot in a sloppy Content Security Policy. I’ve seen teams lock down CSP, deploy C3.js, and then spend an afternoon wondering why the chart container stays blank while the console screams about blocked scripts or styles. Usually the breakage isn’t C3 itself. It’s the mix of D3, inline config, CDN habits, and CSS assumptions. ...

October 17, 2026 · 7 min · headertest.com

CSP for Ant Design: Nonces, CSS-in-JS, and Real Policies

Ant Design is one of those UI libraries that looks harmless from a CSP perspective until you actually turn on a strict policy. Then things get weird fast: styles stop rendering, wave effects break, overlays look unstyled, and your console fills with CSP violations. I’ve hit this enough times that I treat Ant Design as a “plan CSP early” dependency, not a “bolt it on later” one. The main issue is styling. Depending on your Ant Design version and setup, the library may inject styles dynamically. A strict style-src can block that unless you configure nonces properly. If you’re also using server-side rendering, React hydration, analytics, and a consent manager, the policy gets more realistic than a toy default-src 'self'. ...

October 16, 2026 · 7 min · headertest.com

CSP for Rust Playground: lock down code execution

If you’re building a Rust Playground-style app, your threat model is ugly in all the fun ways. You’re taking user input, compiling or executing code, rendering output, maybe embedding an editor, maybe shipping WebAssembly, and probably sprinkling in some analytics or third-party UI bits because product people always want one more script. That’s exactly the kind of app where Content Security Policy earns its keep. A Rust Playground is not just “another website.” It’s a code execution surface with a browser front end. Even if your actual Rust execution happens in a locked-down backend container, your frontend is still exposed to XSS, supply-chain script injection, data exfiltration, and clickjacking. CSP helps reduce that blast radius. ...

October 13, 2026 · 7 min · headertest.com

CSP for Mermaid Diagrams: A Before-and-After Case Study

I’ve seen this exact failure pattern a few times: a team adds Mermaid to docs or an internal dashboard, the diagrams look great locally, then production CSP quietly wrecks everything. The symptoms are boring but expensive: diagrams don’t render initialization throws console errors someone “fixes” it by adding 'unsafe-inline' or weakening script-src now the page works, but the policy got worse Mermaid is a perfect example of where frontend convenience collides with a real CSP. If you run a site with a strict policy, you can’t just paste the snippet from a README and hope for the best. ...

October 11, 2026 · 6 min · headertest.com

CSP for Google Docs Viewer: What to Allow and What to Avoid

If you’ve ever embedded a PDF, DOCX, or PPTX with Google Docs Viewer, you’ve probably hit the same wall everyone does: your Content Security Policy breaks it. That’s not a bug. That’s CSP doing its job. The annoying part is that Google Docs Viewer sits in an awkward middle ground. It’s convenient, familiar, and dead simple to drop into an <iframe>. But once you care about a tight CSP, third-party framing gets messy fast. You have to decide how much trust you want to hand to Google for a document-rendering feature that may not even be essential. ...

October 5, 2026 · 6 min · headertest.com

CSP for Material UI (MUI): What Actually Works

Material UI is one of those libraries that makes frontend teams fast and security teams nervous. The problem is simple: MUI relies on runtime-generated CSS. CSP, if you configure it properly, is hostile to runtime-generated inline styles unless you make an exception. That tension forces a choice: loosen your policy, wire up nonces correctly, or rethink how styles are injected. If you’re building with MUI, the right CSP setup depends on which styling path you’re using: ...

October 4, 2026 · 6 min · headertest.com

CSP for LSD: Securing Layered CSS Without Breaking It

CSS got weird again, in a good way. Between @layer, design tokens, component libraries, runtime theming, and CSS-in-JS leftovers, a lot of teams now have what I’d call an LSD setup: a Layer System for CSS. You split styles into predictable layers like reset, tokens, base, components, utilities, and overrides. That’s cleaner than the old cascade knife fight. But CSP can get awkward fast, especially when your CSS pipeline injects styles, swaps themes at runtime, or leans on inline <style> blocks. ...

October 3, 2026 · 7 min · headertest.com

CSP for DartPad: Lock It Down Without Breaking It

DartPad-style apps are a weird CSP target. You’re not just serving a normal frontend. You’ve got inline bootstrapping code, dynamic script loading, iframes, workers, API calls, maybe WebSockets, and often some analytics or consent tooling bolted on top. That combination is exactly where people give up and slap unsafe-inline and unsafe-eval into production. I’ve done that under deadline pressure. I’ve regretted it every time. If you’re building something like DartPad, the goal is to allow the platform features you actually need without turning CSP into decorative security theater. ...

October 1, 2026 · 6 min · headertest.com