Skip to content

Authorization models

How a system decides whether a caller may act on a resource: a list on each object, roles, attributes evaluated against policy, or relationships in a graph. A strong answer names which fits the product's sharing and where checks run.

On this page

What it is

Authentication establishes who the caller is; authorization decides whether that caller may perform a given action on a given resource. An authorization model is the shape of the data and rules that answer that question. Four shapes to know: a list of grants attached to each object (an access control list, or ACL), roles that bundle permissions (RBAC), policies evaluated over attributes (ABAC), and rules that follow relationships between users and objects (ReBAC). The choice shapes the data model, the write path for sharing, and how the system answers "what can this user see?", so it belongs early in a design, not in the last five minutes.

ACLs and RBAC. Before roles, an administrator granted access by editing a list on each resource or for each user. NIST's role-based model, formalized in 1992 and later published as the INCITS 359 standard, was a response to the cost of that administration: each user is assigned one or more roles, each role carries a set of privileges, and the software handles role hierarchies and mutually exclusive roles. The user-to-role mapping is many-to-many, and permissions are attached to roles rather than directly to people. The weak spot is object-level decisions: a role says that someone is an editor, not that they may edit document 42.

ABAC. NIST SP 800-162 defines attribute-based access control as deciding a request by evaluating attributes of the subject, the object, the requested operation and, sometimes, the environment against a policy that says which combinations are allowed. Attributes are name-value pairs: job function, department, data classification, time of day, device, project. A role can be one attribute among several, so a role-based rule can be written as one ABAC policy among others. Implementations typically gather attributes from several sources at decision time, which is where the latency and the operational complexity live.

ReBAC. Relationship-based access control grants access through relationships between users and objects, and between objects: the creator of a post may edit it; a user may view a document if they may view its parent folder. The Zanzibar paper describes the implementation that serves Drive, YouTube, Calendar and Cloud. It stores ACLs as relation tuples written as object, relation, user, where the user part may itself be a set, such as the members of a group, which is how nested groups are expressed. Some relations, such as viewer, grant access directly; others, such as a parent relation pointing at a folder, link two objects so that access can flow through them, and a check follows those links when it needs to. It reports more than two trillion stored ACLs, millions of checks per second, and one data model and configuration language serving hundreds of client services. ReBAC can express RBAC directly (a role is a relationship to a tenant or organization); OpenFGA's documentation calls it a superset of RBAC for that reason.

How a decision is composed. When several policies apply, the engine needs a rule for combining them. AWS IAM is a well-documented example: for any principal other than the account root user, a request starts as an implicit deny, must be explicitly allowed by at least one applicable policy, and is refused if any applicable policy carries an explicit deny, whatever the allows say. Deny by default is the same principle stated as a design rule: when no rule matches, the system still has to decide, and the safe decision is to refuse. Being able to point at the rule that granted a permission, rather than assuming access, is what the rule buys you.

Where the check runs. The guidance is to validate permissions on each request, whatever its origin, and to do it through a single application-wide mechanism such as a filter or middleware rather than a call added by hand to each method. The reasoning is that an attacker needs one missed check, so the design should make a miss unlikely rather than relying on review to catch it.

When to use it

Pick RBAC when access follows job function and the set of roles stays small: an admin console, an internal tool, a single-tenant product with no per-item sharing. Its administrative simplicity is the whole argument; NIST's case for the model rests on lower cost of administration compared with per-user grants.

Pick ABAC when the decision depends on context that is not a role or a relationship: a record's classification, the caller's clearance, the time of day, the device or network the request came from, or a combination of several such factors. ABAC also fits sharing data across organizations, since the policy can be written in attributes both sides agree on while each keeps control of its own data.

Pick ReBAC when users share individual items, when permission flows down a hierarchy (a folder grants access to the documents inside it), when groups nest, or when several tenants live in one deployment. Those are the cases where roles multiply and ABAC policies grow long, and where a relationship graph answers both "may Alice view this?" and the reverse question, "which documents may Alice view?".

Name the consistency requirement as part of the choice. The Zanzibar paper calls one failure the "new enemy" problem: Alice removes Bob from a folder's viewers, then adds a new document to the folder; if the check for Bob's read is answered from an ACL snapshot older than his removal, he sees the document. The remedy described there is to timestamp ACL and content changes in causal order and to let a client carry an opaque token (a zookie) that forces a check to read a snapshot at least as fresh as a given change. In an interview, the point to make is that a cached permission decision is a stale read, and you need to say how fresh it must be for revocation to mean something.

When not to

Don't build a dedicated authorization service with a relationship graph for a product that has a handful of roles and no per-item sharing. A roles table in the application database, read through one middleware check, is simpler to reason about, cheaper to run and easier to test, and nothing in the product asks for more. The same goes for a globally replicated relationship store when the product has one tenant and a few hundred users: that design answers trillions of grants and checks arriving from anywhere in the world, and if your product is nowhere near that, say so and keep the grants local.

Don't choose ABAC when the product has to list who can access an item, or what a user can access, as a routine query: a sharing dialog, an admin audit, a search that must filter results by permission. A policy evaluated over attributes fetched at decision time answers "may this request proceed?" well, but turning it around into "for which objects would this policy say yes?" is hard, while a relationship graph is built to be queried in both directions.

Don't treat the user interface as an enforcement point. Hiding a button or a menu entry reduces accidental misuse, but the guidance is to validate permissions server-side on each request regardless of where it came from, including requests from scripts and from other services. And don't guard a resource by assuming its identifier stays secret: a lookup ID that can be guessed or edited in a URL still needs the same check as any other request.

Compared

ModelA grant is stored asRight choice whenWhere it hurts

ACL

An entry on the object: this principal may do this action

Few objects, few principals, and grants are edited one object at a time, as with file system permissions

Administering thousands of lists; no easy answer to "what can this user reach?"

RBAC

A role on the user, permissions on the role

Access follows job function and there is little or no sharing of individual items

Per-object decisions; roles multiply when teams, projects or tenants each need their own

ABAC

A policy over attributes of subject, object, action and environment

Decisions depend on context (classification, clearance, time, device) or cross organizations

Fetching attributes at decision time; reverse queries (who can see X?) are hard

ReBAC

A relation tuple: object, relation, user or userset

Users share single items, permission flows down hierarchies, groups nest, several tenants share one deployment

Checks through nested groups or folder hierarchies walk a graph; revocation needs a consistency story; more infrastructure than a roles table

In a picture

allowdenyUser, action,resourceMiddleware checkHandler runsRefuse and log

Step 1 of 3

One enforcement point

Each request carries who is calling, the action and the resource. A single middleware or filter intercepts it before any handler runs, so a handler that forgets to check is still covered.

How to say it in an interview

The common mistake

Quiz

Users may view a document if they may view the folder it lives in, and folders nest. Which model expresses that most directly?
A request matches a policy that allows the action and another applicable policy that explicitly denies it. Under AWS IAM evaluation, what happens?
Alice removes Bob from a folder's viewers, then adds a confidential document to it. Bob's read is checked against a cached permission result and succeeds. What design property was missing?
The front end hides the Delete button for users who lack the permission. What does the server still need?

Questions that use this

Related

Sources

  1. NIST CSRC: Role Based Access Control (project page)
  2. NIST SP 800-162: Guide to Attribute Based Access Control (ABAC) Definition and Considerations
  3. Zanzibar: Google's Consistent, Global Authorization System (2019 paper, annotated copy hosted by AuthZed)
  4. OWASP Cheat Sheet Series: Authorization
  5. AWS IAM User Guide: How AWS enforcement code logic evaluates requests to allow or deny access
  6. OpenFGA documentation: Authorization Concepts
Sign in to report a mistake