Gunnar

nordisk/heimdall

docs/POLICY.md

The job policy file (format version 1)

Heimdall is a defensive sandbox. A job policy file can only narrow what a job may do. It is TOML, passed with heimdall run --policy <file>. Without --policy, every limit takes its default.

A full example is examples/policy.toml.

Rules

[limits]

KeyMeaningDefaultCeiling
fuelwasm fuel the guest may burn (always metered)1 000 000 0001 000 000 000 000
wall_time_mswall-clock timeout (epoch interruption)10 0003 600 000
memory_byteslinear memory over all guest memories256 MiB4 GiB
table_elementstable elements over all guest tables100 0001 000 000
instancescore instances the guest may create (a component guest needs 3)4100
tablestables the guest may create4100
memoriesmemories the guest may create116
stack_byteswasm stack1 MiB16 MiB
max_input_bytesthe input file64 MiB4 GiB
max_output_filesfiles the guest may emit6410 000
max_output_file_bytesone emitted file64 MiB4 GiB
max_output_total_bytesall emitted files together256 MiB16 GiB

The defaults are heimdall-core's Limits::default() (plus max_input_bytes, which only heimdall-run uses); the ceilings are heimdall-run's LIMIT_KEYS. Every key except max_input_bytes maps one to one onto heimdall_core::Limits.

The parser is heimdall_run::PolicyFile::{parse, from_bytes, load}; it has a cargo-fuzz target (fuzz/fuzz_targets/policy_file.rs).