Skip to main content

Module lattice

Module lattice 

Source
Expand description

The MAC lattice as policy — defined once, versioned, pinned.

Two things are deliberately separated here:

  1. The order algebra (dominance ⊒, join ⊔) is fixed and lives on SecurityLabel itself. It is the product order of Level × Assurance × CompartmentSet. It never depends on site policy, so the per-op monitor (S2) can compute dominance with zero policy lookups — content truth only.

  2. The well-formedness policy (which compartments exist + their stable bit assignment, the lattice version) lives in Lattice. This is the “defined once as policy” object (design §3). It is consulted at label-creation / enrollment / genesis time to (a) intern compartment names into the bit indices a SecurityLabel carries, and (b) reject typo’d / unknown compartments — NOT on the hot path. Closing the compartment vocabulary is what makes labels auditable and keeps the TCB small.

Why split them? Because the dominance check must be uncircumventable and trivially verifiable. If dominance consulted policy, a policy bug could grant access. By keeping the order intrinsic and only validating membership against policy, a policy bug can at worst reject a legitimate label (fail-closed), never widen access.

§S1↔S4 reconciliation: the name↔bit interner lives here (#547)

Because SecurityLabel carries a packed CompartmentSet bitset (so S4’s AVC can key on it directly), the one place that maps a compartment name ("pii") ↔ a bit index is this policy object. Genesis / enrollment resolve names → bits via Lattice::intern; nothing on the per-op hot path ever touches a string.

Structs§

Lattice
The active lattice policy: the closed compartment vocabulary (name↔bit) and the version. Levels and assurances are fixed by their enums (TCB), so only the open dimension — compartments — needs a registry.
LatticeCodecError
Failure decoding a Lattice from its canonical byte form: either the CBOR itself was malformed or the decoded vocabulary was rejected (see LatticeDecodeError). Carries a rendered message; the distinction is not load-bearing for callers, which fail closed either way.
LatticeVersion
Monotonic lattice policy version. Crypto-agility / policy-agility rule (design §14): the suite/lattice is pinned and versioned; migration is a deliberate version bump, never an in-band negotiation. Labels and the (UCAN, bundle_hash) approval (S5) bind this version so a label minted under v1 can’t be silently reinterpreted under v2.

Enums§

LabelError
Reasons a label fails the well-formedness policy. All are fail-closed.
LatticeDecodeError
Reasons a serialized Lattice is rejected on decode. All fail-closed: a malformed wire vocabulary never silently becomes a smaller/different lattice.