assistant-ui logo/

Untrusted content, contained.

Render model-generated HTML, PDFs, or any blob in a sandboxed iframe with a hashed origin per render, on a separate domain from your app. Pure JS.

README on GitHub
input · html
fig. 01 · the attempt · edit and render
output · sandboxrendering
fig. 02 · the containment

Unique origin

Each render gets a hashed origin on scf.auiusercontent.com, a separate eTLD+1 from your app.

Sandboxed iframe

Content runs with allow-scripts. It cannot reach the parent page.

No parent storage

Scripts cannot read document.cookie or localStorage on your domain.

Vanilla JS

Framework-agnostic. No React or DOM-framework dependency.

The setup

untrusted.ts

The surface

12

renderHtmlrenderRawrenderPdfiframeoriginsendMessagefullyLoadedPromiseWithTimeoutdisposeuseShadowDomenableBrowserCachingsandboxsalt

Three renderers, a handle per frame, and four options, including a shadow-DOM variant at safe-content-frame/shadow_dom.