Lesson 2 · Unit 03
Authorization
Logged in is not the same as allowed
What you practise
- Authentication is not authorization, checking on the server for every request, IDOR (changing the id in the URL), roles, least privilege, deny by default
Try a question from this lesson
Pick one
You are logged in and open your invoice at /invoices/1041. You change the address to /invoices/1040 and see a stranger's invoice. Which check did the server skip?
Correct answer
Whether invoice 1040 belongs to you
Why
The server knew who you were and never asked whether this invoice was yours. Being logged in answered one question. The second one, about this particular object, was never put.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Who are you? May you do this?
Authentication establishes who is calling. Authorization decides whether that caller may perform this action on this object.
Every request that touches data needs both, checked on the server.
Forgetting the second check for an id taken from the request has a name: IDOR, an insecure direct object reference. It is among the most common serious bugs on the web.
Concept
Least privilege
Give every user, service and key the smallest set of permissions that lets it do its job.
A reporting job gets a read-only database account. An upload script gets a key for one bucket. A support agent can view orders but not refund them.
When something is broken into or leaks, the damage stops at the edge of what it was allowed to do.
10 more exercises in the app
- 1× fill the blanks
- 4× multiple choice
- 2× true or false
- 1× type the answer
- 1× match the pairs
- 1× order the lines
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.