← All writing

· 3 min read

Authorization that fails closed

Why TimeUp checks 79 fine-grained capabilities and denies everything that is not explicitly allowed.

In a platform where barbershops, clinics and spas share the same code, the worst bug is the one that lets someone see or change what they should not. The default behavior of the system matters more than any single check.

Allow-lists beat block-lists

A block-list says what is forbidden, so every new feature starts open until somebody remembers to close it. An allow-list starts closed: if nothing grants an action, it does not happen.

Capabilities instead of roles

Roles such as admin or staff are too coarse. TimeUp uses 79 fine-grained capabilities, and each role is just a named bundle of them. Changing what a role can do never means touching the checks themselves.

What fails closed means

  • A missing capability denies the action.
  • An unknown capability denies the action.
  • An error while checking denies the action.
Open by default, or closed by default?

Switch the policy and see what a receptionist can do. In the closed policy, grant capabilities yourself.

  • Read the calendarAllowed
  • Cancel a bookingAllowed
  • Refund a paymentDenied
  • Delete the businessDenied
  • Export all clients (new feature)Denied

The allow-list starts from nothing. The new feature stays denied until someone grants it on purpose.

The price is that a forgotten permission shows up as a visible, fixable error instead of a silent leak. For software that holds other businesses' data, that is the right trade.

Read the case study →