pub struct NamespacePep { /* private fields */ }Expand description
The mandatory, all-or-nothing reference monitor a
Namespace mediates every direct-API op through once
installed.
There is no permissive or partial construction: each of the three seams is
required, and the crate’s fail-closed defaults (DenyAllSubjects,
DenyAllNamespace, and the None-returning
[hyprstream_rpc::auth::mac] RpcObjectLabelResolver the hyprstream crate
supplies) are the explicit choices for a seam the application does not yet
populate. Building a NamespacePep is therefore always fail-closed;
“unenforced” is represented by not installing one on the Namespace
(the dormant status quo), never by a permissive PEP.
Implementations§
Source§impl NamespacePep
impl NamespacePep
Sourcepub fn new(
subjects: Arc<dyn SubjectContextResolver>,
labels: Arc<dyn RpcObjectLabelResolver>,
decider: Arc<dyn NamespaceAccessDecider>,
) -> Self
pub fn new( subjects: Arc<dyn SubjectContextResolver>, labels: Arc<dyn RpcObjectLabelResolver>, decider: Arc<dyn NamespaceAccessDecider>, ) -> Self
Assemble the monitor from its three mandatory seams.
Callers that lack a production seam pass the crate’s deny-all default
for it — the resulting PEP denies every op, which is the correct
posture for “structure present, inputs not yet wired” (the #698 /
#1268 dependency window). There is no new_permissive.
Authorize action by subject against object.
Fail-closed sequence (any deny ⇒ NamespaceError::Denied):
- resolve
subject→ optionalSecurityContext, - resolve
object→SecurityLabelvia the injectedRpcObjectLabelResolver(missing means no unlabeled-default-allow; design §1 invariant 2), decider.check(ctx, label, action)— audit every outcome, including missing-clearance and missing-label denials, then applycan_access+ TE floor; canonicalMacDecision::Deny⇒ deny,- permit.
object_path is the canonical normalized VFS path. It occupies the
canonical resolver’s service_domain slot; VFS has no browser method
discriminator, so method is always None. The caller never supplies a
label (D1 — caller labels are forbidden).
Sourcepub async fn check(
&self,
subject: &Subject,
object_path: &str,
action: NamespaceAction,
) -> MacDecision
pub async fn check( &self, subject: &Subject, object_path: &str, action: NamespaceAction, ) -> MacDecision
Evaluate one VFS operation using the canonical shared MAC decision
contract. An installed NamespacePep is always fail-closed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NamespacePep
impl !RefUnwindSafe for NamespacePep
impl Send for NamespacePep
impl Sync for NamespacePep
impl Unpin for NamespacePep
impl UnsafeUnpin for NamespacePep
impl !UnwindSafe for NamespacePep
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more