Security Foundations
Intermediate 14 min read Security Foundations

Access Control Models

Frameworks for expressing who may do what

DAC, MAC, RBAC, ABAC and ReBAC are the frameworks that turn 'who may touch what' into a language both policy and engine understand. Choosing/running the right model is the work.

RBACABACDACMACReBACpolicypermissions
Before we start

What you will learn

  • Compare DAC, MAC, RBAC, ABAC and relationship-based models
  • Explain policy × decision engine separation (XACML/OPA style)
  • Choose a model for a realistic system
Introduction

What is this?

Access control models formalize authorization. Discretionary (DAC): the resource owner decides. Mandatory (MAC): a system policy labels data and users decide nothing. Role-based (RBAC): permissions attach to roles; users get roles. Attribute-based (ABAC): decisions evaluate attributes (user, resource, environment). Relationship-based (ReBAC) grants based on relations ('manager of'). Modern systems combine Role/Attribute models and separate policy decision from enforcement.

Motivation

Why do you need it?

  • Saying 'add me to the admin group' is RBAC in action; most breaches are role misassignment or ABAC attribute errors.
  • The enforcement/decision split (PEP/PDP) is why 'deny by default' can be tested centrally.
  • Knowing the model lets you audit thousands of rules as a pattern, not case by case.
  • Compliance frameworks (SOC 2, HIPAA) find RBAC/ABAC language natural to certify against.
Think about it

Mental model

Imagine

Building access: badge → door → floor rules

Think of

Access control models

The badge is a credential. Whether a badge opens a door can follow roles (all 'DevOps' badges), rules (badges stamped 'contractor' and time-aware) or a per-door policy (this door trusts this badge). Models are just consistent philosophies for answering 'opens?'.

Mechanics

How it works

  • DAC: owners set ACLs on their resources — flexible, but sprawl and lateral risk.
  • MAC: labels (e.g., clearance/classification) are compared; no one lowers labels casually — used in classified and some kernel contexts.
  • RBAC: define roles (viewer, operator, admin), assign permissions to roles, assign users to roles; sessions assume roles.
  • ABAC: rules like 'allow access IF department==user.department AND time within support window AND resource.tier <= user.tier'.
  • Enforcement point (PEP) intercepts the call and asks a decision point (PDP/OPA) for a policy verdict; the PDP answers with allow/deny and obligations.
  • ReBAC: edges in a graph ('member of team X' or 'reports to') become grants — natural for SaaS tenants and org hierarchies.

Enforcement/decision split and RBAC core.

Request
PEP (app/firewall)
PDP (OPA/XACML)
Allow / Deny
Audit log
Real world

In production

  • An HR app uses RBAC: roles 'recruiter', 'hiring_manager', 'admin'; permission review reports list each user's roles quarterlly.
  • A cloud platform uses ABAC (principal tags, resource tags, aws:SourceIp) to centralize policy logic across services.
  • A SaaS adds ReBAC so 'only members of a shared folder's team' can view it, even as teams change shape.
Guidelines

Best practices

  • Start RBAC, add ABAC attributes only where roles alone can't express the rule.
  • Centralize policy in one decision engine; enforce everywhere consistently.
  • Default deny in the PDP and write allow rules narrowly.
  • Audit decisions, not just failures — knowing 'who was ALLOWED what' is the compliance answer.
  • Review role assignments; stale roles are the usual perennial weakness.
Watch out

Common mistakes

  • Implementing thousands of per-user ACLs (DAC style) and losing all ability to review.
  • Confusing 'has role' with 'allowed' when roles carry too many permissions.
  • Special-casing policy in each service so the same rule behaves differently across the fleet.
  • Forgetting the environment attributes (time, IP, device) that a break-glass path needs.
When things break

Debugging tips

  • A 'should be allowed' denial → check the PDP evaluation trace: which rule denied and which attribute caused it.
  • Permission explosion → query roles × permissions matrix and collapse duplicates.
  • Cross-environment inconsistency → standardize on one PDP and migrate rules, don't patch per-app.
Security

Security considerations

  • ABAC attributes are only as trustworthy as the feature sources feeding them; attacker-influenced attributes can grant access.
  • RBAC with too-coarse roles becomes 'everyone is admin of something' — a top root-cause of data breaches.
Interviews

Interview checkpoint

Test yourself

Quick quiz

0/2
1

Which model grants access based on evaluated attributes like resource tags and user department?

2

In RBAC, permissions are attached to resources, not to roles.

Go deeper

Official documentation