AI Focus

slice capability mesh

Granting scripts or plugins access to browser storage normally exposes an entire origin’s localStorage or IndexedDB, making folder-level isolation hard to enforce. This lab mints narrow, revocable /cap/<token>/... Service Worker URLs scoped to specific OPFS subdirectories without leaking sibling folders.

Hypothesis

A Service Worker /cap/<token>/<path> broker keeps storage scoped per task ONLY when untrusted consumers are isolated in opaque origins and OPFS blobs are encrypted per slice behind salted hashed names.

What confirms it: Opaque <iframe sandbox="allow-scripts"> throws SecurityError on navigator.storage.getDirectory(), page disk enumeration shows only blob-<hash>.enc envelopes, and cross-slice decryption rejects with OperationError.

What falsifies or bounds it: Any same-origin script can reconstruct slice contents or enumerate plaintext directory names directly from navigator.storage.getDirectory() without holding the non-extractable slice key.

OPFS + Service Worker FetchEvent capability broker minting scoped read-only or read-append URL tokens with traversal blocking, immediate revocation, and byte-transfer auditing. Open slice capability mesh full screen ↗

What this lab tests

Granting a page or embedded script ambient origin storage (localStorage, IndexedDB, or full storage roots) exposes unrelated secrets across tasks. How do native browser primitives enforce per-task least-privilege file access instead?

Slice Capability Mesh (GitHub) seeds sample directories inside Origin Private File System (OPFS) (private/, workspace/, shared/), mints short-lived capability tokens tied to /cap/<token>/<path> routes, and enforces directory containment, read-only vs. read-append permissions, path-traversal rejection (../), max read counts, and immediate revocation inside a Service Worker FetchEvent broker.

Open questions

  • What happens to UX and throughput when large binary files stream through AES-GCM chunk encryption inside sw.js?
  • When will browsers ship Service-Worker-private storage buckets (StorageBucket) so page scripts never share an OPFS directory tree with the broker?

Iteration log

  • — Initial deployment: OPFS directories + Service Worker FetchEvent capability URLs with traversal and write-escalation guards.
  • — Added per-slice non-extractable AES-256-GCM keys, salted SHA-256 opaque blob IDs (opfs://vault/), <iframe sandbox="allow-scripts"> attack probe, and CSP-safe syntax highlighting.
  • — Moved the interactive OPFS vault workbench above the setup blueprint for 700px embeds, updated setup snippets to match AES-256-GCM vault decryption, and routed all static CSS/JS assets through the Worker with no-cache headers (29 passing checks).

Primitives tested: OPFS, Service Worker FetchEvent, ReadableStream, URL Capability Tokens.

This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.

More in browser containment & sandbox boundaries

Connected labs

← browser containment & sandbox boundaries · All labs