Skip to main content

Module permission_map

Module permission_map 

Source
Expand description

The production PermissionMap (#676): the S3 scope ↔ S5 TE-rule vocabulary, injective and exact.

§Shape (and why)

A TeRule is a concrete numeric triple (subject_type, object_type, action) — a wildcard is unrepresentable in the compiled matrix, and inventing a sentinel “any object” id would put wildcard matching on the PEP decision path (a standing fail-open hazard). So wildcards exist only on the grant side (Capability::authorizes does directional covering) and this map expands them at compile time over a closed registry:

  • mac://<class>/* expands to one rule per registered object of that class — never beyond the registry.
  • a * ability expands over exactly SCHEMA_SCOPE_ACTIONS (the generated, closed schema enum).
  • anything unrecognized (class, name, verb) maps to nothing (fail-closed; never a guessed rule).

Because the expansion is injective — each concrete (class, name, verb) maps to its own distinct rule, and no two distinct accesses share a rule — granted_access is the exact inverse of a rule, which is trivially its most-permissive access: the tightest upper bound of a singleton is itself. There is no join/LUB logic that could be “too narrow” and mask an escalation (the #676 risk). The property tests below pin exactly this: every request that projects onto a rule is authorized by that rule’s granted_access.

§Registry determinism

Object ids are assigned positionally over the sorted (class, name) registry, so two nodes constructing the map from the same object list agree on every id — the compiled matrix and the PEP intern identically with no side table. The registry is closed at construction: an object added later has no rule and is denied by default; the remedy is a re-compile at a new policy generation, not a silent wildcard.

Structs§

ScopePermissionMap
The production S3-scope permission map. See the module docs for the injective/exact contract and the registry-determinism rule.