pub fn evaluate_grant<V: UcanVerifier + ?Sized>(
grant: &Ucan,
verifier: &V,
now: u64,
request: &GrantRequest,
subject: Option<&SecurityContext>,
sender_bound: bool,
) -> Result<GrantDecision, GrantError>Expand description
Evaluate a UCAN grant request: the single fail-closed S6 path.
Inputs:
grant: the presented subset-UCAN (a delegation chain whose root capabilities are the ceiling for this request).verifier: the S5UcanVerifier(trust store resolving each issuer’s anchored ML-DSA-65 key). Signatures are verified under the hybrid policy.now: the single trusted clock (unix seconds), threaded unchanged into every chain link by S5 — never read from the token.request: what the principal is asking to do now (the subset).subject: the principal’s verified security context (S1 clearance + assurance, clamped to verified key material).None⇒ unlabeled ⇒ deny.sender_bound: whether a DPoP proof was supplied and verified by the caller. ZSP requires sender-binding;false⇒ deny.
Gates, in order (all fail-closed; the first failure wins):
- Sender-binding required (ZSP) — no bearer tokens from a grant.
- Non-empty grant — an empty grant mints nothing.
- Labeled subject — S1: unlabeled subject ⇒ deny (no default clearance).
- Labeled object — S1: unlabeled object ⇒ deny.
- MAC clearance floor —
subject.clearance ⊒ object_label. - UCAN chain valid — S5
validate(signatures + attenuation + temporal). - Ceiling-subset —
authorize_at(grant.capabilities(), grant.window, request, now)permits.Deny⇒ over-ceiling ⇒Escalate(not auto-mint).
Order rationale: the cheap structural/label gates run before the
cryptographic chain walk, so a malformed or uncleared request is rejected
without spending the signature-verification budget. The chain is validated
before the ceiling check so an invalid chain can never reach authorize.