Skip to main content

Module dispatch_pep

Module dispatch_pep 

Source
Expand description

The mandatory RPC dispatch PEP (epic #1267 T3, #1268).

This is the single mandatory, unavoidable MAC gate between claims verification and handler invocation in [crate::service::dispatch:: process_request]. It is the RPC-plane analogue of the 9P NinePAccessDecider (hyprstream/src/mac/pep.rs): both resolve a trusted object label and check clearance.can_access(label) before the data reaches the handler.

§Why this exists

process_request verifies the caller’s identity and JWT claims, then invokes handle_request with no object-label resolution, no lattice floor check, and no can_access (issue #1268). Method-level Casbin (#[authorize]) is discretionary — a handler that forgets the attribute is unmediated. This PEP is the mandatory floor no handler can bypass.

§The three-step check (per design §10, S1 interface contract)

1. Subject:   ctx.security_context()  →  Option<SecurityContext>
                                        None ⇒ Deny(NoClearance)
2. Object:    resolver.resolve(svc, method)  →  Option<SecurityLabel>
                                                None ⇒ Deny(UnlabeledObject)
3. Decision:  ctx.can_access(label)   →  bool
                                        false ⇒ Deny(FloorDeny)

Once a PEP is installed, every None or false produced by that PEP is a hard deny. There is no permissive mode inside an active PEP (epic #547 invariant: “no unlabeled-default-allow”).

§Clearance provenance (#698 dependency)

EnvelopeContext::security_context() already composes Claims × VerifiedKeyMaterial via the S1 SubjectContextClaims trait — this IS the clearance seam. Until #698 wires the clearance field onto Claims in production, security_context() resolves to None and the PEP denies every request — which is correct fail-closed behavior, not a bug.

§Process-global installation

Like the PQ trust store and compiled MAC policy, the PEP is installed at startup via install_mac_dispatch_pep. Until installed, dispatch denies with MacDenyReason::NoPepInstalled. Once installed, every request is mediated and every installed-PEP denial is authoritative.

Structs§

DefaultMacDispatchPep
The production-shaped MAC dispatch PEP wiring the three-step check.
DenyAllMacPep
A PEP that unconditionally denies.
DenyAllObjectResolver
Fail-closed object resolver: every object is unlabeled ⇒ deny.

Enums§

MacDecision
The MAC decision returned by the dispatch PEP.
MacDenyReason
Why a MAC decision denied. Auditable and testable.

Traits§

MacDispatchPep
The mandatory, unavoidable RPC dispatch PEP for native MAC (epic #547, activation-gate T3, #1268).
RpcObjectLabelResolver
Resolve the trusted SecurityLabel for the concrete object a dispatching RPC acts on.

Functions§

check_dispatch_mac
Check the installed dispatch PEP, or deny if installation was omitted.
global_mac_dispatch_pep
The installed MAC dispatch PEP, if any.
install_mac_dispatch_pep
Install the node’s MAC dispatch PEP.