Every week, another developer tool ships a patch for an indirect prompt injection CVE by appending uppercase warnings to its system prompt or bolting a regex filter in front of child_process.spawn.
From a systems security standpoint, both mitigations are equivalent to placing a comment in C source code asking strcpy not to overflow the stack.
BROKEN: Single-Context / Ambient Authority (UID 501)
+---------------------------------------------------------------+
| [Poisoned README.md] + [System Prompt] -> [LLM] -> /bin/zsh |
| Has full ambient access to ~/.ssh, ~/.aws, Keychain, LAN |
+---------------------------------------------------------------+
HEIMDALL: Dual-Model Kernel Separation (UID 502 <-> UID 501)
+-----------------------------+ Mach IPC +---------------+
| Quarantined Worker (UID 502)| --------------> | Coordinator |
| 0 FS handles | 0 Net sockets| Typed Proposal | Cedar <= 45us |
+-----------------------------+ +-------+-------+
|
[SEP Touch ID]
The Confused Deputy Inside Your Terminal
An LLM token stream is a single flat sequence of embeddings. Once untrusted bytes from a git diff, stack trace, or fetched documentation page enter that context window, every downstream tool invocation becomes a textbook Confused Deputy.
Regex filters and secondary “judge” LLMs fail for two structural reasons:
- Completeness Failure: Attackers encode instructions across line breaks, hex literals, commit metadata, or base64 test fixtures that the coding model decodes in-context after the input filter runs.
- Latency & Utility Tax: Secondary LLM classifiers add
150ms–400msper turn while falsely flagging legitimate security patches or SQL migration scripts.
Kernel-Enforced Dual-Model Privilege Separation
Heimdall-Enclave removes ambient authority from the model ingesting untrusted data:
- Isolated Darwin UID (
502): The Quarantined Synthesizer drops privileges immediately at spawn and enters an immutable Darwin sandbox (no-network,no-file-read*,no-process-exec). Even arbitrary native code execution inside the worker yields zero host credentials. - Typed Mach Port IPC: Communication back to the Executive Coordinator (
UID 501) accepts strictly bounded Cap’n-style typed capability requests—never free-form bash pipelines. - Deterministic Cedar Evaluation: Every proposed action is checked against machine-verified Cedar invariants (
p99 <= 45us) before issuing a scoped WASI 0.2 handle or triggering a Touch ID SEP sheet.
Limitations & Trade-Offs
- Explicit Capability Wiring: Tools can no longer rely on ambient
$PATHor~/.configfiles; workflows require explicit directory/host capability grants. - IPC Serialization Cost: Crossing the Mach IPC + Cedar boundary adds
~83usp99overhead per tool call (negligible next to token generation, but measurable in tight >10k/sec micro-loops).
Verify Locally
git clone https://github.com/w8mej/heimdall-enclave.git
cd heimdall-enclave && cargo test -p heimdall-ipc --release