Skip to content
Giant Antique Postage Stamp style editorial illustration for the news article: CSP Allow-list experiment: a new way to fix iframe errors

CSP Allow-list experiment: a new way to fix iframe errors

By Harsh Desai
Share

TL;DR

CSP Allow-list Experiment loads apps in CSP-protected sandboxed iframes. Custom fetch intercepts CSP errors, notifies parent window to prompt domain allow-listing and page refresh.

What changed

Simon Willison published an experiment for CSP allow-lists in sandboxed iframes. A custom fetch intercepts CSP errors and relays them to the parent window. The parent prompts users to approve domains and refreshes the page.

Why it matters

Developers embedding apps face blocks from strict CSP like default-src 'none' in Simon Willison's preview. This user-driven allow-list beats static CSP in Chrome that rejects fetches outright. It enables secure third-party script loading without header changes.

What to watch for

Compare to browser dev tools CSP overrides which require manual tweaks each session. Test by loading Simon Willison's demo and triggering a script fetch violation to check modal approval flow.

Who this matters for

  • Vibe Builders: Implement this fetch-interceptor pattern to enable dynamic, user-approved third-party integrations.
  • Basic Users: Expect smoother app experiences where you can authorize blocked content via simple pop-up prompts.

Harshs take

This experiment addresses a persistent friction point in web security. By moving the allow-list decision from a static server-side header to a user-driven runtime flow, developers gain a practical way to manage third-party dependencies without compromising the entire CSP posture. It is a pragmatic solution for apps that need to load external resources in restricted environments.

Most developers rely on brittle browser-level overrides that vanish on refresh. This approach forces a cleaner architecture where the application handles its own security exceptions gracefully. It turns a hard block into a recoverable state, which is exactly how modern web applications should handle granular permissions.

Builders should adopt this pattern to improve reliability for embedded tools.

by Harsh Desai

Source:simonwillison.net

More AI news

Everything AI. One email.
Every Monday.

New tools. Model launches. Plugins. Repos. Tactics. The moves the sharpest builders are making right now, before everyone else.

No spam. Unsubscribe anytime.