Gunnar

nordisk/heimdall

docs/RUN.md

Running one job (heimdall-run)

Heimdall is a defensive sandbox. heimdall-run takes one wasm job end to end. The caller trusts only the signed result it produces, never the untrusted input or the guest's bytes.

Steps

  1. Load the policy file (see POLICY.md).
  2. Create the out dir (rules below). Nothing has run yet; if this fails, the job does not start and no result is written.
  3. Read the input dir (rules below).
  4. Run the guest through heimdall-wasm with the policy's limits. The guest's emit-file(name, bytes) calls become files in out/files/.
  5. Hash every output (sha256) and audit out/files/: it must hold exactly the files Heimdall wrote, unchanged.
  6. Build the JobResult (verdict, outputs with hashes, start and finish time) and sign it with heimdall-core's per-boot key. Write it to out/result.signed.

Input and out-dir problems stop the job before the guest runs; then no result exists (and an input problem leaves no out dir behind). Everything after the guest started ends in a signed result:

What happenedVerdictOutputs kept
the guest returned ok and every file was writtenAcceptedall
the guest returned err(refusal)Refused (the guest's reason)the files it emitted (a refusal report is a legitimate output)
a trap or a limit hit (guest trapped (<why>))Refusednone
an emitted name broke the rules, a name came twice, or an output cap was hitRefused (output refused (<why>))none
out/files/ did not match what Heimdall wroteRefused (output audit failed (<why>))none

The result lists the outputs in emit order with their sha256 and length, a fuel event (used, limit), one emit-file event per file (a refused one is logged as Refused), and the run's isolation features.

The key

One heimdall process is one boot: it makes a fresh Ed25519 key (heimdall-core BootKey), never writes the secret half anywhere, and hands the caller the public record (heimdall-boot-key v1 <key id> <boot id> <public key>) on stdout and, with --pin-out <file>, in a new file. The caller pins that record and verifies the result with it.

The input dir

In milestone 1 a wasm job takes exactly one input.

The out dir