# Default Deny Fallback

> 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

- Skill: `wsh7ash/default-deny-fallback` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/default-deny-fallback`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/default-deny-fallback/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Wsh7Ash (https://skillmd.com/u/wsh7ash)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/wsh7ash/default-deny-fallback

---


# 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

1. Locate the comparison logic in each layer: switch statements, policy documents, middleware checks or string lists.
2. Identify what each branch does for an unrecognized value: deny, fall through, compare loosely or ignore the check.
3. Exercise unmatched cases with your own credentials: unknown roles issued to you, disabled scopes and unknown tenants.
4. Test partial and case-varied values where libraries normalize lazily, since that is where else branches hide.
5. For service callers, test how a missing claim behaves versus an unknown claim, which are different fallback branches.
6. 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**

```text
role switch: member->allow_row  admin->allow_row  default->deny
unset role -> default -> deny expected
```

**2. Loose compare**

```text
case-varied RoleValue == admin pattern -> falls into admin branch -> lowercase-normalize everywhere
```

**3. Result row**

```text
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.

## References

- [OWASP - authentication and access control cheatsheet](https://cheatsheetseries.owasp.org/)
- [OWASP API Security Top 10](https://owasp.org/www-project-api-security/)

