Expand description
MAC PEP for the direct Namespace API (#1272): the contract Namespace
invokes per op, plus fail-closed defaults. The audited production impl lives
in hyprstream::mac::pep.
MAC PEP for the direct Namespace API (#1272, epic #1267 T3).
The 9P translator already mediates every wire op through
hyprstream_9p::AccessDecider (implemented by hyprstream::mac::pep).
But the direct in-process Namespace API — cat/echo/create and
mount/bind_mount/unmount — forwards a plain Subject to the
resolving Mount with no mandatory label lookup or
reference monitor, bypassing the translator PEP entirely. This module is
that missing reference monitor: the contract the Namespace invokes per
op, plus its fail-closed defaults.
§Dependency-direction (mirrors the 9P split)
The trait (the contract the low-level Namespace consumes) lives here in
hyprstream-vfs, exactly as hyprstream_9p::AccessDecider lives in the 9P
crate. The production audited implementation — bridging to the real
RpcObjectLabelResolver, SecurityContext::can_access, and the
tamper-evident MAC audit sink — lives in hyprstream::mac::pep, alongside
NinePAccessDecider. This keeps the dependency direction one-way
(hyprstream → hyprstream-vfs) and does not reinvent label resolution,
clearance, or can_access; those are S1/S4 primitives re-exported from
hyprstream_rpc::auth::mac.
§Fail-closed by construction; no permissive mode (#547)
Every seam has an explicit deny-all default. A NamespacePep authorizes
an op only when ALL of:
- the caller’s
Subjectresolves to a verified [SecurityContext] (clearance provenance — #698;None⇒ deny), - the walked object resolves to a [
SecurityLabel] via the injected [RpcObjectLabelResolver] (None⇒ deny — “no unlabeled-default-allow”), clearance.can_access(object_label)(BLP dominance) AND theNamespaceAccessDeciderpermit. There is no permissive path inside the PEP.
§Activation posture (dormant structure)
A Namespace built with Namespace::new carries
pep: None and behaves exactly as before — the un-enforced status quo,
matching the rest of MAC enforcement being dormant today (CLAUDE.md “MAC
current status”). Installing a PEP via
Namespace::with_pep arms the fail-closed
monitor: every mediated op then requires a proven subject, and the
subject-less mount/bind_mount/unmount deny (use the _as variants).
Flipping the default at construction sites is the separately-gated
activation B-lane (#1267), not this PR.
Structs§
- Deny
AllNamespace - Fail-closed decider for a
NamespacePepwhose production audited decider is unavailable. Every op denies. - Deny
AllSubjects - Fail-closed resolver: no subject resolves to a clearance.
- Deny
Unlabeled Resolver - Fail-closed label resolver: no object resolves. Mirrors
hyprstream_9p::DenyUnlabeledResolver. ReturningNoneis a mandatory deny (design §1 invariant 2) — the PEP refuses to authorize any op whose object has no trusted label. - Namespace
Pep - The mandatory, all-or-nothing reference monitor a
Namespacemediates every direct-API op through once installed. - Security
Context - A verified subject’s security context = the clearance label the monitor compares against object labels.
- Security
Label - A complete security label: a point in the product lattice
Level × Assurance × CompartmentSet.
Enums§
- MacDecision
- The MAC decision returned by the dispatch PEP.
- MacDeny
Reason - Why a MAC decision denied. Auditable and testable.
- Namespace
Action - The direct-
Namespace-API operation aNamespaceAccessDecideris asked to authorize.
Traits§
- Namespace
Access Decider - Authorizes one direct-
Namespaceoperation against the attempted subject context and object label. - RpcObject
Label Resolver - Resolve the trusted
SecurityLabelfor the concrete object a dispatching RPC acts on. - Subject
Context Resolver - Plane-specific clearance-input seam: resolve a direct-API
Subjectto the verifiedSecurityContextthat authorizes it.