Expand description
Resource-bound authority — the resource_path constraint’s path model,
segment-boundary matching, and the extension-constraint params value model
(SPEC §5.7.1, §5.7.3). Mirrors Go’s resource_path.go byte-for-byte.
Paths are absolute logical POSIX-style paths: they name a location inside the resource’s own namespace, not filesystem paths on any machine. The verifier compares bytes exactly — no Unicode normalization, no percent decoding, no case folding. Issuers and adapters pre-normalize (NFC) and pre-decode BEFORE constructing constraints and verifier context; nothing transforms a path after verification.
Functions§
- normalize_
resource_ path - Validate
pagainst the logical path model (SPEC §5.7.3) and return its comparison form: at most one trailing/trimmed, except for the root path/itself. ReturnsErrwhenpis not a valid logical path: - resource_
path_ matches - Report whether
requested_pathis at or belowpath_prefixunder segment-boundary prefix matching (SPEC §5.7.3). This is NOT glob matching and NOT plain string-prefix matching:/srcmatches/srcand/src/a.ts, never/src-old/a.tsor/srcx. - validate_
constraint_ params - Validate a constraint’s
paramsfield against the value model and the canonical-type restriction (SPEC §5.7.1). Shared by issuance and decode. - validate_
params_ value - Enforce the extension-constraint params value model (SPEC §5.7.1): null,
booleans, strings, safe integers (|n| ≤ 2^53−1), and arrays/objects of
these.
depthis the container nesting already consumed; nesting beyondMAX_JSON_NESTING_DEPTHis rejected. - validate_
resource_ constraints - Enforce the issuance rule of SPEC §5.7.3: a certificate’s
resource_pathconstraints must be jointly satisfiable. Rejects constraint sets naming differentresource_ids, and same-resource sets whose prefixes do not form a nested chain under the prefix relation. Individual constraints are also validated (non-emptyresource_idwithinMAX_IDENTIFIER_LENGTH_BYTES; well-formedpath_prefix).