Gunnar

nordisk/heimdall

crates/heimdall-run/src/lib.rs

// SPDX-License-Identifier: AGPL-3.0-only
//! Heimdall run: ties one job together (spec §8).
//!
//! **Heimdall is a defensive sandbox.** heimdall-run takes one wasm job end to
//! end: it reads the job's input dir, runs the guest through heimdall-wasm,
//! writes the guest's files into a fresh out dir, hashes them and signs the
//! JobResult with heimdall-core's per-boot key. The caller then trusts only
//! that signed result, never the untrusted bytes.

pub mod fuzz_api;
pub mod indir;
pub mod job;
pub mod outdir;
pub mod policy_file;
pub mod runner;
pub mod verify;
pub mod wasm;

pub use indir::{read_single_input, InputError, InputFile};
pub use job::{run_job, GuestRun, GuestRunner, GuestVerdict, JobError, JobOutcome, JobSpec};
pub use outdir::{validate_output_name, OutDir, OutDirError, OutputCaps, WrittenOutput};
pub use policy_file::{PolicyError, PolicyFile, RunLimits};
pub use runner::{params_from_json, run_limits_from_core, WasmJobRunner};

impl RunLimits {
    /// The output caps the out dir enforces.
    pub fn output_caps(&self) -> OutputCaps {
        OutputCaps {
            max_files: self.max_output_files,
            max_file_bytes: self.max_output_file_bytes,
            max_total_bytes: self.max_output_total_bytes,
        }
    }
}