messageport container mesh
Why this matters
Putting untrusted input processing and sensitive secrets inside one shared Linux container gives any compromised shell command ambient read access to sibling files. This lab boots two completely separate 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 by a policy-mediated MessageChannel—and includes an Unfiltered Naive Relay switch to test what breaks when channel policy enforcement is removed.
What this opens up
Zero-server multi-container pipelines directly in a browser tab using standard POSIX tools (sh, awk, sha256sum): Container A pipes untrusted CSV files from /work through /run/kw/bin/port-call compute_totals, Container B computes aggregates against private tables in /vault without exposing /vault/canary-secret.txt, and one click closes both ports with 410 PORT_REVOKED.
How the tests work
- Click 1. Boot Both Containers to start
ingest-vm(/work) andvault-vm(/vault) as two independent Linux 7.x WebAssembly kernels and verify distinct hostnames, PIDs, mount trees, and loopback-only networking. - Click 2. Run Cross-VM Pipe to execute
sh -c "cat /work/raw-orders.csv | port-call compute_totals"inside Container A and observe Container B run real Linuxawkandsha256sumagainst/vault/pricing.json. - Click 3. Fire All 3 Attacks in Policy-Mediated Broker mode to verify
ENOENTon/vault,403 POLICY_DENIEDonport-call read_secret, and zero-network failure onwget—then flip the toggle to Unfiltered Naive Relay and re-run to observe live canary exfiltration. - Click 4A. Revoke Port to close both
MessagePortends immediately (410 PORT_REVOKED), reconnect a freshMessageChannelwithout rebooting Linux, and click 4B. Run Benchmark to compare cloned JSON against zero-copy transferableArrayBuffertransfers (byteLength === 0detachment proof).
Hypothesis
Splitting untrusted ingestion and private vault computation across two zero-network browser Linux 7.x VMs prevents cross-container secret exfiltration ONLY when the connecting
MessagePortis mediated by an explicit operation allowlist, argument path guard, and canary egress filter.
What confirms it: Direct cat /vault/canary-secret.txt inside Container A returns kernel ENOENT, wget fails with loopback-only networking, port-call read_secret returns 403 POLICY_DENIED, cat /work/raw-orders.csv | port-call compute_totals returns aggregated totals from Container B’s awk/sha256sum, and port.close() cuts off traffic with 410 PORT_REVOKED.
What bounds or disproves it: Flipping the broker mode to Unfiltered Naive Relay allows port-call read_secret /vault/canary-secret.txt from Container A to exfiltrate CANARY_VAULT_SECRET_9f83c1a4_DO_NOT_EXFILTRATE across the MessagePort, proving transport separation without frame policy enforcement is insufficient.
Under the hood
MessagePort Container Mesh (GitHub) instantiates public/container-worker.js twice in separate Dedicated Workers, booting two independent Unkernel Linux 7.x kernels (memoryMiB: 96 each, zero external network devices):
- Container A (
ingest-vm) mountsMemoryFsat/work(raw-orders.csv,README.md) and registers/run/kw/bin/port-calland/run/kw/bin/port-pinghost commands that forward stdin and arguments as structured RPC frames over itsMessagePort. - Container B (
vault-vm) mounts privateMemoryFsat/vault(pricing.json,canary-secret.txt), receives validated RPC frames on itsMessagePort, executes real Linux/bin/awkand/bin/sha256suminside the guest against/vault/pricing.json, and returns only aggregated totals and payload digests. - Port Broker (
public/lib/port-broker.js) mediates theMessageChannelpair between both workers, enforcing an explicit operation allowlist (compute_totals,hash_payload,health), blocking traversal or/vaultarguments (403), scanning egress responses for canary strings, recording every frame in the wire audit log, and closing both ports immediately on revocation (410 PORT_REVOKED). Switching the broker to Unfiltered Naive Relay bypasses policy validation so readers can test the falsification signal directly againstcanary-secret.txt.
Key terms & further reading
- Unkernel (Linux 7.x on WebAssembly) ↗
- An aarch64 Linux 7.x kernel compiled to WebAssembly that runs standard POSIX userland binaries (
sh,awk,sha256sum) inside a browser Dedicated Worker with zero server compute. - WebAssembly JSPI (WebAssembly.Suspending) ↗
- JavaScript Promise Integration allows synchronous WebAssembly kernel execution to suspend cleanly on asynchronous host I/O such as 9p virtual filesystems and host command bridges.
- MessageChannel & MessagePort ↗
- A transferable pair of capability ports defined by the HTML Standard that establish a private point-to-point channel between two Dedicated Workers and terminate immediately on
port.close(). - Transferable ArrayBuffer ↗
- Passing an
ArrayBufferin thepostMessage(msg, [buf])transfer list moves ownership across workers without copying bytes, detaching the sender buffer (byteLength === 0). - Unkernel Host Commands (/run/kw/bin/*) ↗
- Virtual binaries mounted on the guest
$PATHthat bridge Linux stdin, stdout, stderr, and argv over vsock into host JavaScript handlers. - Dedicated Worker Isolation ↗
- Each Dedicated Worker runs in an isolated JavaScript realm with its own linear
WebAssembly.MemoryandMemoryFstree, preventing Container A from referencing Container B’s/vault.
Open questions
- How does two-VM memory overhead (~192 MiB total for two 96 MiB kernels) scale on constrained mobile devices if a workflow needs three or four isolated container stages?
- Could streaming
ReadableStreamtransfers overMessagePortreplace bufferedArrayBufferframes for multi-megabyte Linux pipeline payloads?
Iteration log
- — Initial deployment: two real Unkernel 0.3.0-261202-b033dc7 Linux 7.x Dedicated Workers (
ingest-vmandvault-vm), pureport-broker.jspolicy gate with switchable Unfiltered Naive Relay mode, liveport.close()revocation, transferableArrayBufferbenchmark, and 12 automated tests including two-VM Node integration.
Primitives tested: Unkernel Linux 7.x, WebAssembly JSPI, Dedicated Worker, MessageChannel, Transferable ArrayBuffer, MemoryFs (9p).
This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.