Skip to main content

check_no_escalation

Function check_no_escalation 

Source
pub fn check_no_escalation(
    ucan: &Ucan,
    policy: &CompiledPolicy,
    permissions: &impl PermissionMap,
) -> Result<(), PrivilegeEscalation>
Expand description

Verify the compiled policy grants no permission beyond the UCAN grant.

For each rule the matrix permits, this projects the rule back to the access it grants (granted_access) and requires some capability in the grant to authorize that access. It checks the emitted matrix against the independent authorizes test — it does NOT re-run permissions_for. That matters: re-running the forward map would let a PermissionMap that lowers a narrow capability to a broad rule pass itself; checking each rule’s access against the grant instead catches it.