pub struct WorkloadGate { /* private fields */ }Expand description
Governance gate for workload actions.
Implementations§
Source§impl WorkloadGate
impl WorkloadGate
Sourcepub fn new(
risk_threshold: f64,
human_approval: bool,
revocations: Arc<RevocationList>,
) -> Self
pub fn new( risk_threshold: f64, human_approval: bool, revocations: Arc<RevocationList>, ) -> Self
Gate with the shipped default_rules and no permits (denies all),
checking revocations on every request. The list is required: a gate
built without one never denies a revoked package. A gate that
genuinely has no subject list says why with Self::exempt.
Sourcepub fn exempt(
risk_threshold: f64,
human_approval: bool,
why: &'static str,
) -> Self
pub fn exempt( risk_threshold: f64, human_approval: bool, why: &'static str, ) -> Self
Self::new without a revocation list, for a gate whose workloads
are not revoked through the subject list (the project supervisor:
project certificates revoke through the project identity record) and
for tests. why is kept and shown by Self::exempt_reason; the
population test allows this only in a short list of files.
Sourcepub fn with_rules(
risk_threshold: f64,
human_approval: bool,
rules: Vec<GovernanceRule>,
revocations: Arc<RevocationList>,
) -> Self
pub fn with_rules( risk_threshold: f64, human_approval: bool, rules: Vec<GovernanceRule>, revocations: Arc<RevocationList>, ) -> Self
Gate over a distributed rule set (e.g. RuleDistribution::active_rules)
checking revocations.
Only rules whose selectors can match workload.* actions matter; the
rest are carried but never match.
Sourcepub fn exempt_reason(&self) -> Option<&'static str>
pub fn exempt_reason(&self) -> Option<&'static str>
Why this gate does not check the subject revocation list, if it does not.
Sourcepub fn with_permit(self, rule: WorkloadPermitRule) -> Result<Self, String>
pub fn with_permit(self, rule: WorkloadPermitRule) -> Result<Self, String>
Add a permit rule after validating it.
Sourcepub fn with_chain(self, cm: Arc<ChainManager>) -> Self
pub fn with_chain(self, cm: Arc<ChainManager>) -> Self
Attach a chain manager for audit events.
Sourcepub fn with_revocations(self, list: Arc<RevocationList>) -> Self
pub fn with_revocations(self, list: Arc<RevocationList>) -> Self
Replace the revocation list checked on every request (an exempt gate becomes one that checks it).
Sourcepub fn with_attestation(self, att: ProjectAttestation) -> Self
pub fn with_attestation(self, att: ProjectAttestation) -> Self
Decide for the verified project att instead of the kernel’s
instance attestation. Permit rules with projects match on it.
Sourcepub fn permits(&self) -> &[WorkloadPermitRule]
pub fn permits(&self) -> &[WorkloadPermitRule]
Permit rules in evaluation order.
Trait Implementations§
Source§impl GateBackend for WorkloadGate
impl GateBackend for WorkloadGate
Source§fn check(&self, agent_id: &str, action: &str, context: &Value) -> GateDecision
fn check(&self, agent_id: &str, action: &str, context: &Value) -> GateDecision
Source§fn check_teardown(
&self,
agent_id: &str,
action: &str,
context: &Value,
) -> GateDecision
fn check_teardown( &self, agent_id: &str, action: &str, context: &Value, ) -> GateDecision
Self::check for a teardown (stop / unload / re-adoption of what
is already placed): a denial caused only by the node’s trust tier is
waived, every other denial (revocation, default deny, rule or
threshold) stands. Gates that cannot tell the difference return the
plain decision, so they never waive anything.Source§fn governance_snapshot(&self) -> Option<GovernanceSnapshot>
fn governance_snapshot(&self) -> Option<GovernanceSnapshot>
None for gates with no
rule set.Auto Trait Implementations§
impl !Freeze for WorkloadGate
impl !RefUnwindSafe for WorkloadGate
impl !UnwindSafe for WorkloadGate
impl Send for WorkloadGate
impl Sync for WorkloadGate
impl Unpin for WorkloadGate
impl UnsafeUnpin for WorkloadGate
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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