0%
Security Engineering for Software Teams
Thinking About Security
Cryptography You Will Actually Use
Vulnerability Classes
Infrastructure and Cloud
Detection and Response
Authorization Models: RBAC, ABAC and ReBAC
Authentication establishes who is making a request. Authorisation decides what that identity is allowed to do. It is the control that stops one customer reading another customer invoices, a support agent changing billing settings or a contractor deleting production data. Broken access control consistently tops lists of the most common serious web vulnerabilities, because authorisation logic is spread across every endpoint and every query, and a single missed check is enough. This lesson covers the main models, role based, attribute based and relationship based access control, and how to build and run authorisation systems that stay correct as products grow.
What authorisation decides
Every authorisation decision has the same shape: can this subject perform this action on this resource, in this context. The subject is a user, service or device. The action is something like read, update, approve or delete. The resource is a specific object, such as invoice 4471, not just a type. The context includes time, location, device posture and how the subject authenticated. Models differ in how they represent and evaluate these four elements, but every model must answer the same question for every request.
Where checks live
Authorisation can be enforced at several layers. A gateway can reject requests for endpoints a caller has no scope for. A service can check whether the caller may perform an operation. The data layer can filter queries so that only permitted rows are returned. Coarse checks at the edge are cheap and catch obvious misuse, but object level decisions, which customer owns which invoice, can only be made where the object is known. Most serious bugs live in that gap, where an edge check passed and the object check was missing.
Function level and object level
Function level authorisation decides whether a caller may use an operation at all, such as calling the admin user deletion endpoint. Object level authorisation decides whether the caller may use it on a particular object, such as deleting this user rather than any user. Many frameworks make function level checks easy with decorators and route rules, while object level checks require code that loads the object and compares ownership. Insecure direct object reference bugs, where changing an identifier in a URL exposes another user data, are object level failures.
Deny by default
Authorisation systems should deny anything not explicitly allowed. An endpoint without a declared policy should fail closed, a new role should start with no permissions and an unknown action should be refused. Designs that allow by default and list exceptions inevitably miss some, and every new feature becomes accessible to everyone until someone remembers to restrict it. Frameworks can enforce deny by default by refusing to register routes without an authorisation declaration, which turns a forgotten check into a failed build.
Least privilege
Least privilege means each subject holds only the permissions it needs for its current work. It limits the damage of a compromised account, a malicious insider or a bug that lets one user act as another. In practice, permissions accumulate: people change teams and keep old access, roles are granted for one task and never removed and service accounts receive broad permissions because narrowing them takes effort. Authorisation design and operations both have to push back against this drift continuously.
Separation of duties
Some actions should require more than one person. Approving your own expense claim, deploying code you wrote without review or both creating and paying a vendor invoice are classic examples. Separation of duties prevents a single compromised or dishonest account from completing a sensitive process alone. It is an authorisation rule that depends on history, who created the object, not only on the current subject attributes, which some models express more naturally than others.
Multi tenancy
Software serving many customer organisations must keep each tenant data separate. Tenant isolation is an authorisation rule applied to every query: the caller tenant must match the resource tenant. Because it applies everywhere, it is best enforced structurally, through query builders that add tenant filters automatically, row level security in the database or separate databases per tenant, rather than through checks each developer must remember. The tenancy lesson later in the course covers isolation bugs in detail.
Centralised and decentralised logic
Authorisation logic scattered across hundreds of handlers is hard to audit, test and change. Centralising it, in a library, a policy engine or an authorisation service, gives one place to read the rules, consistent enforcement and a single audit trail. Decentralised logic is not always wrong, because local checks are fast and close to the data, but even then the rules should be expressed through a shared vocabulary of actions and resources rather than ad hoc comparisons.
Policy decision and enforcement
Authorisation architectures often separate the policy decision point, which evaluates rules and returns allow or deny, from the policy enforcement point, the code that asks the question and acts on the answer. Enforcement points sit in gateways, services and data layers. The decision point may be a library in process or a separate service. This separation lets teams change policy without changing every service, test policies independently and log decisions consistently.
Explaining decisions
Users and support teams need to understand why access was denied, and auditors need to know why it was granted. Authorisation systems that can explain a decision, naming the role, attribute or relationship that allowed it, are far easier to operate. Denials should give users a clear message and a path to request access, without revealing whether the resource exists when that itself is sensitive. Decision logs with reasons are also the raw material for access reviews and incident investigations.
Choosing a model
Role based access control suits organisations with stable job functions and moderate numbers of permissions. Attribute based control suits rules that depend on properties of users, resources and context, such as region, classification or time. Relationship based control suits products where access follows sharing, ownership and hierarchy, such as documents in folders shared with teams. Real systems combine them, and the following sections explain each model, its strengths and the ways it fails at scale.
Authorisation in asynchronous work
Not every action happens inside a request. Background jobs, queue consumers, scheduled reports and webhooks all act on resources long after the user who triggered them clicked a button. These paths often run with a powerful service identity and skip the checks the interactive path performs, so a user who cannot export another tenant data directly may be able to schedule a report that does it. Jobs should carry the identity and tenant of the user who requested them, re-check authorisation when they run, because access may have been removed in the meantime, and refuse to act when the original subject no longer holds the permission. Webhooks and callbacks need the same care in reverse: an incoming event naming a resource must be checked against the tenant that the sending integration belongs to, not trusted because it arrived on an internal endpoint. Treating every entry point, synchronous or not, as a place where the same subject, action and resource question must be answered closes a class of bugs that request focused reviews regularly miss.
Authorisation answers whether a subject may perform an action on a specific resource in a context. Enforce coarse checks at the edge and object checks where the object is known, deny by default, keep privileges minimal, require separation for sensitive actions, enforce tenancy structurally and log decisions with their reasons.