Permit logo
  • OPA
  • cedar
  • Cedar
  • Best Practices
  • Google-Zanzibar

Policy Engines: Open Policy Agent vs AWS Cedar vs Google Zanzibar

Choosing the right policy agent to handle your authorization is not a simple task - each offers its benefits and has its drawbacks. How to choose? Read here.

Daniel Bass

Aug 17 2023
Policy Engines: Open Policy Agent vs AWS Cedar vs Google Zanzibar
Share:

Navigating the complex world of access control and authorization in modern software systems requires the right authorization solutions. In this article, we explore three powerful approaches: Open Policy Agent (OPA)AWS Cedar, and Google Zanzibar. Each of these systems offers unique features and benefits, catering to different use cases and organizational needs. Let’s dive into the strengths and limitations of these policy-based authorization systems, so you can make an informed decision for your application's security and scalability.

Open Policy Agent (OPA) Based

OPA is an open-source policy engine for controlling access to systems and resources. 

It uses a high-level declarative language called Rego to define policies and evaluate complex authorization rules. With OPA, you can separate policy logic from your application code, enabling easy policy management and updates without requiring code changes or deployments. OPA has gained significant industry adoption and is backed by a thriving community, making it a reliable choice for building robust and fine-grained authorization services.

Advantages of using OPA:

  • Policy-as-Code: OPA uses the Rego language to define policies, allowing policies to be treated as code with benefits such as versioning, auditing, and transparent review processes.

  • Performance: OPA stores policies and data in an in-memory cache, resulting in fast policy evaluations, even for complex rules.

  • Fine-Grained Permissions: OPA supports Role-Based Access Control (RBAC), Attribute-Based Access Control (ABAC), and Relationship-Based Access Control (ReBAC, With certain adjustments), enabling granular permissions management. Here are some useful examples: 

Disadvantages of using OPA:

  • Learning Curve: There is a significant learning curve associated with the Rego language used by OPA, which may require some initial investment in understanding its syntax and rules. As Rego is a logical programming language (like Datalog or Prolog) and less like common languages like Python or Go.

Some additional considerations: 

  • Some rules rely on real-time user data (i.e., if the user is a subscriber or not). Real-time policy updates can be very complex to achieve with OPA.

  • Rules that rely on multiple data sources require bundling that is not straightforward.

  • It can be challenging to keep all OPAs in sync when running more than one OPA instance.

While not supported by OPA by itself, these three issues can be resolved by using OPAL on top of OPA, which offers an admin layer on top of and serves real-time updates. 

All in all, by leveraging OPA, you can benefit from a mature and widely adopted solution that provides flexibility, decoupling of code and policy, compatibility with various systems, and efficient policy evaluations.

A more detailed guide to OPA is available here

Cedar-Based

AWS Cedar is a new open-source policy-as-code language developed by AWS to streamline IAM management and access control. It introduces a structured and scalable approach to managing permissions, making it a game-changer for application-level permissions.

Advantages of using Cedar:

  • Policy-as-Code: Same as OPA, Cedar uses a policy language to define policies, allowing policies to be treated as code with benefits such as versioning, auditing, and transparent review processes.

  • Readability: Cedar is designed to be highly readable, making it easier for both technical and non-technical team members to understand and work with the language. 

  • Structured and Safety-Oriented: Cedar follows a structured approach, emphasizing safety by default. It prioritizes correctness and security, providing assurances through verification-guided development.

  • Application-Level Authorization: Cedar is specifically tailored for application-level authorization. It is well-suited for managing and enforcing permissions within applications, ensuring that access control requirements are effectively met at the application level.

  • Fine-Grained Permissions: Cedar supports Role-Based Access Control (RBAC), Attribute-Based Access Control (ABAC), and Relationship-Based Access Control (ReBAC) as well, enabling granular permissions management. Here are some useful examples:

    Role-Based Access Control (RBAC) with Cedar

Disadvantages of using Cedar:

  • Limited Tooling and Ecosystem: Compared to other policy languages, Cedar currently has a smaller ecosystem of tools and modules available. It may have fewer built-in tools for specific tasks, which might require additional effort or custom implementations when working with certain functionalities.

  • Less Established Community: As a relatively new policy language, Cedar has a small, (yet blooming!) community compared to other more established alternatives. This could result in fewer available resources, documentation, and community-driven support when encountering challenges or seeking assistance with Cedar-related projects.

An in-depth comparison between OPA and Cedar is available here

Zanzibar-based

Unlike the previous two, Google Zanzibar is a graph-based authorization model. Graph-based authorization systems utilize a graph to represent relationships (such as ownership) between users and resources. 

Advantages of Google Zanzibar:

Relationship-based Access Control (ReBAC) focused: Graph-based systems excel at managing hierarchies and nested relationships, making them a natural fit for scenarios requiring ReBAC. Google Zanzibar provides a robust foundation for modeling complex access control relationships effectively.

Data Consistency and Scale: Graph-based systems handle high volumes of data while maintaining consistency. This makes them well-suited for large-scale environments where data integrity and scalability are crucial.

Disadvantages of Google Zanzibar:

System Complexity and Dependencies: Implementing a Zanzibar-based graph introduces a complex system into the cloud environment. It often relies on hosted services, potentially leading to latency concerns and scalability challenges. Dependencies on external services can impact system performance and introduce additional points of failure.

Limited Applicability at the Edge: Graph-based systems like Zanzibar are typically challenging to deploy at the edge due to their size and non-local nature. This limitation may hinder their practicality in edge computing scenarios, where low latency and efficient access control are essential.

Further reading on Zanzibar and comparing it to OPA is available here.

Summary:

We learned about three prominent policy-based authorization systems: Open Policy Agent (OPA), AWS Cedar, and Google Zanzibar. 

OPA stands out as an open-source policy engine, leveraging the Rego language for defining policies and granting fine-grained permissions. It offers Policy-as-Code, high performance, and industry adoption, but may require a significant learning curve.

AWS Cedar, another policy-as-code language developed by AWS, emphasizes readability, structured design, and application-level authorization focus. While Cedar's safety-oriented approach and fine-grained permissions are commendable, it faces challenges related to its limited tooling and smaller community support.

Google Zanzibar, on the other hand, offers a graph-based authorization model, excelling in managing access control via relationships. However, it introduces system complexity and dependencies, making it less suitable for edge or high performance computing scenarios.

With a comprehensive understanding of the strengths and weaknesses of these three systems, organizations can make informed decisions while building robust and efficient authorization services for their applications.

Want to learn more about authorization? Join our Slack community, where there are hundreds of devs building and discussing authorization models and implementations. 

Daniel Bass

Application authorization enthusiast with years of experience as a customer engineer, technical writing, and open-source community advocacy. Comunity Manager, Dev. Convention Extrovert and Meme Enthusiast.

Have a Comment? Question?

Join the Discussion