Access control in depth
The basics taught you two checks: change an ID (horizontal: same role, someone else’s data) and open an admin page as a normal user (vertical: a lower role doing a higher role’s job). privilege escalationPrivilege escalationGetting more rights than your role allows, such as a Viewer deleting data or a customer reaching admin functions.Open in glossary → is the name for the vertical kind.
Real products add two more dimensions:
- More roles. Viewer, Editor, Admin, Owner, Billing manager, Support agent. Each one has its own list of allowed actions.
- More customers. In a multi-tenantMulti-tenancyMany customers (tenants, workspaces or organizations) sharing one app and one database, each seeing only their own data.Open in glossary → product, many companies (called workspaces, organizations or tenants) share one app and one database. Acme must never see Globex’s data, even when both are admins in their own workspace.
The permission matrix
Write the rules as a table: actions in rows, roles in columns, and what the spec says in each cell. Then test every cell through the API, not only through the UI. The UI hides buttons, so it only proves what the page shows, not what the server allows.
Always add a column for “admin of another workspace”. That is the account most likely to find a cross-customer leak, because it has every permission, just in the wrong place.
Try it below. The spec for an invoicing app is already in the cells. Press each cell to send the request as that role, and find the cells where the server’s answer doesn’t match the spec.
Ledgerly · permission matrix for the Acme workspace
Each cell shows what the spec expects ( allowed, denied). Press a cell to send that request as that role.
| Action | Viewer | Editor | Admin | Other org admin |
|---|---|---|---|---|
| View an invoiceGET | ||||
| Edit an invoicePATCH | ||||
| Delete an invoiceDELETE | ||||
| Export all invoicesGET | ||||
| Invite a memberPOST | ||||
| Change the planPUT |
Where access checks hide
Teams usually protect the main page of a feature. The forgotten paths are the side doors that return the same data:
| Side door | What to try with a lower role or another workspace |
|---|---|
| Exports and reports | CSV, PDF and “Download all” endpoints. They often skip the checks the list page has. |
| Search and autocomplete | Search for a name from another workspace. Even a suggestion in the dropdown is a leak. |
| Files and attachments | Copy an attachment’s URL, sign out or switch user, and open it. Long random URLs are not access control. |
| Notifications and emails | Does a Viewer get an email with data they can’t see in the app? |
| Bulk actionsBulk actionAn action applied to several selected items at once, like Delete, Archive or Mark as paid.Open in glossary → | Select items, then add another workspace’s ID to the bulk request. |
| Counts and totals | A dashboard that says “12 invoices” while the list shows 9. |
| Older or mobile API versions | /api/v1/ next to /api/v2/, or the mobile app’s endpoints. Fixes often land only in the newest one. |
When permissions change
Permissions are not fixed. Test what happens after a change, because many apps check the role only at login:
- Downgrade. As Admin, change Leo from Editor to Viewer. In Leo’s already-open browser, try to edit. Expected: refused right away, not after he logs in again.
- Removal. Remove Leo from the workspace. His open session, his mobile app and any API tokens he created must stop working for that workspace.
- Invites. Use an invite link twice, or after it expired, or after the invite was cancelled. Change the role in the invite request from
viewertoadmin. - Shared links. Create a “share with anyone who has the link” URL, then turn sharing off. The old link must stop working.
Check this part
Which extra column catches cross-customer leaks in a permission matrix?
The invoice list page is protected for Viewers. What else should you test?
Leo is changed from Editor to Viewer while he is logged in. When should he lose edit rights?