You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tier 1 prior art — running app code in the browser with the user's identity #12
How do products safely run app code in the user's browser with the user's own credentials against platform APIs? Sandboxed iframes and origin isolation, CSP, token brokering versus direct token exposure, capability-scoped API access, postMessage bridges — as done by Val Town, Observable, StackBlitz, Figma plugins, Retool's app sandbox, Salesforce Lightning Web Security, Slack and Notion embedded apps, and others with real documentation. What each promises, and what none of them can promise.
Product-level output: what tier 1 can realistically offer. docs/research/tier-1-prior-art.md on branch research/tier-1-prior-art. Waits on it: Runtime tiers 0 / 1 / 2.
Every surveyed platform that serves third-party code from a real web origin puts it under a domain registered on the Public Suffix List (static.observableusercontent.com, cdn.prod.atlassian-dev.net, *.oaiusercontent.com, val.run, w-corp-staticblitz.com, githubusercontent.com). The PSL entry is what turns "different subdomain" into "different site" for cookies and Chromium process isolation; an iframe sandbox attribute alone does not. The exceptions map the alternatives: Figma's UI is a null-origin iframe, Salesforce LWS is a same-origin membrane, Retool leaves the sandbox domain to the operator, Apps Script does not document its serving domain.
None of the surveyed platforms hands third-party browser code the user's platform session or a platform OAuth token. Identity reaches the code not at all; as a signed identity assertion meant for the app's own backend (Shopify session tokens, Teams getAuthToken); or as a brokered call the platform performs "as the user" with no credential in the frame (Forge requestJira, Shopify query, Apps Script google.script.run, ChatGPT callTool, Retool queries, Slack MCP Apps with identity attached server-side).
The brokered pattern is the IETF "backend for frontend", which the OAuth browser-apps BCP (draft-27, July 2026) says is "strongly recommended for business applications, sensitive applications, and applications that handle personal data"; tokens in the page are the weaker "token-mediating backend".
What no token design fixes: in-page code "has the same privileges as the legitimate application code" (BCP §5.5); even with DPoP it "can create new DPoP proofs as long as the client is online" (RFC 9449 §11.4). A tier-1 patch is that code. The limit on damage is scope and server-side enforcement, never the sandbox.
Egress is the second universal control: a per-app domain allowlist enforced by CSP and declared in a manifest or resource metadata (Figma networkAccess, Forge permissions.external, MCP Apps _meta.ui.csp as used by ChatGPT and Slack, Shopify network_access). Forge makes admins re-approve when it changes.
Platform-held secrets never go to the browser: Retool proxies queries and applies credentials server-side; Forge "apps never have direct access to the OAuth 2.0 tokens"; Observable issues the notebook a database token "only valid for a short duration, on the order of minutes".
In-realm sandboxes are the cautionary tales: Figma abandoned the Realms shim it had shipped after a privately disclosed escape and moved to a WASM-hosted JS interpreter; Salesforce's own near-membrane README says "This library does not provide security guarantees"; Val Town went through node:vm, vm2 and Deno Workers before landing on OS processes.
Slack's Block Kit surfaces and Notion's API-only integrations mark the zero-risk end (declarative UI, identity server-side) — but neither stayed there in 2026: Slackbot now renders MCP Apps HTML in a sandboxed iframe, and Notion's Workers run custom code in a hosted server-side sandbox.
The sandbox does not follow the code when the frame is opened directly (MDN: "Sandboxing is useless if the attacker can display content outside a sandboxed iframe"); the CSP sandbox response header is what holds top-level. A tier-1 patch must be safe as a standalone page, not only as an embed.
Third-party cookie blocking is why the bridge exists (Shopify: "third-party cookies aren't reliably available in that context"; Firefox partitions, Safari blocks, iOS blocks for Teams tabs). A patch on its own site cannot hold a Patchy session cookie in an embed; it gets identity from the shell over postMessage, or none.
What tier 1 can promise: each patch on its own PSL-registered origin; no Patchy session, other patch's storage, or integration secret reachable from patch code; identity as claims plus brokered "as the user" calls scoped by a manifest the installer consents to, with the user's permission ceiling enforced server-side; egress limited to declared domains. What it cannot promise: that a patch will not misuse granted access, that readable data will not leave via an allowed domain, or that a patch cannot deceive the user inside its own frame.
What tier 0 gives up at tier 1 in this codebase: the served-page CSP is default-src 'none' with no script source and "no cookies, no auth or session on the serving host". Tier 1 opens script-src/connect-src and puts an identity next to the page; the guarantees above replace "no JavaScript" as the reason a reader is safe.
Open questions
Observable secret delivery — the docs never say whether the secret value reaches the browser sandbox (it must, for Secret() to return it).
Exact sandbox flags for Observable, Figma's UI iframe, ChatGPT app frames and Slackbot MCP Apps frames are undocumented; only Forge and Apps Script publish theirs.
Apps Script's serving origin is acknowledged as "a new domain" but never named.
Forge's per-app subdomain scheme rests on the PSL entry and a 2022 community post where Atlassian staff say the URL is not guaranteed permanent.
Salesforce's LWS considerations page returned HTTP 503 on every attempt; Salesforce's docs also never state that LWS is built on near-membrane.
How far per-site process isolation holds outside desktop Chromium (unavailable on Android under 2 GB RAM; strict origin isolation experimental; Origin-Agent-Cluster may be ignored).
Slack MCP Apps and Notion Workers are new and thinly documented (iframe origin/flags/identity for Slack; Workers limits only in third-party write-ups).
Whether tier 1 needs direct browser-to-company-API calls at all — the cost of routing everything through the broker (latency, streaming, uploads) is a build-phase question.
Consent granularity for the install flow (Forge re-prompt vs Figma written reasoning) belongs to the identity and integration-layer maps.
Activity
allisonmahmood commentedon Aug 26, 2026
Resolution
Research written, then adversarially verified against every cited source on 2026-08-26 (a claim whose source did not back it was corrected or removed). Full write-up: docs/research/tier-1-prior-art.md on
research/tier-1-prior-art.Summary
static.observableusercontent.com,cdn.prod.atlassian-dev.net,*.oaiusercontent.com,val.run,w-corp-staticblitz.com,githubusercontent.com). The PSL entry is what turns "different subdomain" into "different site" for cookies and Chromium process isolation; an iframesandboxattribute alone does not. The exceptions map the alternatives: Figma's UI is a null-origin iframe, Salesforce LWS is a same-origin membrane, Retool leaves the sandbox domain to the operator, Apps Script does not document its serving domain.getAuthToken); or as a brokered call the platform performs "as the user" with no credential in the frame (ForgerequestJira, Shopifyquery, Apps Scriptgoogle.script.run, ChatGPTcallTool, Retool queries, Slack MCP Apps with identity attached server-side).networkAccess, Forgepermissions.external, MCP Apps_meta.ui.cspas used by ChatGPT and Slack, Shopifynetwork_access). Forge makes admins re-approve when it changes.near-membraneREADME says "This library does not provide security guarantees"; Val Town went throughnode:vm,vm2and Deno Workers before landing on OS processes.sandboxresponse header is what holds top-level. A tier-1 patch must be safe as a standalone page, not only as an embed.postMessage, or none.default-src 'none'with no script source and "no cookies, no auth or session on the serving host". Tier 1 opensscript-src/connect-srcand puts an identity next to the page; the guarantees above replace "no JavaScript" as the reason a reader is safe.Open questions
Secret()to return it).near-membrane.Origin-Agent-Clustermay be ignored).