<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>AuthZ on Robin&#39;s notebook</title>
    <link>https://notes.robinvanhove.me/tags/authz/</link>
    <description>Recent content in AuthZ on Robin&#39;s notebook</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language><atom:link href="https://notes.robinvanhove.me/tags/authz/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Fine-Grained Authorization (FGA)</title>
      <link>https://notes.robinvanhove.me/notes/fga/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://notes.robinvanhove.me/notes/fga/</guid>
      <description>&lt;p&gt;Broken Object Level Authorization is the number one in OWASP&amp;rsquo;s API security
top 10.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;APIs tend to expose endpoints that handle object identifiers, creating a wide
attack surface of Object Level Access Control issues. Object level
authorization checks should be considered in every function that accesses a
data source using an ID from the user.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;what-is-authorization&#34;&gt;What is Authorization?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Decide&lt;/strong&gt; if an action can be taken.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can Alice view document #123?&lt;/li&gt;
&lt;li&gt;Can Alice view document #123 at 16:30 on Tuesday, 11 June, 2024?&lt;/li&gt;
&lt;li&gt;Can Bob edit document #123 in China?&lt;/li&gt;
&lt;li&gt;Can Bob edit document #123 in China, when authenticated with MFA?&lt;/li&gt;
&lt;li&gt;Can a manager create document #456&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We can always identify the following:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Broken Object Level Authorization is the number one in OWASP&rsquo;s API security
top 10.</p>
<blockquote>
<p>APIs tend to expose endpoints that handle object identifiers, creating a wide
attack surface of Object Level Access Control issues. Object level
authorization checks should be considered in every function that accesses a
data source using an ID from the user.</p>
</blockquote>
<h2 id="what-is-authorization">What is Authorization?</h2>
<p><strong>Decide</strong> if an action can be taken.</p>
<ul>
<li>Can Alice view document #123?</li>
<li>Can Alice view document #123 at 16:30 on Tuesday, 11 June, 2024?</li>
<li>Can Bob edit document #123 in China?</li>
<li>Can Bob edit document #123 in China, when authenticated with MFA?</li>
<li>Can a manager create document #456</li>
</ul>
<p>We can always identify the following:</p>
<ul>
<li><strong>Subject</strong>, the user or thing trying to take an action
<ul>
<li>Type &amp; identifier
<ul>
<li>E.g. <code>user:Alice</code>, <code>application:123</code></li>
</ul>
</li>
<li>Or properties of the subject
<ul>
<li>E.g. <code>manager</code></li>
</ul>
</li>
</ul>
</li>
<li><strong>Action</strong>, the thing the subject is trying to do
<ul>
<li>E.g. <code>view</code>, <code>edit</code></li>
</ul>
</li>
<li><strong>Resource</strong>, the target of the action
<ul>
<li>Type &amp; identifier</li>
<li>E.g. <code>document:#123</code></li>
</ul>
</li>
<li><strong>Context</strong>, any additional information that can influence the decision.
<ul>
<li>E.g. time, location, authentication method.</li>
</ul>
</li>
</ul>
<p>Additionally we often want to <strong>search</strong> based on the authorization decisions.
A search is essentially a decision with one or more free variables.</p>
<ul>
<li>Which documents can Alice view?</li>
<li>Who can view document 123?</li>
<li>What actions can Alice perform on document 123 on Tuesday, June 11, 2024?</li>
</ul>
<h2 id="access-control-models">Access control models</h2>
<p>Access control models can be separated by their specificity.</p>
<h3 id="coarse-grained-access-control-models">Coarse-grained access control models</h3>
<p><strong>Role-based access control</strong> (RBAC), is the most common access control model.
A subject is assigned to a role and depending on their role the application
decides whether to allow access.</p>
<p>Coarse grained access control models such as RBAC are easy to implement.</p>
<p>It might look like they are easy to manage but in practice group, entitlements
and roles become a mess.</p>
<h3 id="fine-grained-access-context-models">Fine-grained access context models</h3>
<p>Often this is implemented by mapping specific actions on resources to
<strong>entitlements</strong> (arbitrary strings) and combining those in a <strong>role</strong> and
assigning those to a <strong>group</strong> of subjects.</p>
<p><strong>Relationship-based access control</strong> (ReBAC) looks at the relation of
resources and subjects. Essentially it looks at the <strong>graph</strong> of resources and
subjects to decides whether an action is allowed.</p>
<p>
  <img loading="lazy" src="https://cdn.sanity.io/images/4gqsq44z/production/f1c0fdaab8e232d83156f2987513f079c4b648cf-1600x1000.png" alt="ReBAC"  />
<em>From: <a href="https://docs.aserto.com/docs/authorization-basics/authorization-models/rebac">https://docs.aserto.com/docs/authorization-basics/authorization-models/rebac</a></em></p>
<p><strong>Attribute-based access control</strong> (ABAC), compares attributes assigned to a
subject and resource to decide if an action is allowed.</p>
<p><strong>Policy-based access control</strong> (PBAC), the most generic model. A policy can be
any evaluation of any computer program. Often specific domain specific
languages are used to describe the policy.</p>
<h3 id="hybrid-models">Hybrid models</h3>
<p>Coarse-grained and fine-grained can be combined. For example an API gateway or
application proxy can check if a user is allowed to access a service using RBAC
but the service can use a more fine-grained model such as ReBAC to check if
specific actions are allowed on a resource.</p>
<p>This approach can improve performance and provide better (mutli-layered)
security.</p>
<h3 id="googles-zanzibar">Google&rsquo;s Zanzibar</h3>
<blockquote>
<p>Determining whether online users are authorized to access digital objects is
central to preserving privacy. This paper presents the design,
implementation, and deployment of Zanzibar, a global system for storing and
evaluating access control lists. Zanzibar provides a uniform data model and
configuration language for expressing a wide range of access control policies
from hundreds of client services at Google, including Calendar, Cloud, Drive,
Maps, Photos, and YouTube. Its authorization decisions respect causal
ordering of user actions and thus provide external consistency amid changes
to access control lists and object contents. Zanzibar scales to trillions of
access control lists and millions of authorization requests per second to
support services used by billions of people. It has maintained
95th-percentile latency of less than 10 milliseconds and availability of
greater than 99.999% over 3 years of production use.</p>
</blockquote>
<p><a href="https://research.google/pubs/zanzibar-googles-consistent-global-authorization-system/">https://research.google/pubs/zanzibar-googles-consistent-global-authorization-system/</a></p>
<h2 id="authorization-policies">Authorization Policies</h2>
<p>These describe the rules. From <a href="https://csrc.nist.gov/pubs/sp/800/162/upd2/final">Nist&rsquo;s guide to ABAC</a>:</p>
<blockquote>
<p><strong>Natural Language Policy</strong> (NLP): Statements governing management and access
of enterprise objects. NLPs are human expressions that can be translated to
machine-enforceable access control policies.</p>
</blockquote>
<blockquote>
<p><strong>Digital Policy</strong> (DP): Access control rules that compile directly into
machine executable codes or signals. Subject/object attributes, operations,
and environment conditions are the fundamental elements of DP, the building
blocks of DP rules, which are enforced by an access control mechanism.</p>
</blockquote>
<blockquote>
<p><strong>Metapolicy</strong> (MP): A policy about policies, or policy for managing
policies, such as assignment of priorities and resolution of conflicts
between DPs or other MPs.</p>
</blockquote>
<p>Digital policies are the real software implementation of the policy. These are
often described using A DCL XACML, ALFA, Rego, Oso Polar.</p>
<p>A policy evaluation <strong>engine</strong> takes the authorization policy, and the
authorization request and outputs a decision.</p>
<h3 id="digital-policy-example-with-rego">Digital Policy example with Rego</h3>
<p>Rego is currently the most popular and open language for to define policies, it
was developed for the OPA policy engine and is based on the datalog programming language.</p>
<p>Rego is a <strong>declerative</strong> programming language, made for writing authorization policies.</p>
<p>The following is an example from the <a href="https://play.openpolicyagent.org/">Rego playground</a>.</p>
<p><strong>Policy:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-Rego" data-lang="Rego"><span style="display:flex;"><span><span style="color:#66d9ef">package</span> <span style="color:#a6e22e">app</span><span style="color:#f92672">.</span><span style="color:#a6e22e">abac</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">default</span> <span style="color:#a6e22e">allow</span> <span style="color:#f92672">:=</span> <span style="color:#66d9ef">false</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">user_is_owner</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> {
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_employee</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">action_is_read</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> {
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_employee</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_senior</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">action_is_update</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> {
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_customer</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">action_is_read</span>
</span></span><span style="display:flex;"><span>	<span style="color:#66d9ef">not</span> <span style="color:#a6e22e">pet_is_adopted</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_owner <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">title</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;owner&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_employee <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">title</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;employee&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_customer <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">title</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;customer&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_senior <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">tenure</span> <span style="color:#f92672">&gt;</span> <span style="color:#ae81ff">8</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>action_is_read <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">action</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;read&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>action_is_update <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">action</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;update&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>pet_is_adopted <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">pet_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">resource</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">adopted</span> <span style="color:#f92672">==</span> <span style="color:#66d9ef">true</span>
</span></span></code></pre></div><p><strong>Data:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user_attributes&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&#34;alice&#34;</span>: {
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;tenure&#34;</span>: <span style="color:#ae81ff">20</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;title&#34;</span>: <span style="color:#e6db74">&#34;owner&#34;</span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    },
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;pet_attributes&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&#34;dog123&#34;</span>: {
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;adopted&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;age&#34;</span>: <span style="color:#ae81ff">2</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;breed&#34;</span>: <span style="color:#e6db74">&#34;terrier&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;toto&#34;</span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Input:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user&#34;</span>: <span style="color:#e6db74">&#34;alice&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;action&#34;</span>: <span style="color:#e6db74">&#34;read&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;resource&#34;</span>: <span style="color:#e6db74">&#34;dog123&#34;</span>
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Output:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;action_is_read&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;allow&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;pet_is_adopted&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user_is_owner&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user_is_senior&#34;</span>: <span style="color:#66d9ef">true</span>
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h2 id="externalized-authorization-architecture">Externalized Authorization Architecture</h2>
<p>Often the authorization is implemented in the application itself, either
hard-coded or trough configurations. But this approach has shortcomings in
large, distributed and dynamic systems.</p>
<ul>
<li>Policy (interpretation) consistency</li>
<li>Reuse of implementations</li>
<li>Policy administration (version control, deployments)</li>
<li>More difficult to improve performance</li>
</ul>
<p>For these reasons it is often decided to externalize authorization out of the application.</p>
<p>The simplest approach to externalize  authorization is to <strong>centralize</strong> it in
one system. But there are other patterns possible, more on that later.</p>
<p>Defined in
<a href="https://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html">XACML</a>
and  <a href="https://csrc.nist.gov/pubs/sp/800/162/upd2/final">Nist&rsquo;s guide to ABAC</a></p>
<p>
  <img loading="lazy" src="https://upload.wikimedia.org/wikipedia/commons/f/f2/XACML_Architecture_%26_Flow.png" alt="XACML
Architecture"  />
<em>By Axiomatics - Axiomatics, CC BY 3.0,
<a href="https://commons.wikimedia.org/w/index.php?curid=48397652">https://commons.wikimedia.org/w/index.php?curid=48397652</a></em></p>
<p>
  <img loading="lazy" src="https://www.researchgate.net/publication/336538309/figure/fig2/AS:814067111436288@1571100132236/ACML-Standard-Oasis-2010-As-shown-in-the-Fig-3-above-the-major-components-of-XACML.ppm" alt="XACML Dataflow
Diagram"  />
<em>XACML Dataflow Diagram, image from OASIS spec.</em></p>
<h3 id="policy-decision-point-components">Policy Decision point components</h3>
<p>The PDP is shown as one component in the XACML architecture but we can
distinguish multiple subcomponents.</p>
<p><strong>Policy Engine</strong> is the component responsible for actually evaluating the
policy and making a decision.</p>
<p><strong>PDP Interface</strong> or <strong>API</strong> implements how the PEP can send queries to th PDP.
Often based upon HTTP and JSON but gRCP. Every PDP implementation uses a
different kind of (often proprietary API). But there is a process ongoing by
the OpenID foundation to standerize an interface called <strong>AuthZEN</strong>.</p>
<p>The <strong>data plane</strong> is responsible for gathering data form the relevant PIP&rsquo;s.
E.g. user &amp; resource attributes. The data plane can also concern itself with
<strong>caching</strong> and structuring the data in a performant <strong>data structure</strong> such as
a graph for performant policy evaluation.</p>
<p>The data plane can exist completely separate from the PDP (any databse or API
can be used). But many implementations choose to tightly couple the PDP and PIP
for optimal performance.</p>
<p>A <strong>policy control plane</strong> is required to distribute updates to policies the
PDP&rsquo;s as soon as they are changed. The control plane is the glue between the
PAP and PDP. The control plane can also provide information about the
configuration of the data plane, such as the location of the PIP&rsquo;s.</p>
<h3 id="fancy-archtiectural-patterns">Fancy Archtiectural patterns</h3>
<p>
  <img loading="lazy" src="https://i.ibb.co/F45Q7bC/main-numbered.png" alt="OPAL Architecture"  />
<em>OPAL Architecture, from <a href="https://docs.opal.ac/overview/architecture/">https://docs.opal.ac/overview/architecture/</a></em></p>
<ul>
<li>Fully centralized service</li>
<li>Per-tenant</li>
<li>Per application
<ul>
<li>As a library</li>
<li>Sidecar container</li>
</ul>
</li>
</ul>
<h2 id="policy-administration-pap">Policy administration (PAP)</h2>
<p>Many solutions provide powerful interfaces to manage policies.</p>
<p><strong>Policy creation</strong> interface. The digital policy can be written as computer
program using any text editor or IDE. But many implementations provide
interfaces to make it easy to use for less technical people.</p>
<p><strong>Version control</strong> is essential for policy management. Often software VCS such
as git ore often used because most operations are already using it. But
sometimes authorization services implement their own version control, tightly
coupled with the ui of the PAP.</p>
<p><strong>Policy distribution</strong> trough the <strong>control plane</strong>, just like any program the
authorization policies require some form of <strong>continous deployent</strong>, depending
on the chosen architecture this can become very complex, requiring deployment
to multiple PDP&rsquo;s without having downtime.</p>
<p><strong>Testing</strong> should also be considered, the digital policy is a computer program
like any other and there should exist &lsquo;unit&rsquo; test to ensure that the policies
(and any for changes) behave as expected. Issues in a policy can have huge
consequences for the security of the system.</p>
<h2 id="authzen">AuthZEN</h2>
<p>The OpenID foudnation has identified the need for a standardized interface for
authorization, similar to their OpenID connect standard for authentication.</p>
<p><a href="https://openid.github.io/authzen/">https://openid.github.io/authzen/</a></p>
<p>AuthZEN is essentially an API specification standardizing the contract between
PDP and PEP. It contains two API&rsquo;s.</p>
<ul>
<li>Access Evaluation(s) API</li>
<li>Search API</li>
</ul>
<h3 id="access-evaluation-api">Access Evaluation API</h3>
<p><em>Modified example from the AuthZEN draft.</em></p>
<p>The access evaluation API returns the decision as a boolean, but can also provide some context.</p>
<p>An alternative endpoint is also defined that can evaluate multiple decisions in one request.</p>
<p><strong>Request:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#a6e22e">POST</span> /access/v1/evaluation <span style="color:#66d9ef">HTTP</span><span style="color:#f92672">/</span><span style="color:#ae81ff">1.1</span>
</span></span><span style="display:flex;"><span>Host<span style="color:#f92672">:</span> <span style="color:#ae81ff">pdp.example.com</span>
</span></span><span style="display:flex;"><span>Content-Type<span style="color:#f92672">:</span> <span style="color:#ae81ff">application/json</span>
</span></span><span style="display:flex;"><span>Authorization<span style="color:#f92672">:</span> <span style="color:#ae81ff">Bearer &lt;myoauthtoken&gt;</span>
</span></span><span style="display:flex;"><span>X-Request-ID<span style="color:#f92672">:</span> <span style="color:#ae81ff">bfe9eb29-ab87-4ca3-be83-a1d5d8305716</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;subject&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;user&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;alice@example.com&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;resource&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;document&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;1&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;action&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;edit&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;context&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;time&#34;</span>: <span style="color:#e6db74">&#34;1985-10-26T01:22-07:00&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Response:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">HTTP/1.1 OK
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">Content-Type: application/json
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716
</span></span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;decision&#34;</span>: <span style="color:#66d9ef">false</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;context&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;reason&#34;</span>: <span style="color:#e6db74">&#34;Subject is a viewer of the resource&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h3 id="search-api">Search API</h3>
<p><em>Example form the draft.</em></p>
<p>The search API can search for subjects, actions and resources.</p>
<p>It also specifies  <strong>pagination</strong> which is which is essential for scalability.</p>
<p><strong>Request:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#a6e22e">POST</span> /access/v1/search/resource <span style="color:#66d9ef">HTTP</span><span style="color:#f92672">/</span><span style="color:#ae81ff">1.1</span>
</span></span><span style="display:flex;"><span>Host<span style="color:#f92672">:</span> <span style="color:#ae81ff">pdp.example.com</span>
</span></span><span style="display:flex;"><span>Content-Type<span style="color:#f92672">:</span> <span style="color:#ae81ff">application/json</span>
</span></span><span style="display:flex;"><span>Authorization<span style="color:#f92672">:</span> <span style="color:#ae81ff">Bearer &lt;myoauthtoken&gt;</span>
</span></span><span style="display:flex;"><span>X-Request-ID<span style="color:#f92672">:</span> <span style="color:#ae81ff">bfe9eb29-ab87-4ca3-be83-a1d5d8305716</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;subject&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;user&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;alice@example.com&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;action&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;can_read&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;resource&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;account&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Response:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">HTTP/1.1 OK
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">Content-Type: application/json
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716
</span></span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;page&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;next_token&#34;</span>: <span style="color:#e6db74">&#34;a3M9NDU2O3N6PTI=&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;results&#34;</span>: [
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;account&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;123&#34;</span>
</span></span><span style="display:flex;"><span>    },
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;account&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;456&#34;</span>
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  ]
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h3 id="oauth-rich-authorization-requests">OAuth Rich Authorization Requests</h3>
<p>There also exists an extension to famout OAuth authorization framework to
implement FGA.</p>
<p>Ideal for when <strong>user interaction</strong> (permission) is required before allowing a
service to take an action. Or for <strong>cross-domain</strong> use cases.</p>
<p>From RFC 9396: OAuth 2.0 Rich Authorization Requests:</p>
<blockquote>
<p>This specification introduces a new parameter authorization_details that
allows clients to specify their fine-grained authorization requirements using
the expressiveness of JSON data structures.</p>
</blockquote>
<blockquote>
<p>For example, an authorization request for a credit transfer (designated as
&ldquo;payment initiation&rdquo; in several open banking initiatives) can be represented
using a JSON object like this:</p>
</blockquote>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;payment_initiation&#34;</span>,
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;locations&#34;</span>: [
</span></span><span style="display:flex;"><span>      <span style="color:#e6db74">&#34;https://example.com/payments&#34;</span>
</span></span><span style="display:flex;"><span>   ],
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;instructedAmount&#34;</span>: {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;currency&#34;</span>: <span style="color:#e6db74">&#34;EUR&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;amount&#34;</span>: <span style="color:#e6db74">&#34;123.50&#34;</span>
</span></span><span style="display:flex;"><span>   },
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;creditorName&#34;</span>: <span style="color:#e6db74">&#34;Merchant A&#34;</span>,
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;creditorAccount&#34;</span>: {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;bic&#34;</span>:<span style="color:#e6db74">&#34;ABCIDEFFXXX&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;iban&#34;</span>: <span style="color:#e6db74">&#34;DE02100100109307118603&#34;</span>
</span></span><span style="display:flex;"><span>   },
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;remittanceInformationUnstructured&#34;</span>: <span style="color:#e6db74">&#34;Ref Number Merchant&#34;</span>
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><em>From RFC 9396: Example of an Authorization Request for a Credit Transfer</em></p>
<h2 id="the-new-enemy-problem">The new enemy problem</h2>
<h2 id="audit-logs">Audit logs</h2>
<p>An advantage is centralizing the authorization is that it also become easier to
centralize the <strong>decision logs</strong>. These are very useful for auditing.</p>
<h2 id="projects-and-products">Projects and products</h2>
<h3 id="open-source-with-commercial-offering">Open source with commercial offering</h3>
<p>All most all (production ready) open source implementations of FGA are backed
by a commercial company providing a product based upon the open-source project.</p>
<p>Open source / Commercial product.</p>
<ul>
<li>OPA / Styra enterprise OPA &amp; DAS</li>
<li>OPAL / Permit.io</li>
<li>Aserto / Topaz</li>
<li>spiceDB / AuhtZed</li>
<li>OpenFGA / Auth0 (Okta) FGA</li>
<li>Casbin / Casdoor</li>
</ul>
<h3 id="proprietary">Proprietary</h3>
<p>Several companies also sell fully closed source authorization services.</p>
<ul>
<li>Oso Security</li>
<li>Ping Authorize</li>
<li>AWS Cedar</li>
<li>Axiomatics</li>
<li>Permify</li>
<li>Cerbos</li>
</ul>
<h2 id="sources--further-reading">Sources &amp; further reading</h2>
<ul>
<li><a href="https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/">https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/</a></li>
<li><a href="https://idpro.org/the-state-of-the-union-of-authorization/">https://idpro.org/the-state-of-the-union-of-authorization/</a></li>
<li><a href="https://www.permit.io/blog/what-is-fine-grained-authorization-fga">https://www.permit.io/blog/what-is-fine-grained-authorization-fga</a></li>
<li><a href="https://openid.net/wg/authzen/">https://openid.net/wg/authzen/</a></li>
<li><a href="https://openid.github.io/authzen/">https://openid.github.io/authzen/</a></li>
<li><a href="https://www.feldera.com/blog/fine-grained-authorization">https://www.feldera.com/blog/fine-grained-authorization</a></li>
<li><a href="https://docs.aserto.com/docs/authorization-basics">https://docs.aserto.com/docs/authorization-basics</a></li>
<li><a href="https://datatracker.ietf.org/doc/html/rfc9396">https://datatracker.ietf.org/doc/html/rfc9396</a></li>
</ul>
]]></content:encoded>
    </item>
    
    <item>
      <title>Fine-Grained Authorization (FGA)</title>
      <link>https://notes.robinvanhove.me/notes/test2x/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://notes.robinvanhove.me/notes/test2x/</guid>
      <description>&lt;p&gt;Broken Object Level Authorization is the number one in OWASP&amp;rsquo;s API security
top 10.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;APIs tend to expose endpoints that handle object identifiers, creating a wide
attack surface of Object Level Access Control issues. Object level
authorization checks should be considered in every function that accesses a
data source using an ID from the user.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;what-is-authorization&#34;&gt;What is Authorization?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Decide&lt;/strong&gt; if an action can be taken.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can Alice view document #123?&lt;/li&gt;
&lt;li&gt;Can Alice view document #123 at 16:30 on Tuesday, 11 June, 2024?&lt;/li&gt;
&lt;li&gt;Can Bob edit document #123 in China?&lt;/li&gt;
&lt;li&gt;Can Bob edit document #123 in China, when authenticated with MFA?&lt;/li&gt;
&lt;li&gt;Can a manager create document #456&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We can always identify the following:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Broken Object Level Authorization is the number one in OWASP&rsquo;s API security
top 10.</p>
<blockquote>
<p>APIs tend to expose endpoints that handle object identifiers, creating a wide
attack surface of Object Level Access Control issues. Object level
authorization checks should be considered in every function that accesses a
data source using an ID from the user.</p>
</blockquote>
<h2 id="what-is-authorization">What is Authorization?</h2>
<p><strong>Decide</strong> if an action can be taken.</p>
<ul>
<li>Can Alice view document #123?</li>
<li>Can Alice view document #123 at 16:30 on Tuesday, 11 June, 2024?</li>
<li>Can Bob edit document #123 in China?</li>
<li>Can Bob edit document #123 in China, when authenticated with MFA?</li>
<li>Can a manager create document #456</li>
</ul>
<p>We can always identify the following:</p>
<ul>
<li><strong>Subject</strong>, the user or thing trying to take an action
<ul>
<li>Type &amp; identifier
<ul>
<li>E.g. <code>user:Alice</code>, <code>application:123</code></li>
</ul>
</li>
<li>Or properties of the subject
<ul>
<li>E.g. <code>manager</code></li>
</ul>
</li>
</ul>
</li>
<li><strong>Action</strong>, the thing the subject is trying to do
<ul>
<li>E.g. <code>view</code>, <code>edit</code></li>
</ul>
</li>
<li><strong>Resource</strong>, the target of the action
<ul>
<li>Type &amp; identifier</li>
<li>E.g. <code>document:#123</code></li>
</ul>
</li>
<li><strong>Context</strong>, any additional information that can influence the decision.
<ul>
<li>E.g. time, location, authentication method.</li>
</ul>
</li>
</ul>
<p>Additionally we often want to <strong>search</strong> based on the authorization decisions.
A search is essentially a decision with one or more free variables.</p>
<ul>
<li>Which documents can Alice view?</li>
<li>Who can view document 123?</li>
<li>What actions can Alice perform on document 123 on Tuesday, June 11, 2024?</li>
</ul>
<h2 id="access-control-models">Access control models</h2>
<p>Access control models can be separated by their specificity.</p>
<h3 id="coarse-grained-access-control-models">Coarse-grained access control models</h3>
<p><strong>Role-based access control</strong> (RBAC), is the most common access control model.
A subject is assigned to a role and depending on their role the application
decides whether to allow access.</p>
<p>Coarse grained access control models such as RBAC are easy to implement.</p>
<p>It might look like they are easy to manage but in practice group, entitlements
and roles become a mess.</p>
<h3 id="fine-grained-access-context-models">Fine-grained access context models</h3>
<p>Often this is implemented by mapping specific actions on resources to
<strong>entitlements</strong> (arbitrary strings) and combining those in a <strong>role</strong> and
assigning those to a <strong>group</strong> of subjects.</p>
<p><strong>Relationship-based access control</strong> (ReBAC) looks at the relation of
resources and subjects. Essentially it looks at the <strong>graph</strong> of resources and
subjects to decides whether an action is allowed.</p>
<p>
  <img loading="lazy" src="https://cdn.sanity.io/images/4gqsq44z/production/f1c0fdaab8e232d83156f2987513f079c4b648cf-1600x1000.png" alt="ReBAC"  />
<em>From: <a href="https://docs.aserto.com/docs/authorization-basics/authorization-models/rebac">https://docs.aserto.com/docs/authorization-basics/authorization-models/rebac</a></em></p>
<p><strong>Attribute-based access control</strong> (ABAC), compares attributes assigned to a
subject and resource to decide if an action is allowed.</p>
<p><strong>Policy-based access control</strong> (PBAC), the most generic model. A policy can be
any evaluation of any computer program. Often specific domain specific
languages are used to describe the policy.</p>
<h3 id="hybrid-models">Hybrid models</h3>
<p>Coarse-grained and fine-grained can be combined. For example an API gateway or
application proxy can check if a user is allowed to access a service using RBAC
but the service can use a more fine-grained model such as ReBAC to check if
specific actions are allowed on a resource.</p>
<p>This approach can improve performance and provide better (mutli-layered)
security.</p>
<h3 id="googles-zanzibar">Google&rsquo;s Zanzibar</h3>
<blockquote>
<p>Determining whether online users are authorized to access digital objects is
central to preserving privacy. This paper presents the design,
implementation, and deployment of Zanzibar, a global system for storing and
evaluating access control lists. Zanzibar provides a uniform data model and
configuration language for expressing a wide range of access control policies
from hundreds of client services at Google, including Calendar, Cloud, Drive,
Maps, Photos, and YouTube. Its authorization decisions respect causal
ordering of user actions and thus provide external consistency amid changes
to access control lists and object contents. Zanzibar scales to trillions of
access control lists and millions of authorization requests per second to
support services used by billions of people. It has maintained
95th-percentile latency of less than 10 milliseconds and availability of
greater than 99.999% over 3 years of production use.</p>
</blockquote>
<p><a href="https://research.google/pubs/zanzibar-googles-consistent-global-authorization-system/">https://research.google/pubs/zanzibar-googles-consistent-global-authorization-system/</a></p>
<h2 id="authorization-policies">Authorization Policies</h2>
<p>These describe the rules. From <a href="https://csrc.nist.gov/pubs/sp/800/162/upd2/final">Nist&rsquo;s guide to ABAC</a>:</p>
<blockquote>
<p><strong>Natural Language Policy</strong> (NLP): Statements governing management and access
of enterprise objects. NLPs are human expressions that can be translated to
machine-enforceable access control policies.</p>
</blockquote>
<blockquote>
<p><strong>Digital Policy</strong> (DP): Access control rules that compile directly into
machine executable codes or signals. Subject/object attributes, operations,
and environment conditions are the fundamental elements of DP, the building
blocks of DP rules, which are enforced by an access control mechanism.</p>
</blockquote>
<blockquote>
<p><strong>Metapolicy</strong> (MP): A policy about policies, or policy for managing
policies, such as assignment of priorities and resolution of conflicts
between DPs or other MPs.</p>
</blockquote>
<p>Digital policies are the real software implementation of the policy. These are
often described using A DCL XACML, ALFA, Rego, Oso Polar.</p>
<p>A policy evaluation <strong>engine</strong> takes the authorization policy, and the
authorization request and outputs a decision.</p>
<h3 id="digital-policy-example-with-rego">Digital Policy example with Rego</h3>
<p>Rego is currently the most popular and open language for to define policies, it
was developed for the OPA policy engine and is based on the datalog programming language.</p>
<p>Rego is a <strong>declerative</strong> programming language, made for writing authorization policies.</p>
<p>The following is an example from the <a href="https://play.openpolicyagent.org/">Rego playground</a>.</p>
<p><strong>Policy:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-Rego" data-lang="Rego"><span style="display:flex;"><span><span style="color:#66d9ef">package</span> <span style="color:#a6e22e">app</span><span style="color:#f92672">.</span><span style="color:#a6e22e">abac</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">default</span> <span style="color:#a6e22e">allow</span> <span style="color:#f92672">:=</span> <span style="color:#66d9ef">false</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">user_is_owner</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> {
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_employee</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">action_is_read</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> {
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_employee</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_senior</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">action_is_update</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>allow <span style="color:#66d9ef">if</span> {
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">user_is_customer</span>
</span></span><span style="display:flex;"><span>	<span style="color:#a6e22e">action_is_read</span>
</span></span><span style="display:flex;"><span>	<span style="color:#66d9ef">not</span> <span style="color:#a6e22e">pet_is_adopted</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_owner <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">title</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;owner&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_employee <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">title</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;employee&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_customer <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">title</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;customer&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user_is_senior <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">user</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">tenure</span> <span style="color:#f92672">&gt;</span> <span style="color:#ae81ff">8</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>action_is_read <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">action</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;read&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>action_is_update <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">action</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;update&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>pet_is_adopted <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">data</span><span style="color:#f92672">.</span><span style="color:#a6e22e">pet_attributes</span>[<span style="color:#a6e22e">input</span><span style="color:#f92672">.</span><span style="color:#a6e22e">resource</span>]<span style="color:#f92672">.</span><span style="color:#a6e22e">adopted</span> <span style="color:#f92672">==</span> <span style="color:#66d9ef">true</span>
</span></span></code></pre></div><p><strong>Data:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user_attributes&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&#34;alice&#34;</span>: {
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;tenure&#34;</span>: <span style="color:#ae81ff">20</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;title&#34;</span>: <span style="color:#e6db74">&#34;owner&#34;</span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    },
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;pet_attributes&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&#34;dog123&#34;</span>: {
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;adopted&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;age&#34;</span>: <span style="color:#ae81ff">2</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;breed&#34;</span>: <span style="color:#e6db74">&#34;terrier&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;toto&#34;</span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Input:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user&#34;</span>: <span style="color:#e6db74">&#34;alice&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;action&#34;</span>: <span style="color:#e6db74">&#34;read&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;resource&#34;</span>: <span style="color:#e6db74">&#34;dog123&#34;</span>
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Output:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;action_is_read&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;allow&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;pet_is_adopted&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user_is_owner&#34;</span>: <span style="color:#66d9ef">true</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;user_is_senior&#34;</span>: <span style="color:#66d9ef">true</span>
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h2 id="externalized-authorization-architecture">Externalized Authorization Architecture</h2>
<p>Often the authorization is implemented in the application itself, either
hard-coded or trough configurations. But this approach has shortcomings in
large, distributed and dynamic systems.</p>
<ul>
<li>Policy (interpretation) consistency</li>
<li>Reuse of implementations</li>
<li>Policy administration (version control, deployments)</li>
<li>More difficult to improve performance</li>
</ul>
<p>For these reasons it is often decided to externalize authorization out of the application.</p>
<p>The simplest approach to externalize  authorization is to <strong>centralize</strong> it in
one system. But there are other patterns possible, more on that later.</p>
<p>Defined in
<a href="https://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html">XACML</a>
and  <a href="https://csrc.nist.gov/pubs/sp/800/162/upd2/final">Nist&rsquo;s guide to ABAC</a></p>
<p>
  <img loading="lazy" src="https://upload.wikimedia.org/wikipedia/commons/f/f2/XACML_Architecture_%26_Flow.png" alt="XACML
Architecture"  />
<em>By Axiomatics - Axiomatics, CC BY 3.0,
<a href="https://commons.wikimedia.org/w/index.php?curid=48397652">https://commons.wikimedia.org/w/index.php?curid=48397652</a></em></p>
<p>
  <img loading="lazy" src="https://www.researchgate.net/publication/336538309/figure/fig2/AS:814067111436288@1571100132236/ACML-Standard-Oasis-2010-As-shown-in-the-Fig-3-above-the-major-components-of-XACML.ppm" alt="XACML Dataflow
Diagram"  />
<em>XACML Dataflow Diagram, image from OASIS spec.</em></p>
<h3 id="policy-decision-point-components">Policy Decision point components</h3>
<p>The PDP is shown as one component in the XACML architecture but we can
distinguish multiple subcomponents.</p>
<p><strong>Policy Engine</strong> is the component responsible for actually evaluating the
policy and making a decision.</p>
<p><strong>PDP Interface</strong> or <strong>API</strong> implements how the PEP can send queries to th PDP.
Often based upon HTTP and JSON but gRCP. Every PDP implementation uses a
different kind of (often proprietary API). But there is a process ongoing by
the OpenID foundation to standerize an interface called <strong>AuthZEN</strong>.</p>
<p>The <strong>data plane</strong> is responsible for gathering data form the relevant PIP&rsquo;s.
E.g. user &amp; resource attributes. The data plane can also concern itself with
<strong>caching</strong> and structuring the data in a performant <strong>data structure</strong> such as
a graph for performant policy evaluation.</p>
<p>The data plane can exist completely separate from the PDP (any databse or API
can be used). But many implementations choose to tightly couple the PDP and PIP
for optimal performance.</p>
<p>A <strong>policy control plane</strong> is required to distribute updates to policies the
PDP&rsquo;s as soon as they are changed. The control plane is the glue between the
PAP and PDP. The control plane can also provide information about the
configuration of the data plane, such as the location of the PIP&rsquo;s.</p>
<h3 id="fancy-archtiectural-patterns">Fancy Archtiectural patterns</h3>
<p>
  <img loading="lazy" src="https://i.ibb.co/F45Q7bC/main-numbered.png" alt="OPAL Architecture"  />
<em>OPAL Architecture, from <a href="https://docs.opal.ac/overview/architecture/">https://docs.opal.ac/overview/architecture/</a></em></p>
<ul>
<li>Fully centralized service</li>
<li>Per-tenant</li>
<li>Per application
<ul>
<li>As a library</li>
<li>Sidecar container</li>
</ul>
</li>
</ul>
<h2 id="policy-administration-pap">Policy administration (PAP)</h2>
<p>Many solutions provide powerful interfaces to manage policies.</p>
<p><strong>Policy creation</strong> interface. The digital policy can be written as computer
program using any text editor or IDE. But many implementations provide
interfaces to make it easy to use for less technical people.</p>
<p><strong>Version control</strong> is essential for policy management. Often software VCS such
as git ore often used because most operations are already using it. But
sometimes authorization services implement their own version control, tightly
coupled with the ui of the PAP.</p>
<p><strong>Policy distribution</strong> trough the <strong>control plane</strong>, just like any program the
authorization policies require some form of <strong>continous deployent</strong>, depending
on the chosen architecture this can become very complex, requiring deployment
to multiple PDP&rsquo;s without having downtime.</p>
<p><strong>Testing</strong> should also be considered, the digital policy is a computer program
like any other and there should exist &lsquo;unit&rsquo; test to ensure that the policies
(and any for changes) behave as expected. Issues in a policy can have huge
consequences for the security of the system.</p>
<h2 id="authzen">AuthZEN</h2>
<p>The OpenID foudnation has identified the need for a standardized interface for
authorization, similar to their OpenID connect standard for authentication.</p>
<p><a href="https://openid.github.io/authzen/">https://openid.github.io/authzen/</a></p>
<p>AuthZEN is essentially an API specification standardizing the contract between
PDP and PEP. It contains two API&rsquo;s.</p>
<ul>
<li>Access Evaluation(s) API</li>
<li>Search API</li>
</ul>
<h3 id="access-evaluation-api">Access Evaluation API</h3>
<p><em>Modified example from the AuthZEN draft.</em></p>
<p>The access evaluation API returns the decision as a boolean, but can also provide some context.</p>
<p>An alternative endpoint is also defined that can evaluate multiple decisions in one request.</p>
<p><strong>Request:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#a6e22e">POST</span> /access/v1/evaluation <span style="color:#66d9ef">HTTP</span><span style="color:#f92672">/</span><span style="color:#ae81ff">1.1</span>
</span></span><span style="display:flex;"><span>Host<span style="color:#f92672">:</span> <span style="color:#ae81ff">pdp.example.com</span>
</span></span><span style="display:flex;"><span>Content-Type<span style="color:#f92672">:</span> <span style="color:#ae81ff">application/json</span>
</span></span><span style="display:flex;"><span>Authorization<span style="color:#f92672">:</span> <span style="color:#ae81ff">Bearer &lt;myoauthtoken&gt;</span>
</span></span><span style="display:flex;"><span>X-Request-ID<span style="color:#f92672">:</span> <span style="color:#ae81ff">bfe9eb29-ab87-4ca3-be83-a1d5d8305716</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;subject&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;user&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;alice@example.com&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;resource&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;document&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;1&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;action&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;edit&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;context&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;time&#34;</span>: <span style="color:#e6db74">&#34;1985-10-26T01:22-07:00&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Response:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">HTTP/1.1 OK
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">Content-Type: application/json
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716
</span></span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;decision&#34;</span>: <span style="color:#66d9ef">false</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;context&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;reason&#34;</span>: <span style="color:#e6db74">&#34;Subject is a viewer of the resource&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h3 id="search-api">Search API</h3>
<p><em>Example form the draft.</em></p>
<p>The search API can search for subjects, actions and resources.</p>
<p>It also specifies  <strong>pagination</strong> which is which is essential for scalability.</p>
<p><strong>Request:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#a6e22e">POST</span> /access/v1/search/resource <span style="color:#66d9ef">HTTP</span><span style="color:#f92672">/</span><span style="color:#ae81ff">1.1</span>
</span></span><span style="display:flex;"><span>Host<span style="color:#f92672">:</span> <span style="color:#ae81ff">pdp.example.com</span>
</span></span><span style="display:flex;"><span>Content-Type<span style="color:#f92672">:</span> <span style="color:#ae81ff">application/json</span>
</span></span><span style="display:flex;"><span>Authorization<span style="color:#f92672">:</span> <span style="color:#ae81ff">Bearer &lt;myoauthtoken&gt;</span>
</span></span><span style="display:flex;"><span>X-Request-ID<span style="color:#f92672">:</span> <span style="color:#ae81ff">bfe9eb29-ab87-4ca3-be83-a1d5d8305716</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;subject&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;user&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;alice@example.com&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;action&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;can_read&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;resource&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;account&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><strong>Response:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-http" data-lang="http"><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">HTTP/1.1 OK
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">Content-Type: application/json
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716
</span></span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;page&#34;</span>: {
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&#34;next_token&#34;</span>: <span style="color:#e6db74">&#34;a3M9NDU2O3N6PTI=&#34;</span>
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;results&#34;</span>: [
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;account&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;123&#34;</span>
</span></span><span style="display:flex;"><span>    },
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;account&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;id&#34;</span>: <span style="color:#e6db74">&#34;456&#34;</span>
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  ]
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h3 id="oauth-rich-authorization-requests">OAuth Rich Authorization Requests</h3>
<p>There also exists an extension to famout OAuth authorization framework to
implement FGA.</p>
<p>Ideal for when <strong>user interaction</strong> (permission) is required before allowing a
service to take an action. Or for <strong>cross-domain</strong> use cases.</p>
<p>From RFC 9396: OAuth 2.0 Rich Authorization Requests:</p>
<blockquote>
<p>This specification introduces a new parameter authorization_details that
allows clients to specify their fine-grained authorization requirements using
the expressiveness of JSON data structures.</p>
</blockquote>
<blockquote>
<p>For example, an authorization request for a credit transfer (designated as
&ldquo;payment initiation&rdquo; in several open banking initiatives) can be represented
using a JSON object like this:</p>
</blockquote>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;payment_initiation&#34;</span>,
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;locations&#34;</span>: [
</span></span><span style="display:flex;"><span>      <span style="color:#e6db74">&#34;https://example.com/payments&#34;</span>
</span></span><span style="display:flex;"><span>   ],
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;instructedAmount&#34;</span>: {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;currency&#34;</span>: <span style="color:#e6db74">&#34;EUR&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;amount&#34;</span>: <span style="color:#e6db74">&#34;123.50&#34;</span>
</span></span><span style="display:flex;"><span>   },
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;creditorName&#34;</span>: <span style="color:#e6db74">&#34;Merchant A&#34;</span>,
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;creditorAccount&#34;</span>: {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;bic&#34;</span>:<span style="color:#e6db74">&#34;ABCIDEFFXXX&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;iban&#34;</span>: <span style="color:#e6db74">&#34;DE02100100109307118603&#34;</span>
</span></span><span style="display:flex;"><span>   },
</span></span><span style="display:flex;"><span>   <span style="color:#f92672">&#34;remittanceInformationUnstructured&#34;</span>: <span style="color:#e6db74">&#34;Ref Number Merchant&#34;</span>
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p><em>From RFC 9396: Example of an Authorization Request for a Credit Transfer</em></p>
<h2 id="the-new-enemy-problem">The new enemy problem</h2>
<h2 id="audit-logs">Audit logs</h2>
<p>An advantage is centralizing the authorization is that it also become easier to
centralize the <strong>decision logs</strong>. These are very useful for auditing.</p>
<h2 id="projects-and-products">Projects and products</h2>
<h3 id="open-source-with-commercial-offering">Open source with commercial offering</h3>
<p>All most all (production ready) open source implementations of FGA are backed
by a commercial company providing a product based upon the open-source project.</p>
<p>Open source / Commercial product.</p>
<ul>
<li>OPA / Styra enterprise OPA &amp; DAS</li>
<li>OPAL / Permit.io</li>
<li>Aserto / Topaz</li>
<li>spiceDB / AuhtZed</li>
<li>OpenFGA / Auth0 (Okta) FGA</li>
<li>Casbin / Casdoor</li>
</ul>
<h3 id="proprietary">Proprietary</h3>
<p>Several companies also sell fully closed source authorization services.</p>
<ul>
<li>Oso Security</li>
<li>Ping Authorize</li>
<li>AWS Cedar</li>
<li>Axiomatics</li>
<li>Permify</li>
<li>Cerbos</li>
</ul>
<h2 id="sources--further-reading">Sources &amp; further reading</h2>
<ul>
<li><a href="https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/">https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/</a></li>
<li><a href="https://idpro.org/the-state-of-the-union-of-authorization/">https://idpro.org/the-state-of-the-union-of-authorization/</a></li>
<li><a href="https://www.permit.io/blog/what-is-fine-grained-authorization-fga">https://www.permit.io/blog/what-is-fine-grained-authorization-fga</a></li>
<li><a href="https://openid.net/wg/authzen/">https://openid.net/wg/authzen/</a></li>
<li><a href="https://openid.github.io/authzen/">https://openid.github.io/authzen/</a></li>
<li><a href="https://www.feldera.com/blog/fine-grained-authorization">https://www.feldera.com/blog/fine-grained-authorization</a></li>
<li><a href="https://docs.aserto.com/docs/authorization-basics">https://docs.aserto.com/docs/authorization-basics</a></li>
<li><a href="https://datatracker.ietf.org/doc/html/rfc9396">https://datatracker.ietf.org/doc/html/rfc9396</a></li>
</ul>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
