#[non_exhaustive]pub enum Tier {
InProcess,
Subprocess,
Wasm,
MicroVm,
}Expand description
How strongly a tool is isolated from the machine it runs on.
Ordered by strength, weakest first, and that ordering is load-bearing:
Tier::weakest is how a flow’s overall isolation is summarised, and
summarising it any other way would let one unconfined tool hide behind
several confined ones.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InProcess
In this process, sharing its address space. Trusted built-in tools only.
Subprocess
A jailed subprocess. The safe default for anything not written here.
Wasm
Wasmtime with WASI preopens. The Profile C tier.
MicroVm
A microVM. Scheduled after Wasm; named so the vocabulary is complete.
Implementations§
Source§impl Tier
impl Tier
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
The name used in a manifest, a plan, and a ledger entry.
Sourcepub const fn is_virtualising(self) -> bool
pub const fn is_virtualising(self) -> bool
Whether this tier virtualises the tool’s view of the machine.
What Profile C asks for. In-process and subprocess do not: the first shares the address space, and the second shares the kernel’s namespaces unless something outside the tier has separated them.
Sourcepub const fn requires_trust(self) -> bool
pub const fn requires_trust(self) -> bool
Whether a tool has to be trusted for this tier to be safe.
True only in-process, and it is the whole reason that tier refuses anything not built in: a tool sharing this address space is not confined by anything at all, so the only control left is who wrote it.
Sourcepub fn weakest(tiers: impl IntoIterator<Item = Self>) -> Option<Self>
pub fn weakest(tiers: impl IntoIterator<Item = Self>) -> Option<Self>
The weakest tier in a collection, if there is one.
How a flow’s isolation is reported. A flow is only as isolated as its least isolated tool, and saying anything else would let one in-process tool hide behind a dozen sandboxed ones.
Trait Implementations§
impl Copy for Tier
Source§impl Default for Tier
The safe default: anything that did not say gets a subprocess.
impl Default for Tier
The safe default: anything that did not say gets a subprocess.
D1 calls process isolation “the safe default for untrusted code”, and a manifest that forgot to declare is exactly the case that needs one. Defaulting to in-process would mean a forgotten field silently bought full trust.