Default Deny Fallback Check
Prove unrecognized roles, scopes and tenants are refused rather than falling through to a permissive default branch
Use when: authorization compares role or scope strings against expected values, where an else branch decides unmatched cases
Avoid when: authorization is policy-engine driven with a verified default-deny primitive, already enforced by its own tests
Procedure
- Locate the comparison logic in each layer: switch statements, policy documents, middleware checks or string lists.
- Identify what each branch does for an unrecognized value: deny, fall through, compare loosely or ignore the check.
- Exercise unmatched cases with your own credentials: unknown roles issued to you, disabled scopes and unknown tenants.
- Test partial and case-varied values where libraries normalize lazily, since that is where else branches hide.
- For service callers, test how a missing claim behaves versus an unknown claim, which are different fallback branches.
- Record each fallback path as deny-default or allow-default so the report can rank them for immediate attention.
Signals
- A role the product never issues produces the same behavior as a fully privileged role, meaning both hit one branch.
- Missing and unknown claims are treated differently even though both should deny, showing loose comparison logic.
- A policy document adds a scope and the enforcement point ignores it until cache on every layer is flushed everywhere.
- Case normalization happens on one side only, so mixed-case values bypass a comparison that looks strict.
Patterns
1. Branch map
role switch: member->allow_row admin->allow_row default->deny
unset role -> default -> deny expected
2. Loose compare
case-varied RoleValue == admin pattern -> falls into admin branch -> lowercase-normalize everywhere
3. Result row
unmatched-case behavior=deny-default everywhere except service-claims=ignore branch
Pitfalls
- Testing only realistic values, since defenders design for known roles and the fallback branch is what the unknown hits.
- Forgetting claims issued by other systems that share the trust point and may hold values this service never anticipated.
- Assuming a config reload propagates to every layer, which is precisely how allow-default branches survive in old instances.
Done when
- Every fallback branch in every layer is labeled deny-default or allow-default with the input that produces it.
- Loose comparisons, case mismatches and missing-claim behavior are tested with your own credentials and documented.