<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AuthZed</title>
    <description>The latest articles on DEV Community by AuthZed (@authzd).</description>
    <link>https://dev.to/authzd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1135409%2F608e268a-8a3f-4d4c-afa1-538e3f15ca67.png</url>
      <title>DEV Community: AuthZed</title>
      <link>https://dev.to/authzd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/authzd"/>
    <language>en</language>
    <item>
      <title>SpiceDB Office Hours</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Thu, 19 Sep 2024 12:55:26 +0000</pubDate>
      <link>https://dev.to/authzd/spicedb-office-hours-1pe0</link>
      <guid>https://dev.to/authzd/spicedb-office-hours-1pe0</guid>
      <description>&lt;p&gt;💡 SpiceDB office hours are a great way to learn more about authorization!&lt;/p&gt;

&lt;p&gt;🚀 Live demos, announcements, &amp;amp; expert Q&amp;amp;A.&lt;/p&gt;

&lt;p&gt;Register here: &lt;br&gt;
&lt;a href="https://app.livestorm.co/authzed/office-hours?type=detailed" rel="noopener noreferrer"&gt;https://app.livestorm.co/authzed/office-hours?type=detailed&lt;/a&gt;&lt;/p&gt;

</description>
      <category>authorization</category>
    </item>
    <item>
      <title>Navigating the Developer Landscape: Building, Selling, and Securing Tools | That Tech Pod</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Tue, 20 Aug 2024 16:30:00 +0000</pubDate>
      <link>https://dev.to/authzd/navigating-the-developer-landscape-building-selling-and-securing-tools-that-tech-pod-47o6</link>
      <guid>https://dev.to/authzd/navigating-the-developer-landscape-building-selling-and-securing-tools-that-tech-pod-47o6</guid>
      <description>&lt;p&gt;In this episode of That Tech Pod, Jake Moshenko, co-founder and CEO of AuthZed, discusses his journey from Amazon and Google to building a leading permissions system.&lt;/p&gt;

&lt;p&gt;Key takeaways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From Big Tech to Startup: Jake shares insights into working at both Amazon and Google, including Amazon's controversial firing practices.&lt;/li&gt;
&lt;li&gt;Building for Developers: Learn about the challenges and rewards of creating developer tools and the importance of focusing on developer experience.&lt;/li&gt;
&lt;li&gt;AuthZed's Journey: Discover how Jake and his co-founders, with their extensive enterprise software background, leveraged the Zanzibar papers to create AuthZed and solve critical authorization challenges.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Permissions Systems: Building an Authorization Lexicon</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Wed, 07 Aug 2024 15:57:00 +0000</pubDate>
      <link>https://dev.to/authzd/permissions-systems-building-an-authorization-lexicon-2h1g</link>
      <guid>https://dev.to/authzd/permissions-systems-building-an-authorization-lexicon-2h1g</guid>
      <description>&lt;h2&gt;
  
  
  Why words matter
&lt;/h2&gt;

&lt;p&gt;Every field develops its own linguistic shortcuts – jargon – to streamline communication around complex ideas. Consider &lt;em&gt;browser cookies&lt;/em&gt;: a term that conjures images of tasty treats, but actually refers to bits of data that can be used for tracking online activity. While convenient for insiders, such jargon can be confusing for the uninitiated.&lt;/p&gt;

&lt;p&gt;Common language, including jargon, usually settles organically as an area of practice matures. Sometimes early innovators intentionally agree to a particular framework for convenience.&lt;/p&gt;

&lt;p&gt;While the practice of building authorization in applications is not new, modern approaches are evolving rapidly, spurred by advancements like &lt;a href="https://authzed.com/zanzibar" rel="noopener noreferrer"&gt;Google's Zanzibar paper&lt;/a&gt; and the increasing demand for sophisticated collaborative features.&lt;/p&gt;

&lt;p&gt;However, the language used to describe authorization solutions hasn't kept pace. We often rely on terminology borrowed from the lexicon of identity and access management (IAM), a field focused on resource control rather than application development. This mismatch can hinder clear communication and can lead to confusion.&lt;/p&gt;

&lt;p&gt;How do we start clearing the air? Common language helps the community converse more productively about the tradeoffs involved when comparing authorization services and permissions systems. The first step: establish a shared vocabulary, starting with foundational elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Semantics
&lt;/h3&gt;

&lt;p&gt;Often used interchangeably, the terms &lt;em&gt;permissions&lt;/em&gt; and &lt;em&gt;authorization&lt;/em&gt; represent distinct, yet related concepts. &lt;strong&gt;Permissions&lt;/strong&gt; establish and reason about the rules and logic that govern permissible actions, defining the boundaries of what can and cannot be done under specific conditions and contexts. &lt;strong&gt;Authorization&lt;/strong&gt; is the &lt;em&gt;process&lt;/em&gt; of answering questions about permissions. In short, permissions determine whether or not an action is authorized.&lt;/p&gt;

&lt;h2&gt;
  
  
  Permissions systems
&lt;/h2&gt;

&lt;p&gt;To determine whether any particular action is allowed or not, a decision maker requires the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A defined set of guidelines governing allowable actions&lt;/li&gt;
&lt;li&gt;Relevant data about the action, including the actor (who's doing it), the action itself, the object of the action, and sometimes additional context or attributes&lt;/li&gt;
&lt;li&gt;The method for applying those guidelines to the relevant data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In a legal trial, the court determines whether the defendant's actions violated the law. The laws and policies serve as the set of guidelines, while the facts of the case provide the information relevant to the action in question. The mechanism that applies these laws and policies to the facts of the case would be the judge or jury.&lt;/p&gt;

&lt;p&gt;Coming back to software, an authorization decision requires similar information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A permissions model that defines the logic and rules governing allowable actions&lt;/li&gt;
&lt;li&gt;Data pertinent to the decision being made, either from a datastore or provided at runtime&lt;/li&gt;
&lt;li&gt;Engine capable of applying logic and rules to provided data and returning a decision&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5nWGFaiV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/base-permissions-transparent.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5nWGFaiV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/base-permissions-transparent.png" width="345" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These components make up a &lt;strong&gt;permissions system&lt;/strong&gt;. The system itself may be wholly contained outside of an application, be dispersed throughout a monolithic application, or some combination of both. A system might have multiples of a component, such as multiple data sources or permissions models.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S6e4BkgJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/permissions-systems-examples.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S6e4BkgJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/permissions-systems-examples.png" width="800" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Applying SpiceDB concepts to this terminology, a SpiceDB permissions system uses a schema to structure relationship data, creating a graph database capable of returning answers about authorization.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--owTohFvf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/building-spicedb-graph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--owTohFvf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/building-spicedb-graph.png" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The permissions system concept not only applies to other Zanzibar implementations, but any other system that may follow a different paradigm.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SrXouIQs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/permissions-systems-examples-specific.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SrXouIQs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/permissions-systems-examples-specific.png" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Authorization service
&lt;/h2&gt;

&lt;p&gt;While a permissions system can function independently to provide authorization to an application, an &lt;strong&gt;authorization service&lt;/strong&gt; provides a layer of abstraction on top of a permissions system.&lt;/p&gt;

&lt;p&gt;This service manages the business logic of authorization and permissions systems while also providing additional operational functionality such as caching decisions, auditing and logging, and managing supportive resources.&lt;/p&gt;

&lt;p&gt;Used in context, the AuthZed Cloud authorization service deploys, manages, and provides additional operational capabilities for SpiceDB permissions systems. Other organizations choose to build their own authorization service for their SpiceDB permissions systems within their own infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hXrW0Shb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/authorization-service-diagram.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hXrW0Shb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/authorization-service-diagram.png" width="800" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By establishing a clear and consistent lexicon for implementing authorization, we foster a shared understanding that allows us to compare disparate approaches, evaluate tradeoffs with precision, and ultimately architect more robust and secure collaborative workflows and sharing capabilities within applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Glossary
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Permissions&lt;/strong&gt; establish and reason about the rules and logic that govern permissible actions, defining the boundaries of what can and cannot be done under specific conditions and contexts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization&lt;/strong&gt; is the process of answering questions about permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Permissions systems&lt;/strong&gt; construct a mechanism for defining, storing, and evaluating permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization services&lt;/strong&gt; provide a layer of abstraction on top of permission systems that provide answers to an end consumer, such as an application.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Permissions Management with the Privacy Files Podcast</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Wed, 21 Feb 2024 10:02:46 +0000</pubDate>
      <link>https://dev.to/authzd/permissions-management-with-the-privacy-files-podcast-302b</link>
      <guid>https://dev.to/authzd/permissions-management-with-the-privacy-files-podcast-302b</guid>
      <description>&lt;p&gt;Jake joined The Privacy Files podcast, where he discussed the world of permissions and access control. Throughout the episode, listeners are treated to an in-depth exploration of the evolution of permissions management technologies, underscoring the essential role of advanced access control systems in ensuring digital privacy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to Permissions and Access Control in Airports
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Rich shares observations from airports on controlled access and permissions.&lt;/li&gt;
&lt;li&gt;Examples include security at drop-off/pickup points, boarding pass requirements for gate access, TSA regulations on liquid amounts, and restricted areas for authorized personnel.&lt;/li&gt;
&lt;li&gt;Access to airport lounges requires a special pass, indicating controlled entry based on permissions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Introduction to Permissions Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Jake focuses on permissions management technology.&lt;/li&gt;
&lt;li&gt;Discussion on the importance of not hand-rolling security, especially permissions management, due to the high risk of introducing vulnerabilities.&lt;/li&gt;
&lt;li&gt;Permissions management is critical yet challenging, and it's advisable to rely on experts in the field.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Importance and Challenges of Permissions Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Jake emphasizes the shift towards outsourcing non-core competencies, including permissions management, similar to cloud adoption.&lt;/li&gt;
&lt;li&gt;Permissions management examples include bank account access rights and Google Docs permissions.&lt;/li&gt;
&lt;li&gt;The conversation touches on the significance of permissions in ensuring privacy and control over one's data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Jake's Background and Interest in Permissions Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Jake's experiences at Amazon and Google influenced his interest in building large services focused on the developer experience.&lt;/li&gt;
&lt;li&gt;The origin of AuthZed was inspired by challenges faced in managing permissions in previous ventures, highlighting the need for a specialized solution in permissions management.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Common Pitfalls in Developing Permissions Code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Jake discusses the dangers of developing custom permissions code, including security vulnerabilities and scalability issues.&lt;/li&gt;
&lt;li&gt;Broken access control is highlighted as a top security vulnerability, underscoring the importance of expertly managed permissions systems.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Transitioning to AuthZed and the Concept of Cloud-Native
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Jake's journey from IBM to founding AuthZed, driven by entrepreneurial spirit and the desire to address permissions management challenges.&lt;/li&gt;
&lt;li&gt;Explanation of cloud-native versus cloud-based applications, focusing on security responsibilities and innovations in cloud services.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  SpiceDB and AuthZed's Mission
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AuthZed aims to provide a comprehensive solution for permissions management inspired by Google's Zanzibar paper.&lt;/li&gt;
&lt;li&gt;SpiceDB, as an open-source implementation of Zanzibar, represents AuthZed's contribution to simplifying permissions management for companies.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Challenges in Selling Infrastructure to Enterprises
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Discusses the challenges of capturing attention and convincing enterprises of the need for specialized permissions management solutions.&lt;/li&gt;
&lt;li&gt;The trend towards proactive engagement with permissions management solutions, rather than reactive responses to breaches.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Real-World Implications of Permissions Mismanagement
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Examples of permissions-related breaches and the silent nature of some breaches pose significant risks to both companies and individuals.&lt;/li&gt;
&lt;li&gt;The evolving landscape of permissions management and the increasing recognition of its importance in corporate security and compliance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Personal Insights and Advice on Privacy and Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Jake shares personal experiences and the impact of working in the permissions management space on his privacy consciousness.&lt;/li&gt;
&lt;li&gt;Advice for individuals on enhancing their digital privacy and security, emphasizing the importance of being selective and cautious with data sharing.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Authentication vs. Authorization</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Wed, 10 Jan 2024 10:04:18 +0000</pubDate>
      <link>https://dev.to/authzed/authentication-vs-authorization-k29</link>
      <guid>https://dev.to/authzed/authentication-vs-authorization-k29</guid>
      <description>&lt;h3&gt;
  
  
  Authz and Authn, a primer
&lt;/h3&gt;

&lt;p&gt;As humans, we’ve been guarding our stuff since we first invented locks 6,000 years ago.&lt;/p&gt;

&lt;p&gt;Guarding assets and sharing access to them is human nature. There are two major steps involved in this process: authentication and authorization. First, one must authenticate that they are who they say they are. Then, once someone’s credentials verify their identity, the next question is whether or not that individual is allowed access to the asset.&lt;/p&gt;

&lt;p&gt;Think of it this way:&lt;/p&gt;

&lt;p&gt;You want to go on a trip to another country. You need a passport to verify that you are who you say you are - this is an example of authentication. You also need a visa that gives you permission to enter the other country. This is an example of authorization. The same principles can be applied in computing:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fbanner-dialog-04.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fbanner-dialog-04.png" title="Example of user authentication and authorization when interacting with app" alt="Example of user authentication and authorization when interacting with app" width="800" height="1484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Authorization and authentication get confused OFTEN - I mean, look at how similar the words are! Instead of having the perspective of authentication vs. authorization, let’s understand how they work together. As you’ll see, you can’t have one without the other.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fbanner-text-01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fbanner-text-01.png" title="Great Authentication + Great Authorization = Solid Security " alt="Great Authentication + Great Authorization = Solid Security" width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Authentication
&lt;/h3&gt;

&lt;h4&gt;
  
  
  What is Authentication?
&lt;/h4&gt;

&lt;p&gt;Authentication, in computing, involves verifying the identity of a user, process, or machine. To authenticate a user, we can use one or a combination of three key factors: Knowledge: Something a person knows – i.e. a password/username, a passcode or PIN, or a security question Ownership: Physical token or something a person owns – i.e. a Yubikey, hardware capable of an encrypted handshake (like ACME for Apple devices), or Google Authenticator Inherence: A vital piece of something a user is or does – i.e. biometrics or keystrokes&lt;/p&gt;

&lt;p&gt;Whenever you sign into social media, your email, or any Web-based application, you are using authentication to prove you are who you say you are.&lt;/p&gt;

&lt;h4&gt;
  
  
  The History of Authentication
&lt;/h4&gt;

&lt;p&gt;Authentication has been a part of our world since the dawn of time, but that is another conversation for another day. For now, let’s dive into the history of authentication in modern computing.&lt;/p&gt;

&lt;p&gt;Authentication started all the way back in the 1960’s (60 years ago!) with the first passwords in databases. From there it moved to passwords with a hash, and eventually, encryption. Modern encryption has been around since the 1970’s with RSA asymmetric encryption.&lt;/p&gt;

&lt;h5&gt;
  
  
  T﻿imeline
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fhistory-of-authentication-computing-1-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fhistory-of-authentication-computing-1-.png" title="Timeline of Authentication milestones" alt="Timeline of Authentication milestones" width="800" height="3000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;[Timeline is based on an excellent piece - “&lt;a href="https://www.geekwire.com/2018/digital-authentication-human-beings-history-trust/" rel="noopener noreferrer"&gt;Digital authentication: The past, present and uncertain future of the keys to online identity&lt;/a&gt;” on GeekWire, with a few new additions by the authors]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We don’t know where authentication will go in the future but as technology continues to advance, the ability to identify an individual user will get more complicated. This rings true for all Web applications and services, but even more so for highly secure or zero trust environments such as government platforms and healthcare data. Authentication is the passport to our digital world.&lt;/p&gt;

&lt;h3&gt;
  
  
  Authorization
&lt;/h3&gt;

&lt;p&gt;If authentication is our passport, authorization is our visa. Authorization is when one entity grants permission to another entity to engage with a resource within a set of boundaries. Authorization has become increasingly difficult for application developers, often causing performance issues when deployed at scale and blocking feature development.&lt;/p&gt;

&lt;p&gt;As our digital footprint has grown, experts have developed new access control and permissions management models to meet the needs of feature hungry teams. Since the advent of the original Access Control List Model (ACL) in the 1960s – similar to an “invite only” guest list – we have designed increasingly abstract authorization systems.&lt;/p&gt;

&lt;h5&gt;
  
  
  T﻿imeline
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fhistory-of-authorization-computing.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fhistory-of-authorization-computing.png" title="Timeline of Authorization milestones" alt="Timeline of Authorization milestones" width="800" height="1999"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Moving forward, interest will likely trend toward dynamic, context-aware systems that can adjust permissions in real time. The exploration of decentralized models for authorization that integrates concepts from ReBAC and systems like Zanzibar suggests a future with more secure, efficient, and flexible access control mechanisms.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fauthentication-vs-authorization-table.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fauthzed.com%2Fimages%2Fupload%2Fauthentication-vs-authorization-table.png" title="Authentication vs Authorization comparison" alt="Authentication vs Authorization comparison" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As technology develops, so will both authentication and authorization. We at AuthZed are excited to be on the forefront of the authorization space, bringing Google’s Zanzibar to the masses with SpiceDB.&lt;/p&gt;

&lt;p&gt;You can &lt;a href="//play.authzed.com"&gt;try out a schema here&lt;/a&gt; and get started with fine-grained access control across all of your environments and applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Zed File #Z-4902: Spanner Spikes</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Thu, 07 Dec 2023 20:32:33 +0000</pubDate>
      <link>https://dev.to/authzd/zed-file-z-4902-spanner-spikes-e4i</link>
      <guid>https://dev.to/authzd/zed-file-z-4902-spanner-spikes-e4i</guid>
      <description>&lt;h1&gt;
  
  
  Zed File # Z-4902: Spanner Spikes
&lt;/h1&gt;

&lt;p&gt;💼 &lt;strong&gt;Case facts&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Customer: [redacted] // Product: AuthZed Dedicated // Datastore: Spanner&lt;/p&gt;

&lt;p&gt;A storm was brewing at AuthZed customer [redacted]- as their traffic grew, so did the number of permission requests, driving check latencies up to a full second at the 95th percentile. This spike in latency degraded the client system's performance - it was time to call in the experts.&lt;/p&gt;

&lt;p&gt;AuthZed special agents were on the case.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Read on to discover how our agents used AuthZed’s extensive extant observability toolkit and quickly rolled out additional tooling and optimizations to find the solution among a complex myriad of contributing factors.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Bonus - all improvements are now available in SpiceDB v1.28!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First aid&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As an emergency stopgap, AuthZed immediately scaled up resources and tuned Spanner’s configuration, improving overall performance. However, latencies were still spiking every few hours, indicating the system was not yet fully stable. With these initial measures in place, the team started investigating.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dispatch deduplication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agent V knew he had to fist check the customer’s schema - it might reveal complex permissions that could lead to many subproblems being dispatched. With enough capacity, the system should be capable to handle it, but customer’s cluster was relatively small.&lt;/p&gt;

&lt;p&gt;The venerable manual of Agent Operations, the Zanzibar paper, described a clever strategy to reduce fan out of complex permissions: request deduplication. Authzed Agent X introduced improvements in the SpiceDB dispatch with a deduplication middleware that yielded a 30% reduction in dispatched requests, which in turn, led to a proportional reduction in database usage. Despite this notable overall improvement in system performance, persistent latency spikes suggested there still were other underlying issues to address.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tracking consistency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Initial investigation efforts were hindered due to insufficient observability, leaving key data shrouded in mystery. The situation improved when Agent J improved SpiceDB’s request consistency middleware to produce metrics describing the requested consistency level. This tool uncovered a correlation between the latency spikes and increases in ' &lt;code&gt;fully_consistent&lt;/code&gt;' traffic, providing a new lead - one what would crack the case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Schema spotting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pursuing the lead, Agent V knew the team was onto something- they just needed more data. He set to improve the readability of OpenTelemetry traces across the dispatch graph and to expose additional metadata, particularly schema traversal details. Direct tracking of Spanner server-side query latency posed a challenge, as using &lt;code&gt;QueryWithStats&lt;/code&gt; API method increased Spanner’s CPU usage significantly. Undeterred, Agent V successfully integrated Spanner Client metrics with OpenTelemetry and exposed the metrics through SpiceDB’s Prometheus endpoint. And to add the last bit of information missing, Agent V exposed request and response payloads via new CLI flags.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Newly equipped with observability data, the team utilized Google Cloud Platform’s log aggregator to locate the timing and source of the latency spikes. They discovered that [redacted] was intermittently issuing up to 800 CheckPermission calls within milliseconds, overwhelming the processing capacity of the provisioned Spanner units.&lt;/p&gt;

&lt;p&gt;As it turned out, the database simply had insufficient capacity to handle these spikes.&lt;/p&gt;

&lt;p&gt;A crucial log entry showed a single user making over 600 requests within 250 milliseconds for the same permission check, &lt;strong&gt;indicating inefficient ACL filtering that fanned out individual checks too quickly for the allocated capacity, all of which is more efficiently computed with BulkCheck or LookupResources.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AuthZed advised the customer to move from fanout CheckPermission calls to BulkCheck, which led to significant latency reduction and improved cache efficiency. As a result, the SpiceDB cluster has achieved stability, eliminating the problematic latency spikes and enhancing the performance of the Permissions System.&lt;/p&gt;

&lt;p&gt;These improvements are now available to everyone in SpiceDB v1.28!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Policy-Based Access Control (PBAC) vs Relationship-Based Access Control (ReBAC): When You Should Use One or the Other</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Wed, 29 Nov 2023 09:51:37 +0000</pubDate>
      <link>https://dev.to/authzd/policy-based-access-control-pbac-vs-relationship-based-access-control-rebac-when-you-should-use-one-or-the-other-4l63</link>
      <guid>https://dev.to/authzd/policy-based-access-control-pbac-vs-relationship-based-access-control-rebac-when-you-should-use-one-or-the-other-4l63</guid>
      <description>&lt;p&gt;At Authzed, we are building a platform around &lt;a href="https://authzed.com/spicedb"&gt;SpiceDB&lt;/a&gt; - our open-source, Google Zanzibar-inspired authorization service. In the past, we have written about &lt;a href="https://authzed.com/blog/what-is-google-zanzibar"&gt;what Zanzibar is&lt;/a&gt;, &lt;a href="https://authzed.com/blog/authz-primer"&gt;why more businesses are adopting it&lt;/a&gt;, and some of the &lt;a href="https://authzed.com/blog/build-you-a-google-groups"&gt;different&lt;/a&gt; &lt;a href="https://authzed.com/blog/user-defined-roles"&gt;ways&lt;/a&gt; &lt;a href="https://authzed.com/blog/google-cloud-iam-modeling"&gt;you can implement&lt;/a&gt; Relationship-Based Access Control (ReBAC) in your own applications.&lt;/p&gt;

&lt;p&gt;We have even published our own &lt;a href="https://authzed.com/zanzibar"&gt;annotated copy of the Zanzibar whitepaper&lt;/a&gt; - to make it more accessible, add some outside perspective, and to help illuminate the Zanzibar model independent of Google and Google-scale problems.&lt;/p&gt;

&lt;p&gt;But we have not spent much time talking about alternatives to Zanzibar and SpiceDB. Authorization is a field with a long and storied history, and there are several modern alternatives to Google Zanzibar that come with different trade-offs in terms of performance, deployment topology, and useability.&lt;/p&gt;

&lt;p&gt;Understanding where &lt;a href="https://authzed.com/spicedb"&gt;SpiceDB&lt;/a&gt; fits in the landscape of authorization is important for anyone evaluating different solutions for authorization.&lt;/p&gt;

&lt;p&gt;In this post we are going to focus on one specific class of modern authorization technologies: Policy-Based Access Control (PBAC).&lt;/p&gt;

&lt;p&gt;If you're not sure what PBAC is, how it differs from SpiceDB and Google Zanzibar, or when you should use one, the other, or both, then this post is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is policy role-based access control?
&lt;/h2&gt;

&lt;p&gt;A PBAC solution generally has at least two separate components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;em&gt;policy engine&lt;/em&gt;, a software component that takes policy rules and data as input, and produces authorization decisions as output.&lt;/li&gt;
&lt;li&gt;A &lt;em&gt;policy language&lt;/em&gt;, which is often a simple, declarative language for defining authorization rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Typically, these solutions also espouse a philosophy that the policies written in the policy language should be managed using standard software development lifecycle tools and techniques, though the degree to which that happens is up to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kX3bflVg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/source-control-policy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kX3bflVg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/source-control-policy.png" alt="Policy-Based access control (PBAC) diagram visualizing how PBAC works" title="PBAC diagram" width="800" height="651"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Though there are many ways to deploy a policy engine, they are usually deployed in one of three ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Embedded directly into an application&lt;/li&gt;
&lt;li&gt;As a sidecar, serving queries over the local network&lt;/li&gt;
&lt;li&gt;As a reverse proxy or as an authorization step in a proxy, authorizing requests before sending them on to their destination.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some examples of Policy-Based access control systems include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Styra's &lt;a href="https://www.openpolicyagent.org/docs/latest/"&gt;Open Policy Agent&lt;/a&gt; and &lt;a href="https://www.openpolicyagent.org/docs/latest/policy-language/"&gt;Rego Language&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://aws.amazon.com/verified-permissions/"&gt;AWS's Verified Permissions&lt;/a&gt; and the &lt;a href="https://www.cedarpolicy.com/"&gt;Cedar&lt;/a&gt; language&lt;/li&gt;
&lt;li&gt;Hashicorp's &lt;a href="https://www.hashicorp.com/sentinel"&gt;Sentinal framework and language&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Due to its ubiquity, we'll use OPA and Rego in the examples below. If the idea of using policies for authorization is totally new to you, it might be worth checking out what some of these projects have to &lt;a href="https://www.openpolicyagent.org/docs/latest/philosophy/"&gt;say about themselves&lt;/a&gt; before reading on.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the difference between ReBAC and PBAC?
&lt;/h2&gt;

&lt;p&gt;On the surface, ReBAC (Google Zanzibar) and SpiceDB may look very similar to PBAC:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SpiceDB is an &lt;a href="https://github.com/authzed/spicedb"&gt;engine&lt;/a&gt; that computes authorization results over data.&lt;/li&gt;
&lt;li&gt;SpiceDB uses a declarative &lt;a href="https://authzed.com/docs/guides/schema"&gt;schema language&lt;/a&gt; that defines how permission is computed. Many teams choose to manage this schema with standard tools like &lt;code&gt;git&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But there are some major differences in how Zanzibar approaches access that sets it apart.&lt;/p&gt;

&lt;h3&gt;
  
  
  ReBAC is a Database
&lt;/h3&gt;

&lt;p&gt;One of the defining features of Zanzibar is its use of a backing database to store authorization data and an explicit &lt;code&gt;Write&lt;/code&gt; API for storing auth data for Zanzibar to use in later request evaluations.&lt;/p&gt;

&lt;p&gt;At evaluation time, Google Zanzibar makes queries against the data in the database to evaluate authorization requests. This is what puts the "DB" in SpiceDB — in the Zanzibar model, authorization data must be explicitly written into the backing datastore ahead of query time, just like an RDMS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NXtQsy9Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/zanzibar-arch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NXtQsy9Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://authzed.com/images/upload/zanzibar-arch.png" alt="Relationship-based Access Control (ReBAC) diagram visualizing how ReBAC works" title="ReBAC diagram" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ReBAC Stores Relationships
&lt;/h3&gt;

&lt;p&gt;Most PBAC engines put very few restrictions on what authorization data can look like. Rego is a powerful and ergonomic &lt;a href="https://en.wikipedia.org/wiki/Datalog"&gt;datalog&lt;/a&gt; implementation that can be used as a general-purpose tool for computation over a set of facts stored as JSON.&lt;/p&gt;

&lt;p&gt;In Zanzibar, all "facts" are relationship tuples: they define a relationship between a subject (user or group of users) and a resource.&lt;/p&gt;

&lt;p&gt;The schema (or set of namespaces in Zanzibar parlance) defines how these base relationships relate to each other to form a graph.&lt;/p&gt;

&lt;p&gt;A document is in a folder, a role grants access to a group, and a share grants a role access to a folder - these relationships form a graph that allows an application to ask a simple question like "Can Alice access the document?" by following the links in the graph.&lt;/p&gt;

&lt;p&gt;Since &lt;a href="https://matt-rickard.com/everything-is-a-graph"&gt;everything is a graph&lt;/a&gt;, most authorization questions can fit into this model, including RBAC and ABAC.&lt;/p&gt;

&lt;h3&gt;
  
  
  ReBAC Scales
&lt;/h3&gt;

&lt;p&gt;Though policy engines generally require the user to send the data that the policy operates over alongside the authorization request, they sometimes offer other mechanisms for &lt;a href="https://www.openpolicyagent.org/docs/latest/external-data/#option-4-push-data"&gt;syncing relevant data down&lt;/a&gt; periodically, or &lt;a href="https://www.openpolicyagent.org/docs/latest/external-data/#option-5-pull-data-during-evaluation"&gt;pulling data at evaluation time&lt;/a&gt;, which could be used to get a similar approach to data as Zanzibar. And you could certainly choose to store data as relationships in a policy engine.&lt;/p&gt;

&lt;p&gt;If you start to go down this road, though, it's good to be aware of the rest of the Zanzibar design, since it addresses things like &lt;a href="https://authzed.com/blog/prevent-newenemy-cockroachdb"&gt;consistency guarantees&lt;/a&gt;, &lt;a href="https://authzed.com/blog/hotspot-caching-in-google-zanzibar-and-spicedb"&gt;hotspot caching&lt;/a&gt;, and general &lt;a href="https://authzed.com/blog/google-scale-authorization"&gt;scaling strategies&lt;/a&gt; which don't generally have direct or simple answers in a policy engine.&lt;/p&gt;

&lt;h2&gt;
  
  
  When should you use a policy engine?
&lt;/h2&gt;

&lt;p&gt;Policy engines are usually very fast at evaluating policies over small sets of local data. They do this very well, and a lot of time is invested in making the ergonomics developer-friendly.&lt;/p&gt;

&lt;p&gt;Any time all of the data for a policy decision can be statelessly derived from a policy engine, they tend to shine. Here is an example of a &lt;strong&gt;great use of PBAC&lt;/strong&gt; from OPA (&lt;a href="https://play.openpolicyagent.org/p/SIZvQySKQu"&gt;playground&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
rego!&lt;br&gt;
package kubernetes.admission&lt;br&gt;
import future.keywords&lt;br&gt;
deny contains msg if {&lt;br&gt;
    input.request.kind.kind == "Pod"&lt;br&gt;
    some container in input.request.object.spec.containers&lt;br&gt;
    image := container.image&lt;br&gt;
    not startswith(image, "hooli.com/")&lt;br&gt;
    msg := sprintf("image '%s' comes from untrusted registry", [image])&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Note that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The policy is not likely to update very often. A developer might need to add a new untrusted registry maybe once a year, if ever.&lt;/li&gt;
&lt;li&gt;Everything required to evaluate the policy is right there in the API request: &lt;code&gt;request.kind&lt;/code&gt;, &lt;code&gt;input.request.object.spec.containers&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Because this is a Kubernetes example, the policy is likely running with Gatekeeper, which acts as an authorization hook for the kube-apiserver in the cluster. There are no edge deployments that need synchronization.&lt;/li&gt;
&lt;li&gt;The evaluation should be fast - the rules are simple and the data is small.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many of the examples in the &lt;a href="https://play.openpolicyagent.org/"&gt;OPA playground&lt;/a&gt; are similar - they highlight the use of policy engines that are always fast and sensible to manage as code. But there is an entire section of the OPA docs dedicated to external data and the ways it can be &lt;a href="https://www.openpolicyagent.org/docs/v0.55.0/external-data/"&gt;fed into OPA policies for evaluation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Most of these options require a connection to a database, or making networked API calls instead. Once you need to do one of these things, policy evaluation is no longer guaranteed to be fast.&lt;/p&gt;

&lt;p&gt;Generally speaking, in 2023, and regardless of the particular stack, you can expect a local policy evaluation over a small local dataset to be on the order of microseconds. But even then, there can be cases where evaluation takes milliseconds.&lt;/p&gt;

&lt;p&gt;Here's an excerpt from an OPA profile (&lt;a href="https://www.openpolicyagent.org/docs/v0.55.0/policy-performance/"&gt;source&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+----------+-------------+-------------+-------------+-------------+----------+----------+--------------+------------------+
| MIN | MAX | MEAN | 90% | 99% | NUM EVAL | NUM REDO | NUM GEN EXPR | LOCATION |
+----------+-------------+-------------+-------------+-------------+----------+----------+--------------+------------------+
| 43.875µs | 26.135469ms | 11.494512ms | 25.746215ms | 26.135469ms | 1 | 1 | 1 | data.rbac.allow |
+----------+-------------+-------------+-------------+-------------+----------+----------+--------------+------------------+

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A p90 of 25ms means that even when the policy engine has all of the data it needs, it may not beat a network call to a nearby SpiceDB. And the time does not include the time it took to gather the data up to feed into the engine in the first place.&lt;/p&gt;

&lt;p&gt;What follows is an example of an OPA policy that is &lt;strong&gt;not a great use for a policy engine&lt;/strong&gt; (&lt;a href="https://play.openpolicyagent.org/p/QquRnOcLot"&gt;playground&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package kubernetes.validating.ingress
import future.keywords.contains
import future.keywords.if
deny contains msg if {
    input_host := input.request.object.spec.rules[_].host
    some other_ns, other_name
    other_host := data.kubernetes.ingresses[other_ns][other_name].spec.rules[_].host
    [input_ns, input_name] != [other_ns, other_name]
    input_host == other_host
    msg := sprintf("Ingress host conflicts with ingress %v/%v", [other_ns, other_name])
}
input_ns := input.request.object.metadata.namespace
input_name := input.request.object.metadata.name
is_ingress if {
    input.request.kind.kind == "Ingress"
    input.request.kind.group == "extensions"
    input.request.kind.version == "v1beta1"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a more complex policy that ensures that no two &lt;code&gt;Ingress&lt;/code&gt; Kubernetes objects try to bind to the same host name.&lt;/p&gt;

&lt;p&gt;At first glance, it may not be clear what the issue is - it mostly comes down to this line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;other_host := data.kubernetes.ingresses[other_ns][other_name].spec.rules[_].host

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates a list of all hosts referenced by other &lt;code&gt;Ingress&lt;/code&gt; objects. But where did this data come from? It's left as an exercise to the reader, but the full list of all ingress objects needs to be queried first and provided to OPA at evaluation time.&lt;/p&gt;

&lt;p&gt;This approach can work, but it removes the best property of policy engines: authorizing requests is no longer a fast process that runs at the edge, you have to deal with real networks and real databases in your authorization hotpath.&lt;/p&gt;

&lt;p&gt;Once you need external data to answer authorization questions, you might start to wonder if your policy engine is the best tool for the job.&lt;/p&gt;

&lt;h2&gt;
  
  
  You got Policy in ReBAC. You got ReBAC in Policy.
&lt;/h2&gt;

&lt;p&gt;SpiceDB strives to be a faithful Zanzibar implementation, deviating primarily when it seems best for usability or for de-Googling. One thing that we found, though, was that although Zanzibar was great for general authorization, there were often a few cases that users had that didn't lend themselves to relationship data stored ahead of time in SpiceDB.&lt;/p&gt;

&lt;p&gt;This led us to develop &lt;a href="https://authzed.com/blog/abac-on-spicedb-enabling-netflix-complex-identity-types"&gt;Caveats&lt;/a&gt;, which uses CEL to conditionally define whether a relationship exists. Caveats offer some of the benefits of policy engines without sacrificing the benefits of Zanzibar and maintaining its caching and sharding strategies.&lt;/p&gt;

&lt;p&gt;Using Caveats doesn't remove the need for a network roundtrip to SpiceDB. But it does mean you may not need to run a separate policy engine if you're already running SpiceDB, which can simplify your deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do we do at Authzed?
&lt;/h2&gt;

&lt;p&gt;We run a significant amount of infrastructure at Authzed to power our Serverless and Dedicated products. In the end, we use a mix of different approaches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A dedicated SpiceDB instance powers the tenancy layer and permissions for the Authzed Serverless platform.&lt;/li&gt;
&lt;li&gt;Although we don't use projects like Gatekeeper or Kyverno (at the moment), we do use some policy-like features of several Kubernetes projects to enforce standards in the clusters we run.&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://authzed.com/blog/introducing-fine-grained-access-management"&gt;Fine Grained Access Management (FGAM)&lt;/a&gt; feature in SpiceDB Enterprise and &lt;a href="https://authzed.com/products/spicedb-dedicated"&gt;SpiceDB Dedicated&lt;/a&gt; uses a hybrid approach: an embedded SpiceDB instance uses Caveats to evaluate requests at runtime, with no network roundtrips.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether or not you want to use policy-based access control, Zanzibar, or both, depends on the authorization problems you have. Hopefully, this post has helped distinguish when one approach may be better suited than the other.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SpiceDB Tracing: How to interpret our OpenTelemetry traces</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Tue, 21 Nov 2023 14:03:54 +0000</pubDate>
      <link>https://dev.to/authzd/spicedb-tracing-how-to-interpret-our-opentelemetry-traces-p6p</link>
      <guid>https://dev.to/authzd/spicedb-tracing-how-to-interpret-our-opentelemetry-traces-p6p</guid>
      <description>&lt;p&gt;&lt;strong&gt;T﻿ranscription&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is Victor from AuthZed speaking and today we're going to look into some of the recent changes introducing the OTel instrumentation in SpiceDB.&lt;/p&gt;

&lt;p&gt;Before these changes, folks needed a bit of knowledge on the internals of SpiceDB in order to interpret what was happening in requests, right?&lt;/p&gt;

&lt;p&gt;It should be possible to visualize how SpiceDB walks the graph and that represents your schema. So you can better understand the sequence of steps taken to respond to an API request.&lt;/p&gt;

&lt;p&gt;We're going to look into an example CheckPermission request using a simple schema with user and resource and the usual "view" permission, as you can see here which is granted if either user has a "reader" or "edit" relationship over a resource.&lt;/p&gt;

&lt;p&gt;I have my SpiceDB instance running in the background with a Postgres datastore and I've spun up an instance of Jaeger, a popular distributed tracing service, and I've also just issued a check request with SpiceDB companion CLI tool, Zed. Let's have a look at the trace.&lt;/p&gt;

&lt;p&gt;As you all probably know SpiceDB has a tunable consistency model which allows clients to decide the levels of consistency of their request.&lt;/p&gt;

&lt;p&gt;By default, Zed uses minimize_latency which offers a good compromise between performance and security with a bounded staleness of up to five seconds maximum by default.&lt;/p&gt;

&lt;p&gt;OptimizedRevision, ayou can see here at the top, is what indicates that minimized latency has been used as the server computes and a snapshot of the system and then SpiceDB validates the request parameters and making sure that it adheres to the schema that is currently in the system. As you can see in these two checks on the name spaces or the definitions on your schema.&lt;/p&gt;

&lt;p&gt;Here's where the interesting bits start- this is at the first dispatch or we usually refer as sub problems being computed and we've issued a "view" over a specific resource for a user and so this is the first dispatch, this is the first sub-problem being computed.&lt;/p&gt;

&lt;p&gt;This subproblem then SpiceDB determines that is composed of two parts or two sub problems: the "reader" side and the "edit" side. In turn, SpiceDB is going to turn these two guys into a new dispatch.&lt;/p&gt;

&lt;p&gt;This is happening in one single instance so it's not actually dispatching to a different physical node, but for all intents and purposes, it should be the same. Here we can see then the subproblems of the first "view" permission check being computed.&lt;/p&gt;

&lt;p&gt;We have "reader" on one side and then "edit" on the other side and the plus sign indicating this is a union. A "view" is a permission is granted to a user of resource over a resource if either they have "reader" or "edit" relationships.&lt;/p&gt;

&lt;p&gt;When this is dispatched, then SpiceDB determines that this is a terminal or indicates that this is a relationship and the only thing it has to do is to actually query the database.&lt;/p&gt;

&lt;p&gt;As you can see here it accesses the QueryRelationships datastore API and then issues a query "select." You can see details here of the actual SQL query issued to the Postgres database in case you're interested to know what's happening under the hood.&lt;/p&gt;

&lt;p&gt;This is the new structure of the Otel traces that were introduced in SpiceDB 1.27.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What you need to know about Permissions Management</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Thu, 09 Nov 2023 10:50:03 +0000</pubDate>
      <link>https://dev.to/authzd/what-you-need-to-know-about-permissions-management-102b</link>
      <guid>https://dev.to/authzd/what-you-need-to-know-about-permissions-management-102b</guid>
      <description>&lt;h3&gt;
  
  
  What you will learn
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;1. The problem with permissions management, especially RBAC&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;RBAC examples and challenges&lt;/li&gt;
&lt;li&gt;How companies start permissions management&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2.&lt;/strong&gt; Authorization models applied by companies
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Custom code Permissions Management: example, pros and cons&lt;/li&gt;
&lt;li&gt;Policy-based Permissions Management: example, pros and cons&lt;/li&gt;
&lt;li&gt;Google Zanzibar: example, pros and cons&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;3.&lt;/strong&gt; Google Zanzibar open-source implementations:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;SpiceDB, Google Zanzibar’s most mature open source implementation&lt;/li&gt;
&lt;li&gt;Google Zanzibar vs Ory Kratos vs Hydra vs Oathkeeper&lt;/li&gt;
&lt;li&gt;How does SpiceDB stack against Google Zanzibar?&lt;/li&gt;
&lt;li&gt;Scalability and Compatibility in Permissions Management&lt;/li&gt;
&lt;li&gt;Open FGA vs SpiceDB&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;4.&lt;/strong&gt; How to choose your permissions management system
&lt;/h4&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Transcript&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I'm Jake Moshenko, CEO of a company called AuthZed, and AuthZed is an authorization company. &lt;/p&gt;

&lt;p&gt;So, why should you listen to me? Why do I even know anything about this topic? First of all, as I already mentioned, I'm a co-founder and CEO of an authorization company. In the past, I also founded a company called Dev Table, and one of the things that came out of that company was something that we created called Quay. Quay was the first private Docker registry before Docker Hub allowed you to store private images. Quay was acquired by CoreOS. Then at CoreOS, I was head of engineering for that same division. &lt;/p&gt;

&lt;p&gt;Eventually, CoreOS was acquired by Red Hat. At Red Hat, I worked as a senior manager in the service delivery organization. You can think of that as like platform engineering and SRE all wrapped up into one. And prior to that, I also have some experience at some companies you've probably heard of like Google and Amazon. But outside of that CV, the real reason that you should listen to me is because I've actually lived the problem that I'm going to be talking about today. &lt;/p&gt;

&lt;p&gt;Through my work at CoreOS, through my work at Quay, and even in the past at Google and Amazon, I've experienced this problem firsthand. So in today's talk, I'm going to talk about the problem that I'm referring to, a little bit about the solution space, and what some people are doing in this area.&lt;/p&gt;

&lt;p&gt;I'll talk about ReBAC, and how Google Zanzibar is one example of ReBAC. ReBAC stands for Relationship-Based Access Control. I'll talk about some of the pros and cons of the different authorization approaches that we'll discuss in the solution space, and then I'll explain why we're all in on the Zanzibar model, which is what Google is doing internally.&lt;/p&gt;

&lt;p&gt;To frame the problem, I've got here two graphical representations of permissions models, and I'm encouraging you to think about what these models have in common. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---SttbXkl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/Q8Invg1yiL9R0IgCiWzSWxOND17YDJl7mMRZgPExsMhK7nepu6hGoCIxjKpHKgk317g9RiC9NtqvZhTfkonvnttmkaiD_L37KhRxfqLW9cRmWGnFO4mcXg6WzP-_33i6W1wl1nI2A_FxZTEfzWAZKTY" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---SttbXkl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/Q8Invg1yiL9R0IgCiWzSWxOND17YDJl7mMRZgPExsMhK7nepu6hGoCIxjKpHKgk317g9RiC9NtqvZhTfkonvnttmkaiD_L37KhRxfqLW9cRmWGnFO4mcXg6WzP-_33i6W1wl1nI2A_FxZTEfzWAZKTY" alt="Image describing two RBAC examples" title="RBAC example" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the left side, we have what I call a straightforward RBAC system where user Suzy is an editor of document one. And then on the right, we've got this much more convoluted, much more interesting graph where user Suzy has a role within the context of an org, a role has dynamic grants based on what you're trying to do and the object types you're trying to do it to.&lt;/p&gt;

&lt;p&gt;What do these models have in common? Well, they're both called RBAC. One of the challenges in the space of authorization is that everybody has different definitions of what these different acronyms stand for, not necessarily for what they mean in practice. And maybe you've heard other authorization terms like ABAC, so there's all kinds of work done around defining the problem and sort of giving it names in the space, but we often don't start here.&lt;/p&gt;

&lt;p&gt;So companies will often start very simply when they're imagining their authorization or they're deploying their first authorization system for their application. Most of the time, they start by building their own. This could be as simple as storing a few pieces of data in a database, loading that up, and then interpreting it in code. At some point, that stops working. That point could soon or it could be very far in the future- but at some point, it stops working.&lt;/p&gt;

&lt;p&gt;Maybe it stops working because you have too much traffic now. So the system was built to work for 100 queries per second, and now you're at a thousand or 10,000 queries per second. Or it was built to support 10 users, and now you have a thousand or 10,000 or a million users. So scale can be one of the reasons.&lt;/p&gt;

&lt;p&gt;Another reason it stops working is that customers themselves start requesting things that you didn't anticipate. An example of this would be the model on the right in the past slide. I'll give an example of that from my past as well.&lt;/p&gt;

&lt;p&gt;Another time it might fail is if you start entering new geographies, and the underlying data store that you're building this on top of is not a distributed data store. So imagine you built a permission system, it works super well, and everything is headquartered out of Amazon US East, and now you need to expand into Frankfurt or somewhere in APAC. If you need a single unified view of permissions data, often the homegrown solution won't follow you on that journey.&lt;/p&gt;

&lt;p&gt;Now I want to talk a little bit about my lived experience developing permissions for Quay at CoreOS. This was the very first permissions model that we built when we created and launched Quay. We thought we were copying the GitHub model, I'll put it that way. &lt;/p&gt;

&lt;p&gt;In general, everything was centered around the concept of a repository. A repository is where you store your container images, and then users could have various relationships to a repository. So a user could be a reader of the repository, a writer of the repository, or an admin. And then if you see the arrows pointing to the right between the different roles, those are saying that when you're considering who is a reader, you should also consider all writers as readers, and you should consider all admins as writers and therefore also readers. So if someone just has admin, we don't want to prevent them from reading the repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xBla6hpA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/VyxWiDFUFxP63x6U2RnldtF13sUdr5zOACCpTT-hlRMpZ0vuWqGE2KhvkYJdDTV4HCGivPBWbN-NNcuUUvWllBGUEhXMSfA4Fsf0ZO1CBUdIyCFVZjh_JrnqExWcMKl8Ik-UH3QsvicfllmNp17_em8" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xBla6hpA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/VyxWiDFUFxP63x6U2RnldtF13sUdr5zOACCpTT-hlRMpZ0vuWqGE2KhvkYJdDTV4HCGivPBWbN-NNcuUUvWllBGUEhXMSfA4Fsf0ZO1CBUdIyCFVZjh_JrnqExWcMKl8Ik-UH3QsvicfllmNp17_em8" alt="Image describing an example of GitHub's permission system" title="GitHub's permission system" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So this was actually what we shipped with. Within a week, everyone said, "It's great that you copied GitHub's permission system, or you think you did, but we also need all of the nifty organizational support that GitHub offers in their permission system." &lt;/p&gt;

&lt;p&gt;So within a month, we built and shipped this much more complicated system. Everything that's new, I have there in red. And what we had to do is we had to build some concept of organizations. We had to nest repositories under organizations. Organizations had teams, teams had roles within an organization, and then teams could be directly given access to any of the other roles that a repository already had. So that's what that graph is meant to represent. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tSi0zIxs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/eNVoqidhJyDy-9sh2TX_9P8rOyIIMREhuiIAi1hL3M8KoYo1aOf6TaYJ37G1nXkXKpz2hl6yaZbdqE3R7DIM6D911iDa_8f4NMi7yidVxJyTvsvhfrJhqMJqq4tn1w-XXvToAs7IfTKa047orYIGg6g" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tSi0zIxs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/eNVoqidhJyDy-9sh2TX_9P8rOyIIMREhuiIAi1hL3M8KoYo1aOf6TaYJ37G1nXkXKpz2hl6yaZbdqE3R7DIM6D911iDa_8f4NMi7yidVxJyTvsvhfrJhqMJqq4tn1w-XXvToAs7IfTKa047orYIGg6g" alt="A more complicated version of GitHub's permission system" title="GitHub's permission management image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The real takeaway here is that it was a lot more complicated than we initially anticipated. We built and launched that, and the users who asked for it were happy for a little while. But what we failed to realize is that not even GitHub nailed it, and what the users wanted was the ability to have multiple namespaces under an organization. &lt;/p&gt;

&lt;p&gt;Imagine you're like me and you used to work at Red Hat, and Red Hat had different business units, or maybe even Red Hat itself is a business unit of IBM now. They wanted to be able to nest namespaces and they wanted to be able to nest teams. They wanted to be able to break down and model teams according to the org chart, and they wanted to be able to nest repositories under a top-level parent company/business unit/eam/repository. And they wanted to be able to hang permissions off of any of those various places in this tree that they wanted to build up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BRxmFtH_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/XvNiXPfkYSDMYlPpBnRPBhb1KL-zgFD5ndItT1I__bt3tPh0zNY44nkIRa9qrZWR-5kpufcwOqHJjm-SLdM8BfKYbT5TrPz2Fpgpjr5xYzfYdss7NoggiDowiNeja4vB61HoqMXajSGRQLvxxOP-HRA" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BRxmFtH_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/XvNiXPfkYSDMYlPpBnRPBhb1KL-zgFD5ndItT1I__bt3tPh0zNY44nkIRa9qrZWR-5kpufcwOqHJjm-SLdM8BfKYbT5TrPz2Fpgpjr5xYzfYdss7NoggiDowiNeja4vB61HoqMXajSGRQLvxxOP-HRA" alt="Image of what type of permissions management that users wanted" title="Permissions management image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, if you had a top-level organization, maybe the admin for it was some superuser in the operations department, the COO at the organization. And then as you started to descend through the tree, the permissions would become more fine-grained and more granular and be federated out on a team-by-team or a person-by-person basis.&lt;/p&gt;

&lt;p&gt;We never actually built and shipped this version of the authorization model. And the reason that we didn't do that is because we were somewhat naive in our early implementation. &lt;/p&gt;

&lt;p&gt;We did our authorization, probably similar to how many of you are doing, by storing data in a database and then doing a bunch of SQL joins to figure out what you have access to. At the time, we were built on top of MySQL. MySQL didn't support recursive CTEs, so we couldn't do a recursive query to jump through, to walk through and gather up these permissions as we descended or ascended through the namespace tree or through the team hierarchy. &lt;/p&gt;

&lt;p&gt;We were never actually able to ship this feature. It was one of those things that was always on the backlog, something that we knew we needed to do, but it was going to require a major refactoring of the way we were doing authorization. That's the problem, as we see it, in a nutshell. &lt;/p&gt;

&lt;p&gt;And now let's step into some of the ways that companies are currently authorizing things. The most common thing that we see by far is that companies are using embedded custom authorization code in their applications. They're just writing some code to interpret some data, they're doing it directly in their codebase, and then they're making authorization decisions based on that.&lt;/p&gt;

&lt;p&gt;If people have decided that this is a bad idea, sometimes they'll adopt a policy engine, and I'll talk a little bit about that as well. And then finally, the new paradigm or the new kid on the block is the Zanzibar paradigm that Google put forward.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b2w6DMoc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/DLrh7KpWIXDbbbTL8mvr6I8ltfaSzTJ9FkMFDb06fvcqyKKIv3t2n3W0C8G4g-EGpFeD8TGaazhtEqGwoPPzYxIrGopyHEscxlxEg6kGcbG8AoihourhsOBLyePsB-LiS0Fl2mErJC1i2l0ZsvXOw94" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b2w6DMoc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/DLrh7KpWIXDbbbTL8mvr6I8ltfaSzTJ9FkMFDb06fvcqyKKIv3t2n3W0C8G4g-EGpFeD8TGaazhtEqGwoPPzYxIrGopyHEscxlxEg6kGcbG8AoihourhsOBLyePsB-LiS0Fl2mErJC1i2l0ZsvXOw94" alt="Image of custom code permissions management example" title="Custom code permissions management example" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First up, this is the embedded code in applications. The specifics of the code aren't really important, but what is important is that you can see that we're reaching out to the database every time a user is trying to handle a request for an object. We reach out to the database and we load who are the authorized users for the object, and then we usually have to reach back out to the same database again to get the data to send back to the user. And then we've got a little authorized method there. It's already abstracted out into its function, so it's not like a big if-else block embedded in the code, but it is still something that exists within our monolithic application.&lt;/p&gt;

&lt;p&gt;No judgment if this is how your authorization code looks. Like I said, I've built and launched variations of this in the past, and it works for some scale.&lt;/p&gt;

&lt;p&gt;So when we break down the pros and cons of writing custom code to do authorization, the biggest pro is it's infinitely flexible. You can do and express anything that your heart desires as long as you can figure out how to write the code for it. Another pro for custom code is once you've exceeded the single monolithic application and you start to break down your service into potentially other services or microservices, you can take that authorized method like I had on the last slide, and you can turn it into a shared library. You can share that library and compile that library into other services and other applications.&lt;/p&gt;

&lt;p&gt;But if that code is living within a single service, one of the downsides is that you can't call it from other services. So one thing that we'll often see as a company is going through like a microservices or a service decomposition is that the authorization logic will get tied up into that monolith, and then they'll have to expose methods on for those other microservices to query it about authorization. This is obviously like a huge inversion of priority, right? You don't want microservices to be blocked on calling out to a monolith. This is not the ideal by a long shot.&lt;/p&gt;

&lt;p&gt;Another disadvantage of this method is that if you split this out into a library and you happen to be a polyglot shop, which means you're writing your services in multiple different languages, you need an implementation of the library for all of the different languages that you're potentially implementing in. So for example, if you use JavaScript, and Node.js on the backend, maybe you use some Python, maybe some Java, maybe some Ruby, you need an implementation of that same authorization code for all of those languages. And that can often result in complicated rollouts as well. So if you need to update the authorization code, you need to make sure that you're updating it across all languages and rolling it out to services in such a way that the users are never given an inconsistent view or incorrect answer.&lt;/p&gt;

&lt;p&gt;Another downside of this method is that you're going to your database, your main database, your source of truth, and fetching data on every single request that requires authorization. Not just data, but data specifically about authorization. This can add additional unwanted load to your database. This was something that we ran into for Quay. On Quay, we did those SQL joins as I mentioned, and I think the final version of the code, or the code that you can go see if you look at the open source right now, does a join with like 11 different tables. When we did some analysis, it turned out that we were spending far too much of our database CPU just joining on these same 11 tables over and over again. This could be like a tall tale; maybe every time I say it, the number of tables gets a little bit bigger, but it is open source, you can go check out how that works today.&lt;/p&gt;

&lt;p&gt;And finally, authorization code isn't the kind of code that people like to open up and change all the time because it's tricky code. It's hard to verify that you haven't opened any security holes, and it's just not something that your average application developer is interested in getting down into the nitty-gritty and understanding the nuts and bolts of.&lt;/p&gt;

&lt;p&gt;Moving on to the next solution, we have policy engines. So policy engines were kind of the hot new thing on the block probably about eight or nine years ago. So what about policy engines? Are they good? Are they bad? What do they do?&lt;/p&gt;

&lt;p&gt;Often when people embark on adopting a policy engine, their goal is to abstract their authorization logic from their code, and this is a laudable goal. You can solve a lot of the same problems that we just talked about. You can write your policies in a robust logic language that's formally proven to be correct for a certain class of authorization operations. &lt;/p&gt;

&lt;p&gt;Since it's usually a network request or you're running it in a sidecar, something like that, you can have one implementation of your policies for all languages, and then you just reach out and talk to those policies over the network. This works great when you already have all of the data ready. &lt;/p&gt;

&lt;p&gt;Imagine if you're writing like a network appliance or an HTTP filter or something like that, and the data that you're making your request based on is already available to you in the form of the IP address of the caller or HTTP headers or the current date and the current time. If you already have all of that data that you want to feed to the policy engine, the policy engine can often give you an answer back in microseconds.&lt;/p&gt;

&lt;p&gt;Some of the downsides of using a policy engine, though, are that you still have to fetch data from your main source of truth for every request and feed it to that policy engine. And sometimes you're reading a lot more data than you have to, depending on how you can constrain and how you can draw a boundary around the data that you need to feed to that policy engine. It can also cause a complicated rollout of new policies if you're using the sidecar model and you've baked the policy into the sidecar. &lt;/p&gt;

&lt;p&gt;You need to make sure that you're rolling that out in a consistent way, or at least in a backward-compatible way, such that if two different services are evaluating the policy at two different times, they don't accidentally open up a security flaw in terms of having different data interpreted different ways at different places.&lt;/p&gt;

&lt;p&gt;And finally, these languages that you write policies in are powerful. They're very powerful, and these can result in policies that are difficult to understand and eat up a lot of your budget in terms of latency, and difficult to write and difficult to maintain. &lt;/p&gt;

&lt;p&gt;Just to show an example of one of those, I went to the OPA website and I just pulled a Rego script right off of the landing page. I'm going to give everybody about 30 seconds to read through this Rego script and try to have an idea in mind for what this script is doing or what this policy is doing. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Snbwzb_z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/uI3WmOEpeTAreOT-3DDdPGBFLho_GAMwN1ER5iTPbjc9sPdo4lytjFDC6Wot8QBw8Yu9rBw1cgBBWokRri8l1Z99WX4InYKtrR7WDPCvMEXLn7ebzYgrIuP1F9uLHSdTEKnrdvIAUCjTPRv0Ko_hdoE" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Snbwzb_z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/uI3WmOEpeTAreOT-3DDdPGBFLho_GAMwN1ER5iTPbjc9sPdo4lytjFDC6Wot8QBw8Yu9rBw1cgBBWokRri8l1Z99WX4InYKtrR7WDPCvMEXLn7ebzYgrIuP1F9uLHSdTEKnrdvIAUCjTPRv0Ko_hdoE" alt="Image of policy-based permissions management example" title="Policy-based permissions management example" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I look at this policy, I see eligible groups, something about locations, a lot of things about locations. And then we've got some kind of roles construct, and then we've got this block repeated three times which I'm guessing is binding a location to a role record.&lt;/p&gt;

&lt;p&gt;So if you were able to figure it out, maybe you were, maybe you weren't, but what this is doing, is doing a role binding by location and group name. The first thing it does is it verifies that the groups are one of the supported groups, so that's group one and group two. And then it gives three different locations, and the locations have different roles for each group in each location. And then anything that doesn't match one of those locations or one of those groups results in an empty set of roles that you have access to.&lt;/p&gt;

&lt;p&gt;So this table makes a lot of sense to me, but this policy was kind of hard for me to read through and for me to understand what exactly was happening. &lt;/p&gt;

&lt;p&gt;As a result of having policies that are written in this domain-specific policy language, one thing that we're being told by our prospects and by our customers is that when you adopt a system like this, the platform or auth team usually ends up owning all of the policies. &lt;/p&gt;

&lt;p&gt;We talked to a massive organization, and they told us that they were using a version of Prolog or a dialect of Prolog to do their authorization policy, and there was one person in this multi-tens of thousands of person organization who was capable and confident in writing their policies. This is usually kind of an anti-pattern for what we're trying to accomplish by bringing in an authorization policy engine.&lt;/p&gt;

&lt;p&gt;Moving on to the next and final solution in the solution space is Google's Zanzibar. So in 2019, Google wrote a paper called Zanzibar: Google's Consistent Global Authorization System. The core concept of Zanzibar is let's build off on top of a globally distributed database. So internal to Google, there's a globally distributed database called Spanner. It's ACID, it seems to violate the CAP theorem and like the basic laws of physics, but it is a very solid thing on which to build an authorization system that might need to scale and that might be geographically distributed.&lt;/p&gt;

&lt;p&gt;The whole paper is about 12 pages. It's an easy read, and I highly encourage you to go read it. &lt;/p&gt;

&lt;p&gt;I will give an example of what adopting Zanzibar has allowed Google to do.If you've ever been in this case where you're writing an email, and in the email you include a link to a Google Document, and you think everything is great, and you go to hit the send button, and Google pops up a scary warning that says, "Hey, someone that you're trying to send this email to does not have access to the document that you've linked." &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ft8AweZB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/_yWJR4YJc8zh6v0nPMj3HAurYOxs-Px8cvbXZ-_vdjwluR3uV31g4o3KijTJE-WIYI_N3iRDn4r-gIsanYsm3szY5Zb2Akkm_Fcak7cXP4XTnv79DonhgF3h27C0WmAGelagpRzFcyp6ZUXxey8k_QA" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ft8AweZB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/_yWJR4YJc8zh6v0nPMj3HAurYOxs-Px8cvbXZ-_vdjwluR3uV31g4o3KijTJE-WIYI_N3iRDn4r-gIsanYsm3szY5Zb2Akkm_Fcak7cXP4XTnv79DonhgF3h27C0WmAGelagpRzFcyp6ZUXxey8k_QA" alt="Image of Google Permissions Management in practice" title="Google Permissions Management in practice" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is this magic? How does this work? How does Gmail possibly know what access my email recipient has to a document that I've merely linked?&lt;/p&gt;

&lt;p&gt;The answer is that they use Google Zanzibar as a centralized authorization service for everything at Google. And Gmail is able to ask questions about permissions that exist ostensibly within the doc service.&lt;/p&gt;

&lt;p&gt;A high-level overview of Google Zanzibar: it's a single authorization service for all of Google I mentioned. It deals primarily with storing relationships as edges in a directed graph, which is what I referred to earlier as ReBAC or Relationship-Based Access Control. Then they give their engineers a schema to interpret those relationships. So we're decoupling the relationships themselves from how they're interpreted to make authorization decisions.&lt;/p&gt;

&lt;p&gt;The Google team spends about half the paper talking about performance, and it's throwing up some really impressive numbers. At Google, Zanzibar is doing 10 million queries per second at peak, and this is as of 2019, I'm sure it's grown since then. These are just the numbers in the paper. They're storing trillions of relationships, and they have a 95th percentile check query latency of 10 milliseconds. &lt;/p&gt;

&lt;p&gt;If you know anything about writing applications that are human-facing, usually you want to keep those interactions under about 100 milliseconds. So 10 milliseconds isn't chewing up a lot of your budget in terms of latency. and maybe most impressively for this being a centralized service they've managed to keep 99.999% uptime, so five nines of uptime for this service which is super important for an authorization service which is usually in the line of fire for every request.&lt;/p&gt;

&lt;p&gt;So, in an attempt to make this more concrete, and I hope I'm successful here, here's an example of using relationship-based Access Control to control policy decisions. I don't have access to a DSL if Google has one internally, but what I can show is how you express these things in our own Oso's DB schema language.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S_BR2FA1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/QJINT-jvs5Gex7tNO65RNxNGl1RMB_vq7JnGK_14rd1DgTugQrPuHT5Ge_LPb6-7VIQxbPzsnPAjpVRHkB2iwknJXVcxUoc4vam1JBgUyynQ-rqiT9HbYs6tOmv4TiiwKJaZxOfMKOkgbheX--iquiQ" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S_BR2FA1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/QJINT-jvs5Gex7tNO65RNxNGl1RMB_vq7JnGK_14rd1DgTugQrPuHT5Ge_LPb6-7VIQxbPzsnPAjpVRHkB2iwknJXVcxUoc4vam1JBgUyynQ-rqiT9HbYs6tOmv4TiiwKJaZxOfMKOkgbheX--iquiQ" alt="An image with Google Zanzibar's relationship-based access control (ReBAC) example" title="Google Zanzibar example" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have three different object types: users, organizations, and documents. And within those object types, we have relationships, those are in the red boxes or relations. So we can say that a user can be an owner of a document, a user can be a reader of a document, and a user can be an administrator of an organization. And then I only really have one document-level permission modeled here, but you could imagine read, write, view, delete, and many different permissions. &lt;/p&gt;

&lt;p&gt;But the way we're expressing this permission is we're saying in order to be able to view a document, you need to either be a reader of the document, you need to be an owner of the document, or you need to be an administrator or have the admin permission on the organization that the document belongs to.&lt;/p&gt;

&lt;p&gt;I don't know about you, but for me, this seems a straightforward way to express this kind of authorization logic. But then to try to make it more visual, I have a graphical representation of that same policy on the right-hand side. We can see, that I tried to color coordinate it so that you can see relations and how they relate between users and documents and organizations. And then the interesting one is there's the dotted line that connects view to admin, and so that's just showing you that you sometimes need to traverse the graph, and go through different objects to be able to make the decision that you need to make. In this case, we're considering what a user's role is in the organization to decide whether they have access to the document.&lt;/p&gt;

&lt;p&gt;And then down at the bottom, I just have some example relationships. So these relationships are the way to read this is that user Sean has reader permissions on document some document, user Fred has reader on the same document, user Jill has owner on the same document. So we're setting up edges in a directed graph where we're relating a subject, which is often a user, back to a resource which in this case is either a document or an organization. And then you'll also see that we explicitly bind the organization and the document together with this relationship down on the bottom of the relationship grid.&lt;/p&gt;

&lt;p&gt;By combining these relationships and the policy which allows us to interpret them, we can express in a natural way very, very complicated authorization schemes.&lt;/p&gt;

&lt;p&gt;So Google Zanzibar, what is it good for? I've already mentioned that it's very scalable with traffic, with requirements, and also across geographies because it's built on top of a distributed database. It's very flexible. So within relationship-based Access Control, you can model multiple other authorization paradigms, for example, ABAC, which is attribute-based access control, or RBAC, role-based access control. Facebook wrote a paper about how you can model all of ABAC in RBAC.&lt;/p&gt;

&lt;p&gt;You also get a single view of permissions for all services. So this is how Google is accomplishing that thing that I showed earlier where Gmail can understand access that only sensibly exists in the document service.&lt;/p&gt;

&lt;p&gt;One of the super powerful things you can do when you have a system based on a graph like this is you do reverse index questions, for example, what can this user access, right? So if user Jake is talking to my web app, what documents can Jake see? If you think about how you would implement that in your own code or a policy engine, you can see how that would be pretty technically complicated.&lt;/p&gt;

&lt;p&gt;Finally, it gives you a natural way to express permissions as long as the permissions that you're trying to express are dealing with relationships between people and other people, or people and data, or data and other data.&lt;/p&gt;

&lt;p&gt;One of the downsides to adopting something like Zanzibar is that it's hard to do with data that's only available at request time. So for example, if your permission decision needs to take into account the IP address of the calling user, you don't have the IP address to store as a relationship ahead of time, so you can't use that in a graph walk or a graph traversal. &lt;/p&gt;

&lt;p&gt;We do have a solution to that that I'll get to in a little bit, but in stock Zanzibar, in core Zanzibar that they write about in the paper, that's difficult. And then finally, it's just yet another distributed system to run. So if authorization is very important to you and a very critical piece of your business, then you'll run that distributed system. But often you might say, well, you know, I'm kind of up to my ears already in distributed systems, so I don't want to bring this in as well.&lt;/p&gt;

&lt;p&gt;If you're interested in learning more about Zanzibar, I gave a &lt;a href="https://authzed.com/blog/what-is-google-zanzibar"&gt;full 60-minute talk&lt;/a&gt; just about the paper and the various sections of the paper for New York City's "Paper We Love" Meetup. There's a QR code there, but it's highly technical, and I break down all of the different distributed systems techniques that Zanzibar uses to get the performance and the uptime that we talked about a little bit earlier.&lt;/p&gt;

&lt;p&gt;I'm an advocate of choosing the right tool for the right job. There's that phrase where if all you have is a hammer, everything looks like a nail. We don't just have hammers in authorization; we have other things. But just thinking about what the various things might be good for, I mentioned earlier that network-level or HTTP-level filtering because you have all of the data at request time is maybe a really good fit for a policy engine. And if you have to do a comparison of values, right, so if you're trying to say like is the content or the contents of this shopping cart greater than $100 and taking that into account when you do your permissions checks, that might also be more suited for a policy engine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wiUIpK11--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/tl8jNQuyWp5wKOjXtZyjLBMvggyJTexqDv3FbL6zYGN0zKuAXpzKXBbCa1xjSl7oU9AITuPBj6vLMpUYM5OcSVEH0Y5B9u3md26hGZFGr9tL6TSKY3WRkTj8BAAfFU6iC9-Z3GguZRHYY9ENDoiK0bc" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wiUIpK11--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/tl8jNQuyWp5wKOjXtZyjLBMvggyJTexqDv3FbL6zYGN0zKuAXpzKXBbCa1xjSl7oU9AITuPBj6vLMpUYM5OcSVEH0Y5B9u3md26hGZFGr9tL6TSKY3WRkTj8BAAfFU6iC9-Z3GguZRHYY9ENDoiK0bc" alt="Image with a Permissions management comparison" title="Permissions Management comparison: Policy engines vs Google Zanzibar" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But where does Google Zanzibar shine? &lt;/p&gt;

&lt;p&gt;Google Zanzibar shines when you're doing traditional role-based access control because you're able to associate the user with those roles and then interpret those roles all in a single place. It's great for RBAC with user-defined roles, so if you want to give your customers or your users control of what those things mean, you can do that with Google Zanzibar as well. We have an example of that in our playground.&lt;/p&gt;

&lt;p&gt;If you want a single consistent view of permissions everywhere, Google Zanzibar is great for this, right? It's a network service, it's centralized, it has all of the data ahead of time, and it's great at being able to do that. Finally, if you need to feed billions or trillions of facts or relationships to your policy solution to make a decision, that's difficult to do with a policy engine. So if you try to check out what the research is on scaling Datalog to billions or trillions of facts, you'll find that this is actually cutting-edge Datalog stuff and isn't supported everywhere.&lt;/p&gt;

&lt;p&gt;And then on the Zanzibar side, do have a little yellow warning sign there because Google Zanzibar isn't good at those things, but we've built a Google Zanzibar open-source service called SpiceDB, which is everything that the Zanzibar paper talks about plus a little bit more. &lt;/p&gt;

&lt;p&gt;SpiceDB is our open-source love letter to Google Zanzibar. You can find it at &lt;a href="https://authzed.com/spicedb"&gt;Authzed&lt;/a&gt; or &lt;a href="https://github.com/authzed/"&gt;GitHub&lt;/a&gt;. It's fully open-source, it's Apache 2, which is a very liberal license. &lt;/p&gt;

&lt;p&gt;SpiceDB has about 4,000 GitHub stars, and over 3,000 commits, we have 1,500 users on our Discord who are in there talking about authorization software, and we have over 40 contributors from multiple companies across the industry.&lt;/p&gt;

&lt;p&gt;What I've been kind of alluding to is we have a thing called caveats which allows you to attach small bits of policy to individual relationships, and I have an example of that on the next slide.&lt;/p&gt;

&lt;p&gt;We also have a few additional APIs that make it easier to work with this solution, giving you those reverse indexes that I talked about and giving you information about how permissions are changing over time. And we've also got a thoughtful, great schema language that we're constantly being told is sort of industry-leading.&lt;/p&gt;

&lt;p&gt;And we want you to come to contribute, to use it, to do whatever you want to do, but just get involved in SpiceDB and the whole Google Zanzibar movement.&lt;/p&gt;

&lt;p&gt;As promised, I have an example of caveats. So in this example, we just have a permission system where we're trying to decide who can unlock a car. In this case, the owner of the car can always unlock it, but the cleaner of the car might only be able to unlock it on certain weekdays. And then we have a single relationship where we say that user Jake, in this case, I'm the cleaner of the car, is only allowed to be the cleaner on Sundays. And then the car, the specific car that we're talking about in this case, is the Toyota Camry. I don't know why I picked that, I just did. So then we can see that as we're traversing this graph, we'll take into account what day of the week it's being called on. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--laEXLRVW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/4L2buvlOTkYA5qdABv1D2teO5Pdhw1VuJLss5bpji6UKBOLVOf3muNDWkvz6V9pIcs3qxpJXmAjWvAYzzW1neEsdJlxX6Pcok_JpkqBsiz_ETPmdqL4zQ-kRBNdjb5mE3InWdtk0GZEXlU65YMI6jQA" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--laEXLRVW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh7-us.googleusercontent.com/4L2buvlOTkYA5qdABv1D2teO5Pdhw1VuJLss5bpji6UKBOLVOf3muNDWkvz6V9pIcs3qxpJXmAjWvAYzzW1neEsdJlxX6Pcok_JpkqBsiz_ETPmdqL4zQ-kRBNdjb5mE3InWdtk0GZEXlU65YMI6jQA" alt="An image of SpiceDB policy-based permissions management" title="SpiceDB policty-based permissions management" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is really how we can fuse at scale. I can't talk about all of them because some of them are still in stealth mode or they haven't publicly disclosed that they're using us, but we have a few that are on our website under case studies. In terms of the metrics, we're very proud of our performance. We've done a lot of performance testing. We're not quite at the five nines that Google talks about with Zanzibar, but we're very, very close. And in terms of latency, we're often faster than what Google reports for Zanzibar, which we're very proud of.&lt;/p&gt;

&lt;p&gt;We've also done a lot of work to make sure that SpiceDB is very operable, so it's very easy to run, it's very easy to scale. We have a lot of documentation about how to do that. And we're also very responsive on Discord if you run into any issues.&lt;/p&gt;

&lt;p&gt;So, I think that's all the time I have. Thank you so much for your questions. If you have more questions, please come to &lt;a href="https://discord.com/invite/jTysUaxXzM"&gt;Discord&lt;/a&gt;, please come to &lt;a href="https://github.com/authzed/"&gt;GitHub&lt;/a&gt;, file an issue, or start a discussion. We're very, very active in the community, and we're always looking to help. So, thank you so much.&lt;/p&gt;

&lt;h3&gt;
  
  
  Related reading:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://authzed.com/blog/what-is-google-zanzibar"&gt;Understanding Google Zanzibar: A Comprehensive Overview &lt;/a&gt;
&lt;/h4&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://authzed.com/zanzibar"&gt;Google Zanzibar’s annotated paper&lt;/a&gt;
&lt;/h4&gt;

</description>
    </item>
    <item>
      <title>Zed Tokens, Zookies, Consistency for Authorization</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Wed, 18 Oct 2023 13:35:59 +0000</pubDate>
      <link>https://dev.to/authzd/zed-tokens-zookies-consistency-for-authorization-1lle</link>
      <guid>https://dev.to/authzd/zed-tokens-zookies-consistency-for-authorization-1lle</guid>
      <description>&lt;h2&gt;
  
  
  Secure authorization logic requires data consistency
&lt;/h2&gt;

&lt;p&gt;If you've ever taken a course on databases or dove head-first into documentation, you may have bumped into the acronym "ACID". ACID describes the guarantees that are expected in order to effectively rely on a database system: atomicity, consistency, isolation, and durability. While it's rumored that the term "consistency" was fabricated in order to complete a catchy acronym, its colloquial usage by the software industry is no joke.&lt;/p&gt;

&lt;p&gt;Taking a stroll across the Internet, one finds that many definitions of consistency are self-referential; they define consistency using the term "consistent". While one could attempt to define the term in a dense mathematical way, I'll leave that to Wikipedia. When most folks are referencing consistency, I find that they are trying to suss out the invariants that need to be preserved when their data is observed. This contract is largely driven by the problem and domain of the software being built and thus requires careful consideration.&lt;/p&gt;

&lt;p&gt;The process of designing well-architected software often begins with determining the contracts and scope of the system. While the previous statement seems uncontroversial, I've seen time and time again that there is a critical component whose contract is often an afterthought: authorization systems.&lt;/p&gt;

&lt;p&gt;Unless the domain is sensitive or regulated (e.g. healthcare), consideration of the design and requirements for access control is an exercise saved until a project has found product-market fit. By this time in the product's development, new functionality is assumed to be features that extend the existing foundation rather than something that entails its own end-to-end design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Google's journey building authorization
&lt;/h2&gt;

&lt;p&gt;When faced with the challenge of building access control for their products, the team at Google recognized what many had not: they needed to do their due diligence and design a system that considered the consistency model used for authorization data.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Handling end-user access controls for distributed objects can be complex. The access controls must be handled &lt;strong&gt;consistently&lt;/strong&gt; across all systems. This can be relatively straightforward if access is fixed at creation time (e.g. "this email may be read only by the recipient"). But if the ACL (access control list) can be updated, things get difficult quickly.&lt;/p&gt;

&lt;p&gt;[..]&lt;/p&gt;

&lt;p&gt;To solve this problem, we developed Zanzibar. Zanzibar has a central, highly-replicated, highly-available, and &lt;strong&gt;consistent&lt;/strong&gt; ACL store."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;cite&gt;Lea Kissner, co-author &lt;a href="/blog/what-is-google-zanzibar"&gt;Google's Zanzibar authorization system&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Kissner and their co-authors have done the world a favor by &lt;a href="https://authzed.com/zanzibar"&gt;publishing&lt;/a&gt; the observed results of their design. The paper focuses on various aspects of the design, but explicitly chooses to focus on &lt;a href="https://authzed.com/zanzibar#2.2-consistency-model"&gt;detailing the consistency model&lt;/a&gt;. The paper even goes so far as to give a name to a scenario that commonly plagues inconsistent authorization systems: &lt;a href="https://authzed.com/blog/new-enemies"&gt;The New Enemy Problem&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SpiceDB is the successor to Google Zanzibar
&lt;/h2&gt;

&lt;p&gt;Fast-forward to today: an open source community is flourishing around &lt;a href="https://github.com/authzed/spicedb"&gt;SpiceDB&lt;/a&gt;, a re-imagining of Google's Zanzibar system that is not only faithful to the paper, but also inclusive in its design for those building software outside of a tech giant like Google.&lt;/p&gt;

&lt;p&gt;SpiceDB is designed to start from a strongly consistent posture while providing users a way to relax overzealous consistency requirements in order to unlock higher performance.&lt;a href="https://authzed.com/docs/reference/zedtokens-and-zookies"&gt;Zed Tokens&lt;/a&gt;, SpiceDB's analogue to the Zookie concept in Zanzibar, are a vital part of solving the New Enemy Problem. Zed Tokens are an encoded value that represents a particular point in time in SpiceDB. Requests to SpiceDB can optionally specify expected consistency when querying authorization data by providing Zed Tokens for when they need to query at or after a particular time (in addition to allowing the server to pick a time or specifying the most recent time in the system).&lt;/p&gt;

&lt;p&gt;The most important benefit of designing for ad hoc consistency is that adopters can be confident that when they require strong consistency for a particular problem, they won't have to accept silent data corruption or re-architect their systems. SpiceDB is not the only system that takes this approach to consistency; the core databases powering Azure and AWS services, CosmosDB and DynamoDB respectively, also allow for this ad-hoc consistency model. And just as the cloud revolution moved the industry forward by democratizing elastic infrastructure, SpiceDB is now moving the industry toward a more secure way to build access control into our applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A Primer on Modern Enterprise Authorization (AuthZ) Systems</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Wed, 06 Sep 2023 15:37:08 +0000</pubDate>
      <link>https://dev.to/authzed/a-primer-on-modern-enterprise-authorization-authz-systems-4cf2</link>
      <guid>https://dev.to/authzed/a-primer-on-modern-enterprise-authorization-authz-systems-4cf2</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A business operating complex software environments needs to provide end-user experiences that enable and delight users, but never at the cost of a poor security stance. In 2022, a lapse in security fetched &lt;a href="https://www.ibm.com/reports/data-breach" rel="noopener noreferrer"&gt;on average 9.44M for a data breach in the US, and $4.35M globally according to IBM&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This post aims to help companies with their authorization decisions and systems and share what we see in the market through conversations with companies looking to solve their authorization challenges, specifically authorization that impacts end-user interaction with their products. I’ll cover how authorization became an issue for most companies, the different approaches, an introduction to Google Zanzibar–the solution the market is converging on, the prominent use cases driving businesses to adopt this new approach, and what you can expect when moving to a relationship-based access control system (ReBAC).&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is AuthZ?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Because the Internet is, by definition, a networked system that connects users, most Internet-facing software is designed with a multi-user experience in mind. These environments require constructs to facilitate a natural experience that protects users’ data: &lt;strong&gt;authentication&lt;/strong&gt; , commonly referred to as authN, is the key that verifies an application-specific identity, typically called a user, and &lt;strong&gt;authorization&lt;/strong&gt; , commonly referred to as authZ, dictates what doors that key can open for a user.&lt;/p&gt;

&lt;p&gt;AuthZ plays a pivotal role in software security by ensuring that users have the appropriate level of access to different resources and functionalities within a system. At its core, authZ involves granting or denying access rights to specific resources or actions based on the identity and privileges of the user. It is crucial in preventing unauthorized access and verifying that only authorized users can perform specific actions within a system. It serves as a gatekeeper that protects sensitive data and functionalities. By implementing robust authorization mechanisms, developers can control the level of access granted to different users or roles, thereby safeguarding the system from potential security breaches.&lt;/p&gt;

&lt;p&gt;Collectively in the context of a product’s end users, authN and authZ are called Customer Identity and Access Management (CIAM). Authorization is such a foundational part of the digital experience that its underlying design principles have become &lt;a href="https://99percentinvisible.org/about/the-show/" rel="noopener noreferrer"&gt;99% invisible&lt;/a&gt;, even to developers, leading to fundamental challenges as a business scales.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why AuthZ is an Issue&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A company typically starts by aggregating all user requests into a single piece of software that tightly couples application logic with authZ. As the company’s product gains traction and its user base grows, the focus shifts to distributing the software and scaling infrastructure components, often ignoring a much-needed change to the authorization system. This further embeds an authorization construct not meant to handle a growing number of requirements.&lt;/p&gt;

&lt;p&gt;From the business perspective, the two key limitations of a legacy authorization system are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Permissions are inflexible&lt;/strong&gt; : There isn’t a way to easily add additional constructs like &lt;a href="https://authzed.com/blog/user-defined-roles" rel="noopener noreferrer"&gt;user-defined roles&lt;/a&gt;, recursive relationships, &lt;a href="https://authzed.com/blog/abac-on-spicedb-enabling-netflix-complex-identity-types" rel="noopener noreferrer"&gt;attribute-based access control (ABAC)&lt;/a&gt;, or &lt;a href="https://authzed.com/blog/how-small-is-too-small" rel="noopener noreferrer"&gt;fine-grained authorization (FGA)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Siloed permissions:&lt;/strong&gt; as a company grows, it scales revenue by offering additional products; application teams then build bespoke authorization implementations that are hard to reason about and don’t consider a holistic user experience, especially at large scale.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Google set out to fix this problem, along with several “&lt;a href="https://zanzibar.tech/2AT-rbOOg7:R:1h" rel="noopener noreferrer"&gt;unique challenges involving data consistency and scalability&lt;/a&gt;.”&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Google’s Solution to Authorization: Google Zanzibar&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The confluence of business requirements driving the adoption of &lt;a href="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-207.pdf" rel="noopener noreferrer"&gt;zero-trust architectures&lt;/a&gt; and &lt;a href="https://qonsent.com/static/pdf/qonsent-consumer-insights-june2022.pdf" rel="noopener noreferrer"&gt;94% of consumers wanting more control of their data&lt;/a&gt; in near real-time galvanized the search for a modern authorization system. Google’s response was a modern approach that can scale with your business and maintain strict security requirements, now known as &lt;a href="https://authzed.com/blog/what-is-google-zanzibar" rel="noopener noreferrer"&gt;Google Zanzibar&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Among the requirements set forth by the Google Zanzibar team is “&lt;a href="https://zanzibar.tech/2MUghfOn_Y:A:1n" rel="noopener noreferrer"&gt;support for a rich set of access control policies as required by both consumer and enterprise applications&lt;/a&gt;” and “&lt;a href="https://zanzibar.tech/2I7pd_DGm2:2C.49Q9UoJW_:J" rel="noopener noreferrer"&gt;establish consistent semantics and user [developer] experience across applications&lt;/a&gt;.” Zanzibar powers authorization across hundreds of Google Products, including Google Calendar, Cloud, Drive, Maps, Photos, and YouTube. Notably, it unlocks unique experiences like &lt;a href="https://zanzibar.tech/2Ry8nS2U5I:0:1t" rel="noopener noreferrer"&gt;cross-product authorization checks,&lt;/a&gt; e.g., Slack’s Gmail extension can check if a recipient has access to a Google Doc, unlocking growth through reduced friction points while maintaining user privacy.&lt;/p&gt;

&lt;p&gt;Google Zanzibar is a relationship-based access control system (ReBAC), meaning that permissions are derived from the existence of a relationship between digital objects and users. This has positive performance implications, especially for recursive permissions, but, importantly, it’s a natural extension of sharing in the real world, which makes it intuitive for most developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use-Cases Driving Adoption of Google Zanzibar
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Product-Led Growth&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To share something is a user choice and subsequent action. Companies we’re speaking with have learned that facilitating frictionless sharing can help onboard additional users to their platforms. For instance, a hiring platform we’re working with implements fine-grained authorization (FGA) so enterprise recruiters are comfortable exposing permissions to hiring managers related to the positions the managers are looking to fill. Hiring managers, in turn, can proactively engage with candidates and increase activity on the platform.&lt;/p&gt;

&lt;p&gt;Another example is adding capabilities that foster more in-app experiences. For instance, a sharing economy company is boosting engagement with its platform by bringing resource management for users into their native applications instead of relying on third-party applications. Most companies we speak with share similar product-led growth initiatives built atop robust authorization.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Breaking into the Enterprise&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Enhancing security and compliance is a key requirement for B2B companies looking to scale revenue within an enterprise market segment, and OWASP’s 2021 report cites &lt;a href="https://owasp.org/Top10/A01_2021-Broken_Access_Control/" rel="noopener noreferrer"&gt;broken access control&lt;/a&gt; as a top security concern. One of the main risks is “exposure of sensitive information to an unauthorized actor,” which is a core tenet of the Google Zanzibar paper; the system "&lt;a href="https://zanzibar.tech/22_E1zFxjc:0.4BawKBUjM:1K" rel="noopener noreferrer"&gt;must ensure consistency of access control decisions to respect user intentions.&lt;/a&gt;”&lt;/p&gt;

&lt;p&gt;Enterprise users also require increased flexibility; these manifest as the following requirements for product teams:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fine-grained authorization (FGA):&lt;/strong&gt; the ability to control resources down to a granular level, e.g., a page in a document, though there is a balance, see &lt;a href="https://authzed.com/blog/how-small-is-too-small" rel="noopener noreferrer"&gt;How small is too small?&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User-defined Roles and Permissions:&lt;/strong&gt; beyond a typical application-defined Role-Based Access Control (RBAC) system, product teams need to allow end-user admins to create roles and associated permissions for delegating to internal teams.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recursive relationships:&lt;/strong&gt; at a certain scale, teams start owning teams. This is challenging for a traditional authorization system dealing with permissions stored in a relational database alongside application data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attributes-Based Access Control (ABAC):&lt;/strong&gt; support for dynamic time-bound or otherwise caveated access.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What to Expect When Adopting Relationship-Based Access Control (ReBAC)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A crucial part of ReBAC systems like Google Zanzibar and our own &lt;a href="https://authzed.com/products/spicedb" rel="noopener noreferrer"&gt;Zanzibar-inspired authorization system, SpiceDB,&lt;/a&gt; is storing permissions data in a separate database; product-specific data (e.g. content of a social media post) is stored in the application database, while the data that drives who can edit that data live in the permissions database. If you have an existing authorization flow, you’ll have to translate that data into permissions data.&lt;/p&gt;

&lt;p&gt;Modeling data is probably the most fun and intuitive part. SpiceDB, like other solutions, has a domain-specific language (DSL) called the &lt;a href="https://authzed.com/docs/reference/schema-lang" rel="noopener noreferrer"&gt;SpiceDB Schema Language&lt;/a&gt; for defining the objects you want to create an authorization system for. The permissions schema defines the objects, e.g., users and documents, how they relate to each other, and the permissions those relationships define.&lt;/p&gt;

&lt;p&gt;Since you’re writing permissions data, integration is a big part of the journey. A ReBAC authorization system is delivered over a gRPC or HTTP API; SpiceDB has libraries available in multiple languages to help developers get up to speed quickly. You’ll want to make sure whatever solution you choose delivers a solid developer experience.&lt;/p&gt;

&lt;p&gt;Google Zanzibar doesn’t mention policy, but we’ve learned through our collaboration building &lt;a href="https://authzed.com/blog/abac-on-spicedb-enabling-netflix-complex-identity-types" rel="noopener noreferrer"&gt;Attribute-Based Access Control (ABAC) for Netflix&lt;/a&gt; that pairing policy with ReBAC is a powerful paradigm. An example of this capability is SpiceDB Caveats: &lt;a href="https://authzed.com/blog/caveats" rel="noopener noreferrer"&gt;Caveats: A Scalable Solution for Policy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A common practice is to organize a core team of developers tasked with architecting and executing an overhaul to your authorization system. The effort must be cross-functional; you’ll want platform engineers, application engineers, and product managers to work together to ensure smooth adoption.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;p&gt;Given how popular Google's approach to authorization has become, there are a number of new companies and projects looking to provide Zanzibar-aaS. At AuthZed, we've created a faithful open-source implementation of Google Zanzibar called &lt;a href="https://github.com/authzed/spicedb" rel="noopener noreferrer"&gt;SpiceDB&lt;/a&gt;, and offer managed commercial offerings that make it easy to get into production. Join the community on &lt;a href="https://authzed.com/discord" rel="noopener noreferrer"&gt;Discord&lt;/a&gt; or &lt;a href="https://authzed.com/call" rel="noopener noreferrer"&gt;schedule a call&lt;/a&gt; to learn more!&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Reading
&lt;/h2&gt;

&lt;p&gt;If you’re interested in learning more about Authorization and Google Zanzibar, we recommend reading the following posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://authzed.com/blog/what-is-google-zanzibar" rel="noopener noreferrer"&gt;Understanding Google Zanzibar: A Comprehensive Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://authzed.com/blog/fine-grained-access-control" rel="noopener noreferrer"&gt;Fine-Grained Access Control: Can You Go Too Fine?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://authzed.com/blog/exploring-rebac" rel="noopener noreferrer"&gt;Relationship Based Access Control (ReBAC): Using Graphs to Power your Authorization System&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://authzed.com/blog/pitfalls-of-jwt-authorization" rel="noopener noreferrer"&gt;Pitfalls of JWT Authorization&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Authorization Must Scale</title>
      <dc:creator>AuthZed</dc:creator>
      <pubDate>Mon, 17 Jul 2023 12:05:53 +0000</pubDate>
      <link>https://dev.to/authzd/authorization-must-scale-1idj</link>
      <guid>https://dev.to/authzd/authorization-must-scale-1idj</guid>
      <description>&lt;p&gt;As someone working at a YC startup, we are constantly reminded of Paul Graham’s classic advice "do things that don't scale". While we take this advice to heart for operating our business, we deliberately ignore it for the development of SpiceDB, the open source foundation of our company's products. Developing software is expensive, so why wouldn't you want to follow this advice? As it turns out, scalability is a requirement for authorization systems. There really hadn't been designs for scalable authorization solutions until Google published a paper documenting their internal system, Zanzibar. The Zanzibar paper is dense and includes many details that often cause the reader to miss the forest for the trees, but at its core it describes a system that scales. Rightfully, this breakthrough has gotten a lot of people excited—some of us are excited enough that we quit our jobs and started open source projects and a company 😉.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your MVP's authorization doesn't scale and that's okay
&lt;/h2&gt;

&lt;p&gt;Experienced software developers and entrepreneurs have probably raised an eyebrow: before making anything scale, you must first test your assumptions by building the minimum viable product. I wholeheartedly agree. I'm not going to sit here and try to sell you software complexity if your MVP can prove its viability with limited authorization functionality; MVPs are about building as little as possible to validate your idea. There are a few industries (e.g. healthcare, finance) that require complex access models on day one, but many MVPs need very little to serve their initial users. As long as there's technology, balancing complexity will always be the name of the game.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaling isn't exclusively a measure of traffic
&lt;/h2&gt;

&lt;p&gt;It's easy to forget that organizations scale on various dimensions. While scale has become almost synonymous with software handling user traffic, it's more likely that you will experience the need to scale in one or more of the other dimensions first. Here's the typical order in which we see some dimensions of scale crop up in organizations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Feature Development: amount of feature requests you can satisfy&lt;/li&gt;
&lt;li&gt;Development Velocity: the speed at which teams can deliver complex features&lt;/li&gt;
&lt;li&gt;Geographies: the localities of users you can serve&lt;/li&gt;
&lt;li&gt;Traffic: the number of users you can serve&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When the feature requests start coming in, that's the ideal time to consider your foundation for authorization. You might be tempted to extend your MVP authorization logic to add support for the new requirement, but doing so means setting yourself up an endless loop where implementing the next feature first requires refactoring security-critical authorization code to support it.&lt;/p&gt;

&lt;p&gt;While building SpiceDB, we've interviewed thousands of software developers across industries. What we've concluded is that developers are struggling to keep their head above water when implementing anything beyond the basics of authorization. For the few that have gotten past the basics, they never have the time and focus needed to build tooling around their solution that empowers developers with the confidence to iterate on their designs.&lt;/p&gt;

&lt;p&gt;The downstream effect of what we've observed is that most teams are limited in their ability to scale in all dimensions. Eventually this pain builds up until a breaking point has been met. At best, a new authorization system must be built and all feature development is paused while each individual product integrates with this new system. But the question is, who will build the new solution and how will you know it has any chance of being an improvement over the previous?&lt;/p&gt;

&lt;h2&gt;
  
  
  Friends don't let friends build authorization
&lt;/h2&gt;

&lt;p&gt;Despite being a pillar of computer science with research beginning equally as early as other topics like database systems, authorization experts in the industry are an order of magnitude more rare to employ than database experts. Today, the developer zeitgeist acknowledges that it'd be foolish in most cases to implement your own database for an application, but has yet to internalize that this is equally if not more true for authorization systems. Meta and Google can afford to staff a team of experts to build an authorization platform for their product teams to consume, but pretty much everyone else cannot.&lt;/p&gt;

&lt;h2&gt;
  
  
  SpiceDB: the community for scalable authorization
&lt;/h2&gt;

&lt;p&gt;Because there are so few authorization experts and everyone needs scalable authorization, it can only make sense to share expertise. The beauty of open source is that it's not only a great venue for sharing code, but also knowledge. That's why we created SpiceDB and are continuously investing in the community around it. By fostering an ecosystem that connects the folks solving everyday problems with the experts, we can build secure systems that scale with our needs. For real time discussion, you can join us on &lt;a href="https://authzed.com/discord"&gt;Discord&lt;/a&gt; or those that prefer asynchronous communication can ask questions and raise topics on &lt;a href="http://github.com/authzed/spicedb/issues"&gt;SpiceDB's GitHub issue tracker&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://authzed.com/blog/what-is-google-zanzibar"&gt;What is Google Zanzibar?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://authzed.com/zanzibar"&gt;Google's Zanzibar White Paper, Annotated by AuthZed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://authzed.com/products/spicedb-dedicated?utm_source=blog&amp;amp;utm_medium=website"&gt;SpiceDB Dedicated&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
