Dev tools
RBAC vs ABAC: Which Access Control Model to Use
RBAC vs ABAC compared: how role-based and attribute-based access control work, examples in Kubernetes, AWS and Azure, PBAC and ReBAC, and when to use each.
RBAC vs ABAC is a choice between granting access by role and granting it by attributes. Role-based access control (RBAC) gives users roles such as admin, editor or viewer, and each role carries a fixed set of permissions; it's simple to set up and easy to audit. Attribute-based access control (ABAC) evaluates rules over attributes of the user, the resource, the action and the context, such as department, data classification, location or time; it's far more fine-grained and flexible, but harder to design and test. Most teams start with RBAC and add attribute rules where roles stop scaling.
This guide explains how each model works, the difference between ABAC and RBAC in detail, an RBAC vs ABAC example in Kubernetes, AWS and Azure, the role explosion problem with real numbers, how PBAC and ReBAC fit in, which is more secure, and a checklist for choosing.
RBAC vs ABAC at a Glance
| RBAC | ABAC | |
|---|---|---|
| Access decided by | The user's role(s) | Rules over user, resource, action and environment attributes |
| Typical rule | "Editors can edit articles" | "Users can edit documents in their own department, during business hours, from a managed device" |
| Granularity | Coarse to medium | Fine |
| Context-aware (time, location, device) | No, not natively | Yes |
| Setup effort | Low | Higher: attributes must exist, be accurate and be governed |
| Auditing "who can access X?" | Easy: list role members | Harder: depends on current attribute values |
| Scaling problem | Role explosion | Policy complexity |
| Standards and references | NIST RBAC model, ANSI INCITS 359-2004 | NIST SP 800-162, OASIS XACML |
| Common implementations | Kubernetes RBAC, Azure RBAC, database roles, most SaaS admin panels | AWS IAM tags, Azure ABAC conditions, OPA, Cedar |
| Best for | Stable organisations with clear job functions | Large, dynamic or regulated environments |
What Is Role Based Access Control?
Role based access control assigns permissions to roles and roles to users, instead of assigning permissions to each user directly. The model was formalised at the US National Institute of Standards and Technology by David Ferraiolo and Richard Kuhn in 1992 and became the ANSI INCITS 359-2004 standard.
The core pieces are:
- Users: people or service accounts.
- Roles: named job functions, such as support agent, billing admin or read-only auditor.
- Permissions: allowed operations on resources, such as
invoices:readorusers:delete. - Assignments: which users hold which roles, and which permissions each role grants.
Two extensions matter in real systems. Role hierarchies let a senior role inherit a junior one's permissions (a manager has everything an agent has, plus approvals). Separation of duties prevents one person from holding conflicting roles, such as creating and approving the same payment.
RBAC's strength is that it matches how organisations think. When someone joins the support team, you give them the support role; when they leave, you remove it. Answering "who can delete users?" means listing the members of the roles that hold that permission, which is exactly what auditors ask for.
What Is Attribute-Based Access Control?
NIST's Special Publication 800-162 (2014) defines ABAC as an access control method where a requested operation is granted or denied by evaluating attributes of the subject and object, environment conditions, and a set of policies specified in terms of those attributes.
ABAC policies combine four kinds of attributes:
- Subject attributes: department, clearance, job title, employment type, team, manager.
- Resource attributes: owner, classification (public, internal, confidential), project, region, creation date.
- Action attributes: read, write, approve, export, delete.
- Environment attributes: time of day, IP range or network, device health, location, risk score.
A policy might say: allow read on a patient record if the user's role is clinician, the user's ward equals the record's ward, and the request comes from a hospital network. No role names "clinician on ward 4 in-network" exists; the decision is computed at request time.
The architecture behind most ABAC systems, described in NIST SP 800-162 and the XACML standard, splits the work into parts: a policy enforcement point (the code that intercepts the request), a policy decision point (the engine that evaluates the rules), a policy information point (where attributes come from, such as the identity provider or a database) and a policy administration point (where policies are written and managed).
Difference Between ABAC and RBAC
The difference between ABAC and RBAC shows up in six practical ways.
1. Granularity. RBAC answers "can editors edit articles?" ABAC can answer "can this editor edit this article right now?" taking ownership, status, region or time into account.
2. Change management. In RBAC, a new resource or project often means new roles or new role permissions. In ABAC, tag the new resource with the right attributes and existing policies cover it. AWS's IAM documentation names this as ABAC's main advantage: permissions scale with new resources without policy updates.
3. Role explosion vs policy complexity. RBAC breaks down when access depends on combinations of factors, because each combination needs its own role. ABAC avoids that but moves the complexity into policies, which need testing like code.
4. Auditability. RBAC makes "who has access to X?" a simple query. With ABAC, the answer depends on current attribute values across systems, so you need tooling to simulate and explain decisions.
5. Data quality. ABAC is only as good as its attributes. If HR data says someone is still in finance after they moved to marketing, they keep finance access. RBAC has a similar risk with stale role assignments, but it's easier to see.
6. Performance. RBAC checks are simple lookups. ABAC may need to fetch attributes from several sources at request time, so caching and careful design matter at scale.
Worked Example: Counting the Role Explosion
Suppose a company wants access to depend on four factors: department (4 options), seniority (3), region (3) and employment type (employee or contractor, 2).
| Pure RBAC | ABAC | |
|---|---|---|
| Roles or policies needed to cover every combination | 4 × 3 × 3 × 2 = 72 roles | 4 attributes plus a handful of policies |
| Add a fourth region | 4 × 3 × 4 × 2 = 96 roles (+24) | Add a new attribute value; no new policies |
| Add a fifth department | 5 × 3 × 4 × 2 = 120 roles (+24) | Add a new attribute value |
| Move a user to another region | Remove one role, add another | Update one attribute in the directory |
| Answer "who can read EU finance reports?" | List members of the matching roles | Evaluate the policy against all users' current attributes |
Most real organisations don't need every combination, so they never build all 72 roles. But the pattern is real: every factor added to access decisions multiplies roles in RBAC and only adds an attribute in ABAC.
RBAC vs ABAC Example in Real Systems
Here's an RBAC vs ABAC example from three platforms developers use daily.
Kubernetes RBAC. Kubernetes uses pure RBAC. A Role grants verbs on resources within a namespace, and a RoleBinding assigns it to users or service accounts. This example from the Kubernetes documentation lets the holder read pods in the default namespace:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: pod-reader
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "watch", "list"]Our Docker vs Kubernetes guide covers where Kubernetes fits if you're new to it.
AWS IAM with ABAC. AWS calls attributes tags. One policy can let anyone whose IAM role carries a project tag manage only EC2 instances tagged with the same project, so new projects need no new policies:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["ec2:StartInstances", "ec2:StopInstances"],
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:ResourceTag/access-project": "${aws:PrincipalTag/access-project}"
}
}
}
]
}Azure: RBAC plus ABAC conditions. Azure starts with RBAC (role definitions and role assignments) and adds attribute-based role assignment conditions on top. Microsoft's documentation describes Azure ABAC as building on Azure RBAC to filter permissions further, for example allowing read access to blobs only if they carry the tag Project=Cascade. Conditions currently apply to Blob Storage and Queue Storage data actions, and they can only narrow access granted by a role, never deny resources explicitly. This hybrid design is how most people searching "RBAC vs ABAC Azure" end up using both.
Policy languages. Dedicated engines express ABAC rules as code. In Cedar, the open-source policy language from AWS, a rule that lets users read documents from their own department looks like this:
permit (
principal,
action == Action::"read",
resource
)
when { principal.department == resource.department };Open Policy Agent (a graduated CNCF project) does the same with its Rego language, and is often used for Kubernetes admission control and API authorization.
RBAC vs ABAC vs PBAC vs ReBAC
The question "RBAC vs ABAC vs PBAC" comes up because vendors use several overlapping terms. Here's how the models relate:
| Model | Access decided by | Example | Typical use |
|---|---|---|---|
| ACL (access control list) | A list on each resource of who may do what | File permissions, S3 bucket ACLs | Simple per-resource sharing |
| DAC (discretionary) | The resource owner decides | Sharing a document you created | Consumer apps, file systems |
| MAC (mandatory) | Central labels and clearances, users can't override | Secret / top secret classification | Military, high-security systems |
| RBAC | Roles | Admin, editor, viewer | Most business software |
| ABAC | Attributes and rules | Department = record's department, during work hours | Regulated or dynamic environments |
| PBAC (policy-based) | Centrally managed policies, often written as code | Rules in OPA or Cedar that combine roles and attributes | Large organisations standardising authorization |
| ReBAC (relationship-based) | Relationships between users and objects | Members of a folder's owning team can edit it | Collaboration apps, document sharing |
PBAC is less a separate model than a way of managing access: policies live in one place, are versioned and tested like code, and can use roles, attributes and relationships. ReBAC, popularised by Google's Zanzibar paper (2019) and open-source systems inspired by it such as OpenFGA and SpiceDB, fits products where sharing follows a graph: organisations, teams, folders, documents.
Which Is More Secure?
Neither is automatically more secure. ABAC can enforce tighter least privilege, because it can grant exactly the access a situation needs and take context such as device or location into account. RBAC is easier to reason about and audit, which prevents a different class of mistakes: over-broad access that nobody notices.
The biggest security gains come from practice, not the model: removing unused access, reviewing role membership regularly, keeping attribute sources accurate, testing policies, and logging every decision. Broken access control has topped the OWASP Top 10 since 2021, and most of those breaches come from missing checks in code, not from choosing the wrong model.
When to Use RBAC, ABAC or Both
Choose RBAC if:
- Your access needs map cleanly to a handful of job functions.
- You need simple, fast audits for compliance.
- Your team is small or your attribute data (HR, asset inventory) isn't reliable yet.
- You're building a typical SaaS admin panel with owner, admin, member and viewer roles.
Choose ABAC if:
- Access depends on combinations of department, region, project, classification or customer.
- Context matters: time windows, network location, device posture, risk scores.
- You're in a regulated industry where data access must follow data classification or residency rules.
- Resources are created constantly and you can't update policies for each one.
Use both (most common): RBAC for baseline permissions and ABAC conditions for sensitive data or contextual rules. Azure's design and many SaaS products work this way, and so do most authorization layers built with policy engines.
How to Implement Access Control Well
- Inventory resources and actions. List what needs protecting and the operations on it before designing roles or policies.
- Start with a few roles. Owner, admin, member, viewer covers most products at first. Resist creating a role per request.
- Centralise the decision. Put authorization checks in one service or library rather than scattered
ifstatements, so you can test and change them. - Add attributes deliberately. Choose attributes with a reliable source of truth, such as the identity provider for department or the database for ownership.
- Test policies like code. Write unit tests for allow and deny cases, and simulate changes before rolling them out.
- Log decisions. Record who requested what, the decision and the reason, so you can audit and debug.
- Review access regularly. Quarterly reviews of role membership and policy changes catch drift.
Authorization usually sits behind authentication and tokens; if you're designing the token side, our OAuth vs JWT guide explains how scopes and claims carry permission information to APIs.
Common Mistakes
- One role per person. That's just per-user permissions with extra steps.
- Roles for every combination, leading to hundreds of near-duplicate roles nobody understands.
- ABAC without attribute governance, so stale HR or tag data grants the wrong access.
- Policies nobody can explain, with no tests, no simulation tool and no decision logs.
- Checking only the role, not the object, so an editor can edit any customer's records by changing an ID in the URL.
- Ignoring service accounts, which often end up with the broadest access and the least review.
FAQ
Is ABAC better than RBAC?
ABAC is more flexible and fine-grained, but not better in every case. For organisations with clear job functions and modest needs, RBAC is simpler, cheaper and easier to audit. ABAC pays off when access depends on many factors or on context.
Can you use RBAC and ABAC together?
Yes, and most mature systems do. Roles provide baseline permissions, and attribute rules narrow them for sensitive resources or add conditions such as region, classification or time.
What is PBAC?
Policy-based access control manages authorization as centrally defined policies, often written as code in engines such as OPA or Cedar. Those policies can use roles, attributes or both, so PBAC is closer to a management approach than a competing model.
Is RBAC outdated?
No. RBAC remains the default in Kubernetes, cloud platforms, databases and most SaaS products. What's changed is that it's often combined with attribute or relationship rules for cases roles handle badly.
What is the difference between RBAC and ReBAC?
RBAC grants access by role across the system, while ReBAC grants it through relationships with specific objects, such as being a member of the team that owns a folder. ReBAC suits collaboration apps where sharing follows a hierarchy of organisations, teams and documents.