Skip to main content

Module label

Module label 

Source
Expand description

The security label — the content-bound classification carried by every object, and the verified clearance carried by every subject.

This is S1 (#567), the foundation of the native-MAC authz model (epic #547). It is TCB: keep it small and verifiable. The whole lattice is three orthogonal axes, each a small total/partial order, combined into one product lattice (see super::lattice).

Design invariants (epic #547 §1, design doc §1):

  • No unlabeled state. There is no Default that means “public/allow”. The absence of a label is represented by Option::None at call sites and is treated as denied by the monitor — never by a permissive default here. (We deliberately do NOT derive Default for SecurityLabel.)
  • Labels are content-truth. A label is meant to be bound to content (a manifest hash) so it cannot be relabeled without rehashing. This module defines the type; the binding seam lives in super::manifest.
  • Assurance is a lattice axis, not a flag (#548). A classical-DID peer is bounded LOW; a PQC-bound peer may reach HIGH. The dominance check then automatically prevents PQC-required data from flowing to a classical peer — no separate enforcement path.

§Representation (S1↔S4 reconciliation, epic #547)

SecurityLabel is a fixed-size, Copy + Ord + Hash value:

    level: Level (u8)  ×  assurance: Assurance (u8)  ×  compartments: CompartmentSet (u64 bitset)

Compartments are a fixed bitset, not a heap set. Each compartment name ("pii", "tenant:acme", …) is interned to a bit index by the policy (super::lattice::Lattice); the label carries only the bitset. This is what lets S4’s Access Vector Cache (#570) key on a SecurityLabel directly — no interning layer, no allocation, sub-µs hashing on the hot path. The string↔bit mapping lives in the Lattice policy (the one place the compartment vocabulary is closed and audited).

Structs§

Compartment
A need-to-know compartment name (the categories axis vocabulary).
CompartmentSet
A fixed bitset of compartment bits — the powerset-lattice axis, packed so SecurityLabel stays Copy + Ord + Hash.
CredentialClearance
The credential-clearance wire projection of a SecurityLabel (v16 §11, operator Gate-2 value 11). A credential’s clearance claim is the semantic two-element array [level, [compartments]] and NOTHING else — the assurance axis is structurally absent from the wire and is derived only from verified key material at credential admission (see super::SecurityContext::new). The authority-asserted clearance claim therefore carries THIS type, never a full SecurityLabel, so a synthetic assurance can never ride in on the wire.
SecurityLabel
A complete security label: a point in the product lattice Level × Assurance × CompartmentSet.

Enums§

Assurance
Crypto-assurance axis (#548) — a total order derived from verified key material, never claimed.
Level
Multi-Level-Security sensitivity level — a total order (the MLS axis).

Constants§

MAX_COMPARTMENTS
Number of distinct compartments representable in a label.