Skip to main content

audited_evaluate_grant

Function audited_evaluate_grant 

Source
pub fn audited_evaluate_grant<V: UcanVerifier + ?Sized>(
    grant: &Ucan,
    verifier: &V,
    now: u64,
    request: &GrantRequest,
    subject: Option<&SecurityContext>,
    on_behalf_of: Option<&SecurityContext>,
    sender_bound: bool,
    sink: &dyn AuditSink,
) -> Result<GrantDecision, GrantError>
Expand description

As evaluate_grant, but records a tamper-evident [AuditRecord] of the outcome through sink before returning — S7’s complete-mediation guarantee extended to the grant path (B2, #674). This is the mint-path entry point production code should call; the plain evaluate_grant is the unaudited core the gate tests exercise directly.

Every gate outcome is audited, permit and deny alike (DecisionReason’s Grant* variants — see crate::mac::audit::DecisionReason). On a would-be Permit, the audit write happens before the token layer is told to mint: if it fails, the permit is downgraded to GrantError::AuditUnavailable rather than handed back — mirroring crate::mac::audit::AuditedAvc’s fail-closed rule that a decision which cannot be audited is never allowed through.