Authorization and Least Privilege
Understand access control models such as RBAC and ABAC, and how least privilege limits the blast radius of any compromise.
Beginner · about 3 hours · difficulty 2/5
Learn first: Authentication and MFA
Authentication says who you are. Authorization decides what you can do. Most serious web and cloud bugs are authorization failures.
Models
- DAC (discretionary): owners decide who gets access, like file sharing.
- MAC (mandatory): the system enforces labels such as "secret"; used in military and SELinux.
- RBAC (role-based): permissions attach to roles like "support-agent" and users get roles. The most common enterprise model.
- ABAC (attribute-based): rules evaluate attributes such as department, device health, time and data sensitivity. More flexible, more complex.
- ReBAC (relationship-based): access follows relationships, like "editor of this document". Used by modern apps.
Least privilege in practice
- Start with no access and add what is needed.
- Separate daily accounts from admin accounts.
- Use just-in-time elevation instead of permanent admin rights.
- Run services as dedicated low-privilege accounts.
- Review access regularly and remove what is unused.
Separation of duties
No single person should be able to both request and approve a payment, or both write and deploy code without review. This limits fraud and mistakes.
Pitfalls
- Role explosion: hundreds of overlapping roles nobody understands.
- Checking permissions only in the user interface and not on the server.
- Wildcard permissions ("*") granted "temporarily" and never removed.
Good enough: you can design an RBAC scheme for a small app (roles, permissions, who gets what) and explain how you would audit it every quarter.
Key concepts
- DAC, MAC, RBAC, ABAC
- Relationship-based access
- Least privilege
- Just-in-time access
- Separation of duties
- Access reviews
Mini project
Design the roles and permissions for a college placement portal (students, recruiters, admins), then list three authorization test cases that would catch a broken check.
Check yourself
Why is hiding an admin button in the UI not an authorization control?