Skip to main content

Module mac

Module mac 

Source
Expand description

Native MAC: security labels, lattice, subject contexts, genesis labeling (S1, #567). Platform-independent (no std-only deps) so it compiles for wasm. Native MAC — security labels, the lattice, subject contexts, and genesis labeling. S1 (#567), the foundation of epic #547.

This module is the TCB seam the rest of the security epic consumes. It defines what a label is, how labels compare (dominance ⊒ and IFC join ⊔), where a subject’s clearance comes from, where an object’s label comes from, and how everything gets an initial label (genesis). It deliberately contains no enforcement, no policy distribution, and no token logic — those are S2/S4/S6.

§The lattice (small + verifiable, by design)

A label is a point in the product lattice

    Level  ×  Assurance  ×  P(Compartment)
    (MLS)     (#548)         (need-to-know)
  • Level — total order public < internal < confidential < secret.
  • Assurance — total order unverified < classical < pq-hybrid, derived from verified key material (#548), never claimed.
  • Compartments — powerset lattice under ⊆ (a closed vocabulary, policy).

Dominance is the product order (≥ on each total axis, ⊇ on the compartment set); join is component-wise (max / max / ∪). Both are pure functions on SecurityLabel with no policy argument — content truth, uncircumventable.

§Interface contract for S2 (enforcement) and S4 (PDP)

S1 hands the downstream tickets exactly these stable entry-points:

  • S2 — reference-monitor per-op check (#568). For each op the monitor:

    1. obtains the object label via [manifest::LabeledObject::security_label] — None ⇒ DENY (unlabeled object);
    2. obtains the subject context via [context::SubjectContextClaims::security_context] (clearance from verified claims, assurance derived from verified key material) — None ⇒ DENY (unlabeled subject);
    3. evaluates the MAC floor [context::SecurityContext::can_access] (≡ SecurityLabel::can_access) — false ⇒ DENY. The monitor takes object labels ONLY from LabeledObject, never from a token/UCAN/caveat (design §3, §14). It needs no Lattice on the hot path: dominance is intrinsic.
  • S2 — IFC at seal/rollup (#568). A derived object’s label = SecurityLabel::join_all over its provenance inputs’ labels. Aggregation cannot launder classification.

  • S4 — PDP / lattice engine (#570). The PDP owns the [lattice::Lattice] policy object: it validates labels at enrollment/seal, exposes the pinned [lattice::LatticeVersion] for the (UCAN, bundle_hash) approval binding (S5), and computes the label-ceiling clamp (§5a) as min/dominance over the lattice. The PDP never re-implements the order — it reuses the intrinsic SecurityLabel algebra, so the PDP’s clamp and the monitor’s floor are provably the same relation.

  • Both — derived value: effective = approved-ceiling ∩ MAC clearance ∩ self-attenuation (design §5). The “∩ MAC clearance” factor is exactly the dominance/clamp defined here; S5/S6 compose it, they do not redefine it.

§BLOCKERS (what S1 cannot finish, and why)

S1 ships everything that is genuinely unblocked (the label + lattice + ops + subject context + genesis mechanism + static-node labels, all tested). The following are defined as seams here but gated on other work:

  1. Content-bound manifest labels ← the data-plane CAS manifest store. The content-addressed manifest with a security_label field does not exist yet (today’s “manifests” are OCI image / release / context manifests, none data-plane CAS). S1 defines the [manifest::ContentBoundLabel] contract + [manifest::LabeledObject] seam; the implementation (label-in-CID binding + verify_binding) lands with the CAS manifest layer. Static-node labels are NOT blocked and are implemented here.

  2. Subject clearance wire field on Claims/envelope ← S8 (#574, hybrid envelope). S1 defines the [context::SubjectContextClaims] trait that the verified claims will implement; the concrete clearance field is added to Claims / common.capnp under S8 so the new authz field ships on the hybrid-signed (EdDSA + ML-DSA-65) envelope, not the classical one. Until then S2/S4 program against the trait and test with a stub.

  3. Assurance derivation source ← #441 / #280 (authoritative key binding)

    • register_pq_trust. [context::VerifiedKeyMaterial] is the seam; the production of it (was the ML-DSA-65 anchor actually bound + verified for this identity?) is the envelope-verification + key-binding layer’s job. Until a binding is authoritative, an identity is Classical at best and Unverified if even the classical signature can’t be checked — both fail-closed.
  4. Compartment vocabulary / genesis content ← S3 (#569, $scope/TE annotations). S1 defines [lattice::Lattice] (the closed vocabulary holder) and [genesis::GenesisMap] (the path→label mechanism + the completeness gate); the actual compartment names and the per-node label table come from the schema annotations + site policy that S3 produces.

  5. PQ-confidentiality labels are unsatisfiable today ← #153 (streaming DH → ML-KEM-768 hybrid KEM). The assurance axis covers signature assurance, which is shippable. A future confidentiality requirement (data that must travel a PQ-KEM path) has no satisfying transport until #153 wires pq_kem_ciphertext; such a label is simply undominated → fail-closed, which is correct. No type change needed when #153 lands — it’s a new compartment/level value, not a new axis.

Re-exports§

pub use activation::anonymous_floor;
pub use activation::block_identity_widening_for_unverified_attach_transport;
pub use activation::flush_verified_subject_cache_generation;
pub use activation::global_mac_activation_control;
pub use activation::remember_verified_claims;
pub use activation::remember_verified_claims_with_credential;
pub use activation::remember_verified_subject;
pub use activation::revoke_verified_subject_credential;
pub use activation::subject_context;
pub use activation::subject_context_with;
pub use activation::MacActivationControl;
pub use activation::MacActivationError;
pub use activation::MacActivationEvidence;
pub use activation::MacActivationMode;
pub use bind::clamp_descendant;
pub use bind::BindLabel;
pub use bind::BindLabelMap;
pub use context::SecurityContext;
pub use context::SubjectContextClaims;
pub use context::VerifiedKeyMaterial;
pub use dispatch_pep::check_dispatch_mac;
pub use dispatch_pep::global_mac_dispatch_pep;
pub use dispatch_pep::install_mac_dispatch_pep;
pub use dispatch_pep::DefaultMacDispatchPep;
pub use dispatch_pep::DenyAllMacPep;
pub use dispatch_pep::DenyAllObjectResolver;
pub use dispatch_pep::MacDecision;
pub use dispatch_pep::MacDenyReason;
pub use dispatch_pep::MacDispatchPep;
pub use dispatch_pep::RpcObjectLabelResolver;
pub use genesis::GenesisMap;
pub use genesis::GenesisReport;
pub use label::Assurance;
pub use label::Compartment;
pub use label::CompartmentSet;
pub use label::CredentialClearance;
pub use label::Level;
pub use label::SecurityLabel;
pub use label::MAX_COMPARTMENTS;
pub use lattice::LabelError;
pub use lattice::Lattice;
pub use lattice::LatticeCodecError;
pub use lattice::LatticeDecodeError;
pub use lattice::LatticeVersion;
pub use manifest::bind_time_label;
pub use manifest::import_label;
pub use manifest::ContentBoundLabel;
pub use manifest::LabeledObject;
pub use manifest::ObjectLabelResolver;
pub use manifest::ObjectRef;
pub use manifest::StaticNodeLabel;
pub use moq_resolve::DeclaredTrackPolicyResolver;
pub use moq_resolve::DenyAllMoqEventResolver;
pub use moq_resolve::MoqEventLabelResolver;
pub use moq_resolve::MoqEventObjectRef;
pub use moq_resolve::MoqEventPlane;
pub use moq_resolve::MoqEventPolicyRow;
pub use moq_resolve::MoqEventPolicyTable;
pub use moq_resolve::TrackPolicyError;
pub use moq_resolve::MAX_TRACK_SEGMENTS;
pub use moq_resolve::MAX_TRACK_SEGMENT_BYTES;
pub use moq_resolve::SUPPORTED_TRACK_POLICY_REVISION;
pub use pep::bounded_audit_coordinate;
pub use pep::ClearanceSource;
pub use pep::DenyAllClearanceSource;
pub use pep::MoqEventAction;
pub use pep::MoqEventPep;
pub use pep::MoqMacAuditReason;
pub use pep::MoqMacAuditRecord;
pub use pep::MoqMacAuditSink;
pub use pep::BOUNDED_AUDIT_COORDINATE_MAX_BYTES;
pub use pep::MAX_AUDIT_COORDINATE_PREFIX_BYTES;

Modules§

activation
Coverage-gated MAC activation control and verified-subject context cache.
bind
Carrier (c) — bind-time labels for synthetic VFS mounts (#699 scope item 1, epic #547).
context
The subject security context — a subject’s verified clearance, the subject.ctx side of the per-op dominance check subject.ctx ⊒ object.label.
dispatch_pep
The mandatory RPC dispatch PEP (epic #1267 T3, #1268).
genesis
Genesis labeling — the initial-SID / file_contexts equivalent.
label
The security label — the content-bound classification carried by every object, and the verified clearance carried by every subject.
lattice
The MAC lattice as policy — defined once, versioned, pinned.
manifest
The object-label seam — where an object’s content-bound label comes from.
moq_resolve
Typed MoQ/event object identity + declared track-policy resolver (v16 §10, WS-I / #1510).
pep
MoQ / event-plane MAC policy-enforcement point (epic #547, #1271; typed resolver v16 §10 / #1510).