How to safely serve user-generated HTML using a cookieless-origin sandbox pattern
A developer behind ShareMyPage, a platform that hosts LLM-generated HTML pages, has detailed a security architecture for safely rendering arbitrary user-supplied HTML in browsers. The approach combines three layers: serving untrusted content from a separate, cookieless domain to enforce origin isolation, applying an iframe sandbox attribute without allow-same-origin to give scripts a null origin, and using short-lived signed JWTs as access-control tokens instead of session cookies. Because the content origin never sets or receives session cookies, even a failure in origin isolation leaves no credentials to steal. Access control and damage containment are handled as two distinct problems — signed URLs answer who may view a page, while origin isolation limits what any malicious code can do. The pattern is applicable beyond ShareMyPage to use cases such as email renderers, no-code builders, and AI artifact viewers.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in