Who Can See What
Authentication Is Solved. Authorization Is Where You Get Breached.
The breach is almost never the login page. It is an endpoint that confirmed you are someone without confirming the record is yours, and the fix is structural rather than vigilant.
Broken Access Control is the number one category in the OWASP Top Ten in both the 2021 and the 2025 editions. That is not an opinion about priorities, it is the published result of looking at what goes wrong across a very large sample of applications, and it contradicts how almost everyone allocates their security attention, which is to the login page.
Two problems of very different difficulty
Authentication answers who is this. It is solved and commoditised: use your platform's auth service or an identity provider, turn on multi-factor, stop thinking about it. Authorization answers whether this user may perform this action on this object. Nobody can sell you that, because it is a statement about your domain. It gets written by hand, in every endpoint, by whoever was working that day, and it is almost never tested.
The bug you will ship
An endpoint receives a request for invoice 8812, checks that the caller has a valid session, loads invoice 8812, and returns it. Every individual line is correct. Together they let any logged-in customer read any invoice in your system by changing a number in the address bar. The session check answered is this somebody. It never answered is this theirs.
The fix is structural rather than a matter of vigilance. Put the scope inside the query rather than in a check after the fetch: select the invoice where the id matches and the owner matches the caller, so a mismatch returns nothing instead of data you then decide to hide. Fetch-then-check leaks eventually, through an error message that differs between the two cases, a timing difference, a log line, or the next developer who moves the check while tidying up.
Where the checks are missing
- Background jobs and scheduled tasks, which run as a service identity with full access and therefore skip every check the request path applies.
- Exports, reports and CSV downloads, usually written quickly, often in raw SQL, frequently by someone who was not thinking about tenancy.
- Admin tooling, where the implicit rule is that admins can do anything, including the support contractor who was onboarded last month.
- Bulk endpoints and anything that accepts a list of ids, where the scope is checked for the first id and assumed for the rest.
- File and object storage, where a signed URL with no expiry is a permanent public link to a private document, and a predictable path plus a public bucket is a directory listing of your customers.
Roles are not permissions
A role answers can this kind of user do this kind of thing. It does not answer may they do it to this object, and almost every real requirement is the second kind: the account owner can remove members but not themselves, a manager can approve an expense but not their own, a member can edit a document in their workspace but not in the one they were removed from last week. Write the model down once as rules over actor, action and resource, and have every endpoint call into it. A hundred and forty hand-written conditionals is not an authorization model, it is a hundred and forty chances to get it wrong with no way to audit them.
Tokens, and what a stateless design cannot do
A stateless JWT cannot be revoked before it expires. That is not a flaw to work around, it is the design: the server does not have to look anything up, which also means it cannot be told to stop. So the real controls are lifetime and refresh. Short access tokens, an hour by default on Supabase, refresh rotation with reuse detection so a stolen refresh token is detectable, and a server-side denylist for the day you must cut one person off immediately. If your honest answer to that day is they will be gone within the hour, say it out loud and decide whether that is acceptable. Claims go stale for the same reason, so any decision that must reflect current state, a cancelled subscription, a removed member, a suspended account, cannot be read from the token alone.
The few actions that deserve more
Step-up authentication means asking for the password or second factor again at the moment of a dangerous action, however long the session has been open. The list is short and nearly identical across products: changing the email address, changing the password, changing where money goes, promoting an administrator, exporting everything, deleting the account. Account takeover is usually completed through the email-change endpoint, because that is the step that locks the real owner out of their recovery path.
The test that keeps it true
Everything above decays the moment somebody adds an endpoint, so the only durable control is a test that fails. If no test asserts that one account cannot reach another's records, your isolation is a property of today's code rather than of the system, and the next lesson is how to build that test.
Key takeaways
This is one lesson of 541.
The whole Foundation is free — 16 subjects, beginner to advanced. Sign in to track what you have read, take the end-of-module quizzes, and use the terminal.