Skip to main content

Module public_exemptions

Module public_exemptions 

Source
Expand description

Reviewed registry of HTTP routes intentionally exempt from native MAC mediation — the “public / declassifier exemption registry” (issue #1273, epic #1267, audit item NEW-PUBLIC-EXEMPTIONS).

§Why this exists

Native MAC (crate::mac) is the mandatory floor: every object path must be mediated by a verified subject SecurityContext and a trusted object label before use. Activation’s “all non-exempt paths mediated” claim is only enforceable if the set of intentionally-unmediated routes is explicit and reviewed, not implicit. Without a registry, a newly added public route can silently become a bypass — exactly the drift this module prevents.

§Contract (do not circumvent)

  1. A route defaults to mediated. Any HTTP route not listed in PUBLIC_EXEMPTIONS must sit behind the protected (auth-mediated) router. Once the MAC PEP is installed there is no permissive mode (crate::mac is fail-closed per #547); “public” is an opt-in, reviewed exemption, never a default.
  2. The public routers are built from this registry. crate::server constructs its public route set by iterating PUBLIC_EXEMPTIONS for its face, so adding an unmediated route requires adding a reviewed PublicExemption entry plus a handler arm — two review surfaces, no silent addition.
  3. The drift test pins the live set to the registry. public_exemptions_match_live_routes asserts registry self-consistency, handler-enum parity, per-face wiring, and that the public/protected split is live (registry paths answer without auth; a protected path does not).

§Scope and dependencies

This registry covers genuinely no-auth public routes: health metadata, .well-known discovery, and pre-credential browser provisioning. OAuth2.1 protocol endpoints (token, authorize, jwks, device, SCIM …) are the credential-issuance control plane that MAC sits beneath, not tenant-object access; they remain out of scope here and are tracked separately. Real MAC enforcement remains dormant (uninstalled, so dispatch permits as a pre-activation pass-through) pending production clearance provenance (#698). Once installed, the PEP is fail-closed. This registry is the activation-gate structure that ships now so the exempt set is locked.

Structs§

PublicExemption
One reviewed public/declassifier exemption. Every field is &'static so the registry is a compile-time constant and the drift test needs no allocation.

Enums§

ExemptionCategory
Why a route is intentionally unmediated. Used by activation review to confirm each exemption is a narrow, justified carve-out.
HttpFace
Which HTTP face serves the exempt route. Each face builds its public router from its own slice of PUBLIC_EXEMPTIONS; the drift test cross-checks every face against the registry.
PublicRouteHandler
Tag identifying which handler serves an exempt route. The public-router builders match exhaustively on this, so wiring a new route requires both a PublicExemption entry and a handler arm — the double review touch that keeps the exempt set from silently growing.
RegistryError
Error raised by validate when the registry has drifted from its contract.
RouteMethod
HTTP method of an exempt route. Only the methods used by public routes are represented; anything else must go through the protected router.

Statics§

PUBLIC_EXEMPTIONS
The authoritative, reviewed registry. This is the single source of truth for which HTTP routes bypass native MAC mediation.

Functions§

for_face
Yields the registry entries owned by face, in declaration order.
require
Looks up an exemption by id. Router builders use this to reference the reviewed path/method rather than a string literal, so a typo or unregistered route is caught at startup instead of silently bypassing MAC.
validate
Validates the registry against its contract: