From 5171bcc9917fd3cbc8f0b1b3ab5b5abb8f4f88a1 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 25 May 2026 14:00:06 +0000 Subject: [PATCH] Studio: serve HTML preview from a same-origin route so inline scripts run Closes the long-documented follow-up. Inline '; -// Meta-CSP enforced INSIDE the srcdoc iframe. Chromium inherits the -// embedder CSP into srcdoc, data:, AND blob: iframes per HTML / CSP3 -// ยง initialize-document-csp, so the host Studio ``script-src 'self'`` -// already blocks assistant inline scripts and on* handlers here -- -// confirmed empirically on the live Studio with a click-to-alert demo. -// Until a same-origin backend route is added (response-header CSPs -// do NOT inherit), the preview deliberately ships as a static-render -// surface. The meta-CSP below is defense in depth: it adds -// ``connect-src 'none'`` + ``frame-src 'none'`` so even if the host -// CSP ever loosens enough to let inline scripts run, the preview -// still cannot beacon out or nest tracking iframes. +// Fallback for when the same-origin preview route is unreachable (offline, +// 404, transport error). srcdoc inherits the host page's ``script-src +// 'self'`` per HTML / CSP3, so this path is static-layout-only -- inline +// ``