Back to Blog

RBAC vs ReBAC vs ABAC: Comparison and Guide on how to get started

Vanessa Villa
Vanessa Villa

What is authorization (AuthZ)?

Authorization is a cornerstone of enterprise security. It dictates who can access specific resources, what actions they can perform, when, and the authorization logic can be as rigorous as to include attributes such as time of day.

As organizations expand, the amount of employees and users increase, the sensitive data becomes more critical, and selecting the right data access control model becomes crucial. The choice impacts not only security but also regulatory compliance and operational efficiency. Effective access control helps prevent unauthorized access, ensures data integrity, and maintains regulatory adherence.

Building authorization logic from scratch is hard, error-prone, and . We'll walk through the tradeoffs of each access control model and show you how to easily get started by adding them to your app for free with Pangea, a security API platform.

Understanding Access Control Models

The most common models for authorization logic are Role Based access control (RBAC), Relationship Based Access Control (ReBAC), Attribute Based Access Control(ABAC). These models provide a framework for authorization policy decisions.

Role Based Access Control (RBAC)

A RBAC system is a widely adopted model that assigns permissions based on user roles within an organization. Each role comes with a specific set of permissions, and users are assigned roles based on job functions (e.g., Admin, Manager, Employee) rather than individual permissions. This authorization model is very common due to the simplicity and ease of use.

Example: An Admin has permission to create, read, update, and delete a file. A Manager can only read and update the same file.

Relationship Based Access Control (ReBAC)

With ReBAC systems, access revolves around the relationships between users and resources. It focuses on the connections between entities to determine access, such as team membership and resource owner. ReBAC systems are particularly useful in environments where access needs to be limited to specific teams or groups. This relational context can also be applied to resource relationships since resources can also be nested and grouped.

Example: An employee is a member of the Project Team that owns the file system, and therefore has update access to the file system. If the employee was to change teams, they would no longer have access to the file system.

Attribute Based Access Control (ABAC)

Attribute-Based Access Control (ABAC) takes a different approach by using attributes to determine access rights. Attributes are characteristics of users, resources, and the environment. ABAC policies can be applied using user role, department, time of access, and resource type, to make dynamic access decisions, allowing for more granular and context-sensitive control. This granularity of user access is great for highly restrictive or sensitive fields.

Example: A policy might grant access to a document only if the employee is part of the finance department and the document is marked as “confidential.”

Comparative Analysis

Now that we have defined the most common authorization models, let’s compare them.

RBAC ReBAC ABAC
Granularity of Access Control Great for defined, limited # of roles Good for team/ context based access. Example would be teams and those teams “own” resources. As fine grained as possible, based on attributes like time, location, users’ team/ department
Flexibility Not very flexible, any change may require a newly defined role Somewhat flexible. Since access is based on relationships, one off access is difficult Very flexible. Policies can be applied based on any attribute
Complexity Not Complex to design. Somewhat complex to design groups and policies. Very complex to design policies.
Scalable Not very scalable, susceptible to role explosion Scales easily for group based policies and ownership based policies Scales easily for complex policies.
Management Very easy, just assign users to a role Assign user ownership or to a group who has ownership Since policies can be so granular, managing who has access can be cumbersome, but granting access is straightforward

If you are just getting started in your authorization journey, modeling out access with Roles is a great way to start. Think of how a chat bot may not need any additional context than if you are an Admin or User to determine what information to provide or that you have access to.

When the organizations become more domain specific, like having an engineering team and a marketing team, introducing ReBAC policies to manage access makes more sense. Imagine being able to ask the chat bot “Where are my files?” and the bot being able to provide a cloud drive location based on the fact that you are in the Marketing team and the assigned owner to certain files.

As organizations group and partners or contractors are introduced, additional granularity is needed and it may be time to consider ABAC policies. Imagine not allowing users access to the help desk contractors outside of operating hours.

Best Practices for Effective Authorization

In the realm of access control policies, implementing best practices ensures that your authorization processes are robust, manageable, and secure. Effective authorization practices should protect sensitive data, streamline access management, and reduce risks associated with unauthorized access. Here are some key best practices to follow:

Integrate Policies Across Models

A unified approach to security policies can enhance both security and manageability. When blending security policies, consider integrating access control models. This integration allows you to leverage the strengths of each model and apply policies that fit your organization's unique needs.

  • Comprehensive Policy Framework: Develop a comprehensive policy framework that incorporates the principles of RBAC, ABAC, and ReBAC. For example, use RBAC for managing core roles and permissions, but add in the ReBAC system to ensure that those permissions are only applied to the resources that the team owns. To read more about that, here is an article that goes over how to add in ReBAC system to RBAC.

  • Consistent Policy Application: Ensure that policies are applied consistently across different systems and platforms. This consistency helps avoid gaps in security and reduces the complexity of managing multiple policy types.

  • Align Policies with Organizational Objectives Your security policies should align with your organization's overall objectives and risk management strategies. This alignment ensures that access controls support business processes while protecting critical assets.

  • Regular Policy Review: Periodically review and update your policies to reflect changes in organizational goals, technology, and regulatory requirements. This practice helps maintain alignment and ensures that policies remain relevant and effective.

Policy Enforcement Defaults to Not Authorized

Adopt a Default Deny Approach

A fundamental principle of secure authorization is the "default deny" approach, where access is denied unless explicitly granted. This principle minimizes the risk of unauthorized access by ensuring that permissions are only granted after careful consideration.

  • Explicit Permission Grants: Define access permissions explicitly and avoid granting broad, default access. Ensure that each access request is evaluated against established policies and approved based on specific criteria.

  • Minimize Default Permissions: Avoid assigning default permissions that may inadvertently provide broader access than intended. Instead, start with the principle of least privilege, granting only the minimum permissions necessary for users to perform their tasks.

  • Audit Trails: Maintain detailed audit trails of access requests and permission changes. These logs provide a record of authorization activities and support compliance with regulatory requirements. To learn more about audit trails, check out this post on what they are and how to build one.

Reduce Authorization Sprawl

Authorization sprawl occurs when an excessive number of roles or policies lead to complexity and management challenges, especially in exclusively RBAC systems. To mitigate sprawl, a ReBAC system would be able to effectively apply additional access control policies to be more granular but this is not always available. Below are a few suggestions to help with exclusively RBAC systems to help manage role explosion.

  • Consolidate Roles & Policies: Regularly review and consolidate roles and policies to eliminate redundancy and overlap. A streamlined role structure simplifies management and reduces the risk of misconfigured permissions.This optimization helps maintain a clear and manageable policy framework.

  • Implement Role Lifecycle Management Effective role lifecycle management ensures that roles are created, updated, and retired in a controlled and systematic manner. This practice helps prevent role proliferation and maintains the integrity of your authorization model.

  • Role Approval Processes: Establish formal approval processes for creating and modifying roles. Ensure that new roles are reviewed and justified before implementation.

  • Regular Role Audits: Perform regular audits of roles and permissions to ensure that they remain aligned with organizational needs and security policies. Remove or update roles that are no longer relevant.

By following these best practices—blending security policies, adopting a default deny approach, and reducing authorization sprawl—you can create a more secure and manageable authorization framework. These practices not only enhance your organization’s security posture but also streamline access management and ensure compliance with regulatory requirements.

How to add Authorization to your app (RBAC)

RBAC can be configured in Pangea using the Pangea User Console. Create a free Pangea account, enable the AuthZ Service, and follow the steps below to configure.

**1. Add your Resource Types.
**Resources the types of things that we will have in our system. We get a ‘User’ resource by default but because we are defining a bank system it would need accounts and banks.

Each resource type by default has CRUD operations but if there is another permission type like Transfer or Invite needed, feel free to add them here.

2. Give Roles Access:
Go to the Roles and Access page to define each role’s permissions. For the bank example, we have Banker, Teller, and Account Owner roles. Their permissions to resources Bank and Accounts are shown below.

For a Banker, they should have access to create, delete, read and update for banks but only be able to read and update accounts.

As per the granting access for the tellers, they need to be able to read and update both the account and bank. Their access table should look something like the image below.

Finally, clients are the only people who are able to open and close accounts so they have create, delete, read, and update access to account but no permissions for bank

3. Assign a Role: This is where we put all of it together and can assign Users to specific roles. For today’s example, we are going to do the following assignment of User “Pango” is a “Client”.

4. Check the configurations: Head over to the Playground on the left nav panel and test the access control policies based on the roles we just defined.

5: Install the SDK and token values: to make an access check in your application, you can install AuthZ SDK like below.

npm install pangea-node-sdk

You copy the Default token and Pangea Domain into your environment variables. Those values are located in the AuthZ Overview Page.

#Put this in your .env file with the correct values
PANGEA_DOMAIN="<Pangea Domain Value>"
PANGEA_TOKEN="<Pangea Token>"

6. Call AuthZ to check access: The call to check if a user has access to a resource looks like the code snippet below.

import { PangeaConfig, AuthZService } from "pangea-node-sdk";

const token = process.env.PANGEA_TOKEN;
const config = new PangeaConfig({ domain: process.env.PANGEA_DOMAIN });
const authz = new AuthZService(token, config);
const roleCheck = await authz.check({
         resource: {type: account},
         action: create,
         subject: { type: 'user', id: ‘Pango’},

     });

// this should be true, as shown in the playground as well
console.log(roleCheck.allowed);

For more information on how to configure your access policies in Pangea, check out this documentation here.

Conclusion

RBAC, ReBAC, and ABAC each offer distinct advantages and limitations. Selecting the right access control model depends on organizational needs, security requirements, and the complexity of access scenarios. But the real power comes from building an authorization model that can incorporate aspects of all models to directly fit your needs. Starting off with the simplicity of RBAC and incorporating a ReBAC system as an organization expands. As the teams or responsibilities become more complex, ABAC can be introduced to help ensure the correct access controls.

Pangea offers a centralized place to build out your authorization policies and include the ability to blend the different models in line with your organizational needs. Try it out today

Get updates in your inbox and subscribe to our newsletter

background landmass

We were recognized by Gartner®!

Pangea is a Sample Vendor for Composable Security APIs in the 2024 App Sec Hype Cycle report