Function-Level Enforcement Review
Verify each operation knows which caller classes may invoke it, and that the check runs before any business logic or data read
Use when: you have classified endpoints into public, authenticated and restricted layers and need proof the layer actually gates execution
Avoid when: the endpoint inventory is still missing, since you cannot distinguish intentional from lost authorization without it
Procedure
- Pick one operation from each auth layer in your inventory and identify the exact check that should gate it.
- Call each operation with the lowest-privileged credential you hold and record status, body and side effects.
- Compare the observed outcome against the permission matrix cell written during the mapping phase.
- For any mismatch, determine the layer that failed: gateway rule, framework middleware or handler branch.
- Repeat for write operations separately, because a refused read can hide an accepted write on the same route.
- Record each verdict in the matrix so the final report distinguishes enforced, missing and inconsistent checks.
Signals
- A restricted operation returns 200 with data for a low-privileged role, meaning the gate is absent entirely.
- The gate exists but runs after expensive logic, visible as timing or cost differences rather than data leakage.
- The same permission is enforced in one method and skipped in another on the same resource, indicating per-method checks.
- An operation relies on the client sending a role indicator, so roles are asserted rather than verified.
Patterns
1. Gate probe
GET /api/admin/stats as member -> 200 with figures
expected 403 -> function-level gate missing
2. Write probe
DELETE /api/orders/{own} as peer -> 200
read refused but write accepted -> check is read-only
3. Result row
op=/api/admin/stats layer=admin member-call=403 enforced=yes side-effect=none
Pitfalls
- Treating an empty response body as a refusal, since 200 with no data still proves the operation ran.
- Testing only the layer you documented as authoritative while a parallel route skips the gate.
- Forgetting background or scheduled paths that invoke the same logic with a synthetic service identity.
Done when
- Every sampled operation has an observed outcome recorded against its matrix cell for read and write methods.
- Mismatches are attributed to a specific failing layer, each with the request that exposed it.