Skip to main content

Module resource_path

Module resource_path 

Source
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 p against the logical path model (SPEC §5.7.3) and return its comparison form: at most one trailing / trimmed, except for the root path / itself. Returns Err when p is not a valid logical path:
resource_path_matches
Report whether requested_path is at or below path_prefix under segment-boundary prefix matching (SPEC §5.7.3). This is NOT glob matching and NOT plain string-prefix matching: /src matches /src and /src/a.ts, never /src-old/a.ts or /srcx.
validate_constraint_params
Validate a constraint’s params field 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. depth is the container nesting already consumed; nesting beyond MAX_JSON_NESTING_DEPTH is rejected.
validate_resource_constraints
Enforce the issuance rule of SPEC §5.7.3: a certificate’s resource_path constraints must be jointly satisfiable. Rejects constraint sets naming different resource_ids, and same-resource sets whose prefixes do not form a nested chain under the prefix relation. Individual constraints are also validated (non-empty resource_id within MAX_IDENTIFIER_LENGTH_BYTES; well-formed path_prefix).