[DO NOT MERGE] Codex/realm isolation ses spike - #5663
Conversation
Preview deploymentsHost Test Results 1 files 1 suites 2h 36m 18s ⏱️ Results for commit 5b09fa4. For more details on these errors, see this check. Realm Server Test Results 1 files 1 suites 12m 8s ⏱️ Results for commit 5b09fa4. For more details on these errors, see this check. |
|
[Claude Code 🤖] Evaluation of this spike against the security audit it responds to. Findings below were verified against the branch — code citations are SummaryThe spike is a real proof that an unmodified card can render with no ambient authority, and the containment it implements holds under adversarial probing — the standard SES escape routes are all closed. The gaps are in coverage, resource limits, invalidation, and compatibility rather than in the compartment mechanism itself. Measured against the audit's thirteen acceptance criteria, one is fully met (external packages version- and integrity-pinned) and two are substantially met (no live Ember/store/card/DOM object crosses into a compartment; cross-realm reads are authorized under the user's principal). The rest are open. What holdsHostile module source driven through
The strongest design decision here is that trusted imports are inert tokens rather than real modules. A card importing
The loader refactor stands on its own merits. CoverageSandboxing engages for cards the Store deserializes and Still evaluating realm-authored code in a trusted JS realm: indexing, prerendering, the Two bypasses sit inside Interact mode itself:
Both make Compartment tier findingsNo resource limits, and the default tier is on the main thread. Card code occupied the event loop with zero host timer ticks during the spin. There is no termination path. The worker tier that would provide one is opt-in and cannot run stateful cards. Module fetch is a confused deputy.
Iframe tier
Items to resolve before enabling it:
Cross-loader invalidationThe topology is now The compartments are not in that set:
Net: editing a sandboxed card, or another client changing it, leaves the evaluated module live in that principal's compartment for the rest of the session. Cross-realm compounds it, since realm A's compartment holds its own copy of realm B's module and neither invalidates. Code-mode preview is unaffected because it has its own path. Performance and cachingNo benchmark, perf test, or memory baseline is added or run on this branch, including
What keeps the added loaders from being an N× bandwidth multiplier is the shared Card compatibilityInside the compartment: From the branch's own corpus audit: Dynamic import deserves specific attention because it is supported today. The transpiler rewrites Error reporting
Relative to the current behavior, an author loses the Two things that are parity rather than regression: stack line-number fidelity was already lossy because the realm server emits no source map, and neither the current code nor this branch has an error boundary, so a throwing getter behaves the same. Worth verifying
Suggested order
Separately, Probe testsThe containment results above come from a QUnit module that drives hostile source through the same runtime a card takes. It asserts the containment invariants so a regression fails loudly, and separately pins three current gaps — the arbitrary-origin fetch, the dynamic-import |
No description provided.