Skip to main content

Module cas_pep

Module cas_pep 

Source
Expand description

CAS-native MAC Policy Enforcement Point (#1270, epic #1267 T3).

The CAS data plane — substrate ingest, CasMount read, registry streaming continuation, and xet HTTP — had no native-MAC PEP and no trusted label at seal (T2 audit .fleet-coord/mac-pep-audit.md, rows “CAS substrate ingest” / “CAS substrate read” / “CasMount object/xorb open/read/stat” / “Registry CAS read continuation” / “Xet HTTP CAS read”). Every read was either unmediated or gated only by BootstrapCasAuthorizer (“any authenticated caller”), with labels caller-asserted or absent.

This module provides the CAS-plane PEP that all CAS read paths consume. It uses the canonical RPC MAC contract’s MacDecision, MacDenyReason, and RpcObjectLabelResolver seam while deliberately not implementing MacDispatchPep, whose EnvelopeContext input is RPC-plane-specific.

  • Trusted content-bound label at seal (domain_label / seal_label): derived from the DedupDomain’s structural properties (trust boundary → level axis), not caller-asserted. The domain is the content’s provenance — it encodes where the content lives (local vs shared-remote) and which tenant it belongs to (compartment). The staging path’s joined hint label is a D1 hint trusted only from our own ingest service; the domain label is authoritative and the effective seal label is the restrict-only join of the two.

  • Clearance-input seam (CasClearanceSource): consumes authority-bound subject + verified_tenant inputs. Until a production CAS adapter is installed, DenyAllClearanceSource returns None for every subject — fail-closed, never a permissive default. There is no permissive mode (per #547).

  • Per-op enforcement (CasPep): resolves the subject clearance via the seam, checks clearance.can_access(object_label), and records every decision through the existing tamper-evident MAC audit sink. Missing subject, missing clearance, missing label, or audit failure → deny.

  • CasMount integration (MacCasAuthorizer): implements CasMountAuthorizer so that the existing per-op authorization hook in CasMount::open/ read/stat delegates to the MAC PEP without adding a new enforcement surface.

§What this module does NOT do

  • It does not author, derive, or enforce MAC policy from the Compartment string in DedupDomain — that requires lattice internment which lives in the policy layer. Compartment isolation is already structural (distinct physical storage roots per domain); the label’s level axis is the load-bearing enforcement here. Enriching the seal label with compartment bits via the lattice is a follow-up gated on threading the lattice to the CAS layer.

  • It does not fake a clearance for any subject. If the clearance source returns None, the installed PEP denies. The #698 clearance primitives have landed, but a plane-specific adapter must still be installed before a CAS subject can pass.

Structs§

CasObjectLabelResolver
Adapt a trusted CAS carrier label to the canonical object-label resolver.
CasPep
The CAS MAC Policy Enforcement Point.
DenyAllClearanceSource
Fail-closed clearance source: denies every subject.
MacCasAuthorizer
A [CasMountAuthorizer] backed by the CAS MAC PEP.
VerifiedClaimsCasClearanceSource
Production CAS clearance source backed only by contexts derived from verified Claims × VerifiedKeyMaterial at an RPC/attach boundary.

Traits§

CasClearanceSource
Resolve a verified subject identity to a MAC SecurityContext for CAS access.

Functions§

domain_label
Derive a trusted, content-bound SecurityLabel from a DedupDomain.
production_cas_pep
Assemble the production CAS PEP from verified subject contexts and a tamper-evident signed WAL. Failure to obtain either signing key aborts the production constructor; it never substitutes the test-only null sink.
seal_label
Compute the effective seal label: join(domain_label(domain), hint).