All chapters
  1. Start hereA valid token is not a permission
  2. Foundations · 1Identity and trust primitives: who is calling, and who checks
  3. Foundations · 2People and identity proofing: accounts, passwords and recovery
  4. Foundations · 3Sessions and browser security: cookies, CSRF, XSS and the BFF
  5. Foundations · 4Authenticators and MFA: passwords, passkeys and phishing resistance
  6. Foundations · 5API keys and application credentials: what a key proves
  7. Foundations · 6Tokens: bearer, JWT anatomy, validation and revocation
  8. Foundations · 7OAuth, OpenID Connect and federation: delegation and login
  9. Authorization · 8Authorization from first principles: subject, action, resource, context
  10. Authorization · 9Access control models: RBAC, ABAC, ReBAC and ownership
  11. Authorization · 10The enforcement architecture: PEP, PDP, PIP and PAP
  12. Authorization · 11Policy as code: versions, tests, engines and decision logs
  13. Authorization · 12Tenant and data isolation: one platform, many brokerages
  14. Authorization · 13Identity governance and lifecycle: joiner, mover, leaver
  15. Authorization · 14Privileged access: standing rights, just-in-time elevation and break-glass
  16. Workloads · 15TLS, PKI and certificates: proving a host, and a client
  17. Workloads · 16Workload and service identity: SPIFFE, mTLS and caller allowlists
  18. Workloads · 17API gateways and zero trust: the edge checks, the service decides
  19. Workloads · 18Event-driven identity: Kafka principals, ACLs and replay
  20. Workloads · 19Cloud IAM and secretless deployment: roles, federation and no stored keys
  21. Workloads · 20External SaaS, webhooks and trust: calls that cross company lines
  22. Workloads · 21Private controlled environments: what private networking does and does not secure
  23. AI-native · 22Authenticating to model providers: keys, gateways and cloud IAM
  24. AI-native · 23MCP identity and authorization: discovery is not permission
  25. AI-native · 24RAG and retrieval authorization: only what this caller may read
  26. AI-native · 25Agents as principals and delegates: whose authority is this?
  27. AI-native · 26Agent-to-agent trust: identity, capabilities and forwarded authority
  28. AI-native · 27Coding agents and CI: repository scopes, OIDC and no production keys
  29. Operations · 28Auditing and observability of access: decisions you can prove later
  30. Operations · 29Threat modeling and testing: the negative tests that prove access control
  31. Operations · 30Operational lifecycles: rotation, revocation and outages
  32. Reference · 31Standards, frameworks and products: what each one is, and what it is not
  33. Reference · 32Architecture decision playbooks: choosing an auth strategy
  34. ReferenceGlossary
  35. AboutAbout this site and its sources
Authorization · 9

Access control models: RBAC, ABAC, ReBAC and ownership

Roles answer which kind of person; attributes answer under which conditions; relationships answer whose record. ACLs, ownership, tenant membership, row and field level security, hierarchy, and why no model replaces all the others.

You will compare
RBAC, ABAC and ReBAC on the same five requests, and count the holes each one leaves.
You will place
ACLs, ownership, tenant membership, row and field security, hierarchy and inheritance in one picture.
You will combine
Models so that each states the part of the rule it is good at, because none replaces the others.

On Monday at 08:30 the underwriter u-uw-w1 calls in sick for a week. Submission SUB-1004, with its roof that the application says is 9 years old and the provider says is 22, cannot wait. The team lead opens the assignment screen and moves SUB-1004 to the peer underwriter u-uw-w2. At 08:31 u-uw-w2 can record a decision on it. At 08:31 u-uw-w1, if she logged in from home, could not.

Nobody edited a role. Nobody changed the authorization policy or redeployed a service. Nobody issued a new token. One row in one table changed, and the system's answer to "who may decide SUB-1004?" changed with it, for exactly one submission and two people.

That works because the rule was written on the right kind of fact. "Only the assigned underwriter decides" is a statement about a relationship between a person and a record. Had the team written it as a role ("underwriters decide"), the peer could already decide every submission in the company. Had they written it as an attribute ("underwriters of the unit decide"), the peer could already decide SUB-1004 before Monday, which is exactly this site's case UW-A09. This page is about choosing the kind of fact each part of a rule is written on.

Three questions a rule can ask#

Every access rule in the example is built from three kinds of question.

Which kind of principal is this? A broker, an underwriter, an auditor. That is a question about a role, and a model that decides on roles alone is RBAC (role-based access control). Tiny example: "underwriters may record decisions."

Under which conditions? The record's tenant equals the broker's tenant; the submission's unit equals the underwriter's unit; the submission's risk tier is high. Those are questions about attributes of the subject, the resource and the context, and a model that decides on them is ABAC (attribute-based access control). Tiny example: "an underwriter may read submissions of her own unit."

Whose record is it, or how is this principal connected to it? SUB-1004 is assigned to u-uw-w1; quote Q-5531 belongs to the tenant brk-north, of which u-broker-n1 is a member. Those are questions about relationships, and a model that decides on them is ReBAC (relationship-based access control). Tiny example: "only the underwriter assigned to a submission may decide it."

Plain English. Roles say what kind of person you are. Attributes say under which conditions. Relationships say whose record it is. A real rule usually needs all three.
Before AI. Backend engineers have used all three for decades without the acronyms. LDAP groups mapped to application roles are RBAC. A WHERE tenant_id = ? clause on every query is ABAC. A document_permissions table with one row per user and document is a relationship store, and Unix files with an owner, a group and permission bits mix ownership with groups. The models are names for patterns already in your code.

The smallest primitive: one function, three models#

The example makes the comparison concrete with pdp.decide_model in examples/uw-auth/pdp.py. It decides one request under one model only: RBAC checks the role, ABAC adds the tenant or unit attribute, ReBAC adds the assignment relationship. It is a teaching comparison, not the production policy; the real decision (pdp.decide, on Authorization) combines all three with more conditions. The code below is verbatim, with its two tables.

from typing import Any

ROLE_PERMS: dict[str, list[str]] = {
    "broker": ["quote.read", "quote.submit"],
    "underwriter": ["quote.read", "submission.read", "decision.record"],
    "auditor": ["audit.read"],
}
MODELS = ["rbac", "abac", "rebac"]


def decide_model(model: str, subject: dict[str, Any], action: str, resource: dict[str, Any]) -> dict[str, Any]:
    """Decide under one model only. RBAC: role permits action. ABAC: + tenant/unit attributes. ReBAC: + assignment.

    A teaching comparison, not the production policy (that is `decide`, which combines all three).
    """
    if model not in MODELS:
        return {"model": model, "allow": False, "reason": "unknown model"}
    roles = subject.get("roles") or []
    permitted = [r for r in roles if action in ROLE_PERMS.get(r, [])]
    if not permitted:
        return {"model": model, "allow": False, "reason": "no role grants " + action}
    if model == "rbac":
        return {"model": model, "allow": True, "reason": "role " + permitted[0] + " grants " + action + " (on any record)"}
    if "broker" in roles:
        if resource.get("tenant") != subject.get("tenant"):
            return {"model": model, "allow": False, "reason": "tenant " + str(resource.get("tenant")) + " is not the caller's tenant " + str(subject.get("tenant"))}
    elif resource.get("business_unit") != subject.get("business_unit"):
        return {"model": model, "allow": False, "reason": "unit " + str(resource.get("business_unit")) + " is not the caller's unit " + str(subject.get("business_unit"))}
    if model == "abac":
        return {"model": model, "allow": True, "reason": "role and attributes match"}
    if action == "decision.record" and resource.get("submission_id") not in (subject.get("assignments") or []):
        return {"model": model, "allow": False, "reason": "no assigned_to relationship between " + str(subject.get("principal_id")) + " and " + str(resource.get("submission_id"))}
    return {"model": model, "allow": True, "reason": "role, attributes and relationship match"}

Read the three exits in order and the models become cumulative layers: every ABAC decision first passes RBAC, every ReBAC decision first passes ABAC. Notice what the RBAC branch's reason admits: "(on any record)". A role cannot name a record.

Five requests, three models#

The snippet decides the same five requests under each model and prints the last model's reason. It demonstrates where each model leaves a hole against the business rule (own tenant, own unit, only the assigned underwriter decides). It does not show that ReBAC is "the best model": ReBAC wins here because the example's rule is written on a relationship.

import pdp
from clock import START_EPOCH_S as NOW
from directory import resource_for, subject_for

REQUESTS = [
    ("u-broker-n1", "quote.read", "Q-5531", "quote"),
    ("u-broker-n1", "quote.read", "Q-6620", "quote"),
    ("u-uw-w1", "decision.record", "SUB-1004", "submission"),
    ("u-uw-w2", "decision.record", "SUB-1004", "submission"),
    ("u-uw-e1", "submission.read", "SUB-1004", "submission"),
]
for pid, action, rec, rtype in REQUESTS:
    subject = subject_for(pid, now=NOW)
    resource = resource_for(rec, rtype)
    row = [pdp.decide_model(m, subject, action, resource) for m in pdp.MODELS]
    marks = " ".join(f"{d['model']}={'allow' if d['allow'] else 'deny':<5}" for d in row)
    print(f"{pid:<12} {action:<16} {rec:<9} {marks} | {row[-1]['reason']}")

Run in a scratch copy of the example on 2026-11-18 (the example's agent is a scripted stand-in, so results here show how the access controls work, not how good any model is):

u-broker-n1  quote.read       Q-5531    rbac=allow abac=allow rebac=allow | role, attributes and relationship match
u-broker-n1  quote.read       Q-6620    rbac=allow abac=deny  rebac=deny  | tenant brk-south is not the caller's tenant brk-north
u-uw-w1      decision.record  SUB-1004  rbac=allow abac=allow rebac=allow | role, attributes and relationship match
u-uw-w2      decision.record  SUB-1004  rbac=allow abac=allow rebac=deny  | no assigned_to relationship between u-uw-w2 and SUB-1004
u-uw-e1      submission.read  SUB-1004  rbac=allow abac=deny  rebac=deny  | unit commercial-west is not the caller's unit commercial-east

Count the holes. RBAC allows three requests the business forbids: the cross-tenant broker, the peer underwriter, and the underwriter of the other unit. ABAC closes the tenant and unit holes and leaves the peer. ReBAC closes the peer. The peer underwriter u-uw-w2 is denied only by the relationship; the cross-tenant broker is already denied by an attribute.

Diagram: RBAC to ABAC to ReBAC · each layer closes the holes the one before leaves

Read left to right. The same five requests are decided by roles alone, then by roles plus attributes, then by roles, attributes and the assignment relationship. Roles leave three holes against the business rule: the cross-tenant broker, the peer underwriter and the underwriter of the other unit. Attributes close the tenant and unit holes. The relationship closes the peer. The layers are cumulative: nothing on the right replaces what is on the left.

  1. RBAC · roles
    1. role grants the action: The role underwriter grants decision.record; broker grants quote.read. The record is never consulted.
    2. 3 of 5 holes: Allows u-broker-n1 on Q-6620, u-uw-w2 on SUB-1004, u-uw-e1 on SUB-1004.
  2. ABAC · + attributes
    1. tenant or unit must match: Brokers: the record's tenant equals theirs. Underwriters: the record's unit equals theirs.
    2. 1 of 5 holes: u-uw-w2 has the role and the unit; ABAC asks nothing more. This is UW-A09.
  3. ReBAC · + relationship
    1. assigned_to this submission: Only the underwriter with an assigned_to relationship to the submission decides it.
    2. 0 of 5 holes: Every request decided as the business rule says. Reassigning SUB-1004 to u-uw-w2 changes one relationship, and the answer follows.

Now the Monday morning change. The snippet changes one directory fact per line, using subject_for overrides, and decides again. Nothing else is edited.

import pdp
from clock import START_EPOCH_S as NOW
from directory import resource_for, subject_for

changes = [
    ("u-uw-w2 assigned to SUB-1004", subject_for("u-uw-w2", now=NOW, assignments=["SUB-1007", "SUB-1004"]),
     "decision.record"),
    ("u-uw-e1 moved to commercial-west", subject_for("u-uw-e1", now=NOW, business_unit="commercial-west"),
     "submission.read"),
]
for label, subject, action in changes:
    resource = resource_for("SUB-1004", "submission")
    row = [pdp.decide_model(m, subject, action, resource) for m in pdp.MODELS]
    marks = " ".join(f"{d['model']}={'allow' if d['allow'] else 'deny':<5}" for d in row)
    print(f"{label:<34} {action:<16} {marks}")
u-uw-w2 assigned to SUB-1004       decision.record  rbac=allow abac=allow rebac=allow
u-uw-e1 moved to commercial-west   submission.read  rbac=allow abac=allow rebac=allow

The assignment made ReBAC allow the peer: that is the reassignment in the opening. The move of u-uw-e1 to commercial-west (a mover, in identity-governance terms) made ABAC allow her read. Both are correct, and both happened through data, not code. That is the practical reason to write a rule on an attribute or a relationship: the people who own the data can change access without a release, and the change is as narrow as the fact.

The models lab#

The lab decides the same five requests and lets you apply the two directory changes. The default opens on RBAC with the cross-tenant request selected; the three presets below open ABAC with the peer underwriter, ReBAC with the peer, and ABAC with the cross-tenant broker.

PrincipalActionRecordRBACABACReBACReBAC reason
u-broker-n1 (broker, brk-north)quote.readQ-5531allowallowallowrole, attributes and relationship match
u-broker-n1 (broker, brk-north)quote.readQ-6620 (brk-south)allow (hole)denydenytenant brk-south is not the caller's tenant brk-north
u-uw-w1 (assigned underwriter)decision.recordSUB-1004allowallowallowrole, attributes and relationship match
u-uw-w2 (peer underwriter, same unit)decision.recordSUB-1004allow (hole)allow (hole)denyno assigned_to relationship between u-uw-w2 and SUB-1004
u-uw-e1 (underwriter, commercial-east)submission.readSUB-1004allow (hole)denydenyunit commercial-west is not the caller's unit commercial-east

Holes against the business rule: RBAC 3 of 5, ABAC 1 of 5, ReBAC 0 of 5. Directory changes in the lab: assign u-uw-w2 to SUB-1004 (ReBAC then allows the peer), move u-uw-e1 to commercial-west (ABAC then allows the read).

RBAC: the right tool for the coarse question#

RBAC is the model most teams start with, and for good reasons. Roles are few, stable and easy to review: "who are our auditors?" is one query. They map to how organizations describe jobs, and they are what identity governance provisions (an HR system says "underwriter", a group grants the role). In the example, roles do real work: brokers can never reach underwriting actions, and the auditor can read audit records and nothing else.

Roles fail on the question they cannot express: which record. When teams try anyway, they invent roles such as underwriter-commercial-west and then underwriter-commercial-west-high-risk, one per combination of job and condition. This is called role explosion, and it ends with more roles than people and nobody able to say what a role means.

Roles can also form a role hierarchy: a senior role inherits every permission of a junior one, so senior-underwriter includes underwriter. Hierarchy reduces duplication and adds a review burden, because a permission added to a junior role silently reaches every role above it. Product (Cedar, as documented on 2026-11-18): hierarchy is part of the language: principal in Group::"alice_friends" matches "any principal in the hierarchy of the specified Group."

Guideline (OWASP Authorization Cheat Sheet, read 2026-11-18): "Although RBAC has a long history and remains popular among software developers today, ABAC and ReBAC should typically be preferred for application development." In this site's words: use roles for the coarse question, and never as the whole rule on records.

ABAC: conditions on the subject, the record and the moment#

Guideline (NIST SP 800-162, Guide to Attribute Based Access Control, final, January 2014 with updates as of August 2019, read 2026-11-18): ABAC is "a logical access control methodology where authorization to perform a set of operations is determined by evaluating attributes associated with the subject, object, requested operations, and, in some cases, environment conditions against policy, rules, or relationships that describe the allowable operations for a given set of attributes."

In the example, ABAC carries three kinds of condition. The subject's tenant or unit against the record's (R-AZ-03, R-AZ-04). The context: authentication strength and age for decision.record. And a resource attribute that deserves a closer look: the submission's risk tier. When risk_tier is high, rule R-AZ-09 also needs the entitlement uw.decide.high. All three example records are standard; the snippet sets one to high for the demonstration, and gives the assigned underwriter a fresh strong login so that only the risk-tier condition is in play.

import pdp
from clock import START_EPOCH_S as NOW
from directory import ACR_STRONG, resource_for, subject_for

w1 = subject_for("u-uw-w1", now=NOW, acr=ACR_STRONG, auth_time=NOW, client_id="svc-cockpit-bff")
high = dict(resource_for("SUB-1004", "submission"), risk_tier="high")
for label, subject in [("u-uw-w1, entitlements uw.decide", w1),
                       ("u-uw-w1, plus uw.decide.high",
                        dict(w1, entitlements=["uw.decide", pdp.HIGH_RISK_ENTITLEMENT]))]:
    d = pdp.decide(subject, "decision.record", high, {"now": NOW})
    print(f"risk_tier high | {label:<32} {'allow' if d['allow'] else 'deny'} {d['status']} {d['rule']} | {d['reason']}")
risk_tier high | u-uw-w1, entitlements uw.decide  deny 403 R-AZ-09 | risk tier high needs the entitlement uw.decide.high
risk_tier high | u-uw-w1, plus uw.decide.high     allow 200 R-AZ-09 | assigned underwriter decides through the cockpit after step-up

This is ABAC at its cleanest. The condition reads one attribute of the record and one entitlement of the subject. When the record's risk is reassessed, its access rule changes with it, and no role named "high-risk underwriter for commercial-west" is needed. The policy lab has a risk-tier control for the same rule.

ABAC's weakness is the mirror of its strength: the decision is only as good as the attributes. Who sets risk_tier? If the broker's submission form can set it, the broker controls access. Each attribute needs a trusted source (the record's system of record, the directory, the identity provider) and a known freshness.

ReBAC: whose record it is#

ReBAC decides on edges between principals and objects: "u-uw-w1 is assigned_underwriter of SUB-1004", "u-broker-n1 is a member of brk-north", "Q-5531 belongs to brk-north". A rule then follows edges: a broker may read a quote if she is a member of the tenant the quote belongs to.

Relationships are the natural shape for sharing, delegation and assignment, because those are facts about pairs. They also compose: membership of a group that owns a folder that contains a document is a chain of three edges, which is how inheritance appears in ReBAC.

Product (OpenFGA, as documented on 2026-11-18): OpenFGA "takes the best ideas from Google's Zanzibar paper for Relationship-Based Access Control"; data is stored as relationship tuples, "a user, relation, and object", and a Check asks whether "a user has a certain relationship with an object". The site's demo really ran OpenFGA v1.22.1 locally (examples/frameworks/openfga/OUTPUT.md): quote#reader defined as members of the quote's tenant, submission#decider as the assigned underwriter who is also an underwriter of the unit. The peer check returned False and a write that tried to make the agent an assigned_underwriter was refused by the type restriction (HTTP 400). Policy as code owns the engine; this page only needs the fact that the relationship check is a real, running mechanism.

ReBAC's cost is the relationship data itself. Every assignment, membership and share is a tuple someone must write, and, more often forgotten, delete. A leaver whose tuples remain keeps access in a ReBAC system exactly as a leaver whose role remains does in RBAC.

ACLs and ownership: relationships with simpler names#

Two older patterns are special cases of the same idea.

An ACL (access control list) is a list attached to one resource that names principals and what each may do with it. A Kafka topic ACL is a familiar pre-AI example. Product (Apache Kafka 4.4, as documented on 2026-11-18): an ACL reads "Principal {P} is [Allowed|Denied] Operation {O} From Host {H} on any Resource {R} matching ResourcePattern {RP}". ACLs are easy to read per resource and hard to review per principal ("what can this person touch?" means scanning every list). They are relationships stored next to the resource. Kafka owns that use.

Ownership is the single most common relationship: the principal that created or is responsible for a record may do more with it. The example uses ownership at the tenant level, not the person level: a quote is owned by the brokerage brk-north, so any broker of that tenant may read it, and a broker leaving the firm does not take her quotes along. Choosing the owner is a design decision. Person ownership is right for a draft; organization ownership is usually right for a business record.

Tenant membership is the relationship between a principal and a customer organization. It is so central in a multi-tenant system that it is usually checked twice: in the policy, and again as a predicate in every query. Tenants owns isolation models.

Row, field and document level security#

So far each decision has been about one request on one record. Data stores can enforce the same rules on many rows at once, and on parts of a row.

Row-level security filters rows inside the database by a policy, so a query returns only the rows the session may see. Product (PostgreSQL 18, as documented on 2026-11-18): with row-level security enabled, "If no policy exists for the table, a default-deny policy is used"; "Superusers and roles with the BYPASSRLS attribute always bypass the row security system", and table owners bypass it unless the table uses FORCE ROW LEVEL SECURITY. The site's demo ran this on PostgreSQL 18.7 (examples/frameworks/postgres-rls/OUTPUT.md): with ENABLE only, the table owner still read all three tenants' quotes; after FORCE, a cross-tenant SELECT returned zero rows and a cross-tenant INSERT was refused; and the superuser still read everything. Row-level security is a last line of defence under the application's decision, not a replacement for it.

Field-level security hides or refuses individual fields of a record a caller may otherwise read. The broker may read quote Q-5531, but the insurer's internal notes on SUB-1004 and the precedent references must never appear in her response. Guideline (OWASP API Security Top 10 2023, read 2026-11-18): API3 is "Broken Object Property Level Authorization", the field-level sibling of the record-level API1. The safe pattern is an explicit allowlist of fields per caller type, applied when the response is built, rather than returning the row and hoping the client ignores fields.

Document-level security is the same idea for search and retrieval: each indexed document or chunk carries the permissions of its source. It matters most when agents retrieve text for a model. RAG owns it.

Diagram: Layers of one rule · what each model answers, what it reads, and where it runs

Rows are the models; columns are the question each answers, the data it reads, and where the example enforces it. Read down the first column to see that the questions do not overlap. Read down the last column to see that the layers run in different places: the policy decision point, the repository, the database and the response builder. A system that keeps only one row has the holes of all the others.

  1. Roles
    1. which kind of principal?: Broker, underwriter, auditor: the coarse job.
    2. roles from the directory: Few, stable, provisioned by identity governance. A senior role may inherit a junior one.
    3. policy decision point: The decision function checks role and principal type before anything about the record.
  2. Attributes
    1. under which conditions?: Same tenant, same unit, risk tier, authentication strength, client.
    2. subject, record and context attributes: Directory for the subject, the system of record for the record, the identity provider for acr and auth_time. Never the request body.
    3. policy decision point + repository: The policy compares attributes; the repository repeats the tenant or unit as a query predicate.
  3. Relationships
    1. whose record? which link?: Assignment, membership, ownership, sharing: facts about pairs.
    2. relationship tuples or ACL entries: Each grant is a row someone must write and later delete.
    3. policy decision point or a relationship engine: The example reads assignments from the directory; the OpenFGA demo ran the same check in an engine.
  4. Inside the data
    1. which rows, which fields?: Filters many rows at once, and hides parts of a record the caller may otherwise read.
    2. tenant set per transaction; field allowlist: The application sets the tenant from the verified subject; the response builder uses a field allowlist per caller type.
    3. database and response builder: Row-level security filters inside the database; owners bypass it without FORCE, superusers always.

None replaces the others#

Read the layers diagram from top to bottom: each model answers a question the one above cannot, and each one has a failure the others do not share. That is why the example's real policy combines them, and why "we use ABAC" or "we moved to ReBAC" is never a complete description of a system.

ModelAnswersData it needsTypical failureIn the example
RBACwhich kind of principalroles from the directoryrole explosion; no record awarenessbroker vs underwriter vs auditor
ABACunder which conditionstrusted attributes of subject, record, contextan attribute the caller can set; stale attributestenant, unit, risk tier, acr, client
ReBACwhose record, which linkrelationship tuplestuples never deleted; graph too large to reviewassigned underwriter, tenant membership
ACLwho may do what to this one resourcea list per resourcecannot answer "what can this person touch?"Kafka topics (on the Kafka page)
Row-level securitywhich rows a session seesa session setting from the verified subjectowner or superuser bypass; tenant not set per transactionthe RLS demo on PostgreSQL 18.7
Field-level securitywhich parts of a recorda field allowlist per caller typethe whole row serialized by defaultbroker never sees internal notes
Common confusion. "ReBAC replaced RBAC" is not what happened in the example. The role still decides that only underwriters decide; the attribute still keeps units apart; the relationship picks the one underwriter. Removing any layer reopens its hole.

What goes wrong: a rule written on the wrong kind of fact#

UW-A09 is the clean case. The business rule named a relationship (assigned); the deployed policy, authz-2026.10.3, encoded an attribute (same unit). Under that version the peer underwriter could decide SUB-1004. Nothing crashed, the tests that existed passed, and the decision log, which recorded the policy version, is what made the drift findable.

The reverse mistake is as common: writing a condition as a relationship. If every underwriter of a unit had a tuple to every submission of that unit, a mover would keep hundreds of tuples from the old unit until someone cleaned them up, where an ABAC unit check would have changed in one place.

The test is to read the business rule aloud and listen for the nouns. "Underwriters" is a role. "Of the same unit", "high risk", "within five minutes" are attributes. "Assigned", "owner", "member", "shared with" are relationships. Encode each noun on its own kind of fact.

Choosing a combination#

SituationSimplest credible designTrigger to growGrows into
one application, a handful of rolesroles from the identity provider, plus tenant or unit conditions written in code and repeated as a query predicaterules on assignment, sharing or delegation appeara relationship table you own, read by the decision function
assignments, shares and teams across several servicesa relationship store owned by one service, with a check APIrelationships cross services, change constantly, or need inheritancea relationship engine (OpenFGA-style) as the shared store
conditions change faster than releasesattributes from systems of record, evaluated by a policy modulenon-developers must own rules; decision logs requireda policy engine (OPA, Cedar) with versioned policies
multi-tenant data storetenant predicate in every repository querydefence in depth for a shared schemarow-level security with the tenant set per transaction

This site's recommendation: keep roles for the coarse question, put conditions on trusted attributes, put "whose" on relationships, and add row-level security underneath when data is shared across tenants. Grow into an engine when a named trigger appears, never because a model sounds more modern.

What this is not. This page compares models. It does not compare policy engines or show their languages in depth; that is Policy as code. It does not cover tenant isolation architectures (shared schema, database per tenant); that is Tenants. Where the decision runs is on Enforcement.
In a coding agent. Repository permissions follow the same layers. A repository role is RBAC; an installation token narrowed to selected repositories is a relationship between the agent's app and those repositories; a rule that only a person with merge rights merges into the protected branch is a condition on the operation. A coding agent's GitHub App installation should hold the narrowest combination that lets it propose a pull request. Coding agents owns the details.

Security notes#

Monday checklist#

  1. Take one sensitive operation, read its business rule aloud, and label each noun: role, attribute or relationship. Check the code encodes each on that kind of fact.
  2. Count roles per person. More roles than job titles is role explosion; look for conditions hidden in role names.
  3. For each attribute your policy reads, write down who can change it. Remove any the caller can set.
  4. Pick a leaver from last month and search for their remaining relationships, ACL entries and shares.
  5. If you use row-level security, check which database role the application connects as, and whether tables use FORCE ROW LEVEL SECURITY.

Exercises#

1. A product manager asks for "high-risk submissions may only be decided by senior underwriters". Which model fits, and what does the example use?

AnswerABAC: a resource attribute plus an entitlement

A condition on the record's risk_tier attribute plus an entitlement: in the example, risk_tier high needs uw.decide.high (rule R-AZ-09). A role named "senior-high-risk-underwriter" per unit would be role explosion.

2. Why does ABAC leave a hole for u-uw-w2 on SUB-1004, and what single change in the data lets ReBAC allow her correctly?

AnswerSame unit is true; assigned is not

Her role and unit both match the record, and ABAC asks nothing more. Assigning SUB-1004 to her (one relationship) makes ReBAC allow her, as in the Monday reassignment.

3. The team enables row-level security on the quotes table and stops checking the tenant in the service. The application connects as the table owner. What happens?

AnswerOwners bypass RLS unless FORCE

Without FORCE ROW LEVEL SECURITY the owner bypasses the policy and reads every tenant, as step 1 of the PostgreSQL demo showed. With no service check either, cross-tenant reads leak.

Advanced perspective#

Role explosion and how teams get out of itMove conditions out of role names into attributes

Role explosion starts with a reasonable request: "underwriters in the west unit only". The quick fix is a role per unit; then per unit and risk level; then per unit, risk level and product line. Each new dimension multiplies roles. The symptoms are recognizable: role names with nouns that are really attributes, access reviews nobody can complete because nobody knows what a role grants, and requests for "a copy of role X but without Y". The way out is to keep roles that describe jobs (broker, underwriter, auditor) and move every condition into attributes the policy compares (unit, risk tier, product line) or relationships (assignment). Migrations are done one dimension at a time: introduce the attribute, write the condition, run both in parallel and compare decisions from the decision log, then delete the roles. Expect the review burden to fall, because reviewers now approve a small set of job roles plus attribute sources owned by systems of record.

Where attributes come from, and how fresh they areAn ABAC decision is only as good as its inputs

Each attribute has a source, an owner and a freshness. In the example: the subject's tenant and unit come from the directory, keyed by the verified sub; acr and auth_time come from the identity provider through the token; the record's tenant, unit and risk tier come from the system of record when the record is loaded. Three failure patterns recur. An attribute copied into a token stays as issued until the token expires, so a mover keeps the old unit for up to a token lifetime (900 seconds in the example, illustrative). An attribute supplied by the caller, such as a tenant in the request body, lets the caller choose access. And an attribute computed by a model, such as a risk tier an agent suggests, becomes a way to talk the system into access; the example never lets model output set a policy input. This site's recommendation: label every attribute with its source in the policy's documentation, read fast-changing ones at decision time, and record the values used in the decision log so that a reviewer can replay why a decision was made.

Relationship data has a lifecycleWrites on grant, deletes on revoke, and consistency in between

A relationship store turns access into data, so access changes inherit every problem of data. Tuples must be written when an assignment is made and deleted when it ends; both writes come from business events (assignment screen, offboarding, project end) and must not be lost. If the store is separate from the system of record, the two can disagree: the assignment table says u-uw-w2, the relationship engine still says u-uw-w1. Designs differ on how to keep them aligned: write both in one transaction where possible, publish assignment events and consume them idempotently, and reconcile periodically with a report of mismatches. Consistency matters at the moment of a decision too: a check that reads a replica a few seconds behind can allow a just-revoked share. The OpenFGA demo run also showed a separate trap: a Check whose condition lacked a context parameter returned an error, not allowed: false, so the enforcement point must treat an error as deny.

Combining models without surprisesOrder, deny precedence and one reason per decision

When several models contribute to one decision, three rules keep the result predictable. First, combine with AND for the layers of one rule: role and attribute and relationship must all hold, as in R-AZ-09; an OR between layers ("assigned, or same unit") quietly turns the strongest layer into the weakest. Second, let an explicit deny win: Product (Cedar, as documented on 2026-11-18): "even if a permit policy is satisfied, any satisfied forbid policy" overrides it, which is how the Cedar demo states "agents never decide" once, above every permit. Third, return one reason, from the first layer that failed, so tests and auditors can see which model refused; the example's order (principal type, role, entitlement, unit, assignment, risk tier, client, authentication) puts cheap and coarse checks first and the 404-versus-403 choice at the unit check, before any detail about the record leaks into a reason.

In one breath#

Roles answer which kind of principal, attributes answer under which conditions, and relationships answer whose record; ACLs, ownership and tenant membership are relationships with older names, and row, field and document security apply the same rules inside the data. Each model has a hole the others close, so the example combines them: the role keeps brokers out of underwriting, the unit attribute keeps units apart, and the assignment relationship picks the one underwriter who decides. Write each noun of the business rule on its own kind of fact, from a trusted source.

The decision now has the right shape. What remains is where it runs: which component asks, which one answers, where the facts come from, and what happens when the gateway is the only one checking or the decision point is down. The enforcement architecture separates the enforcement point, the decision point and their information sources, and shows a gateway-only check letting broken object level authorization through.