Render it like your app does
Your iframe
Probing…
The untrusted page
Sandbox Check
Chat apps render model-written HTML in sandboxed iframes, and a single attribute decides whether that page is a stranger or your own site. Set up the iframe the way your app does. A probe page inside it tries, harmlessly, to read your cookies, call your API, send data out and move your tab.
Copy the probe as a standalone HTML page and get it rendered in your preview feature: paste it into your app, or ask your model to output it verbatim. It reports from inside the frame what it can reach. Nothing in it changes the host page; the only requests it makes are for a tiny image on this site, to test whether data can get out.
allow-scripts with allow-same-origin on srcdoc or blob URLs.srcdoc and blob frames inherit your page's CSP, so test with your real headers.message listener checks event.source. event.origin is "null" for every sandboxed frame.allow-popups-to-escape-sandbox, allow-top-navigation and an allow list you don't need.