Skip to content
Tech Interview Prep
Technical interview guide

RBAC vs. ABAC Implementation

Assigning permissions via roles versus evaluating policies against attributes: the implementation tradeoffs of each.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v6
Editorial status
Reviewed

Scope: NIST RBAC and SP 800-162, NIST SP 800-207, current AWS/Azure/Google IAM, OPA, Cedar, and XACML guidance reviewed 2026-09-04.

Overview

Curated: · Written: · Reviewed:

RBAC vs. ABAC Implementation

In one line

Use RBAC when access tracks stable job functions over coarse resources. Use ABAC when access depends on tenant, ownership, classification, region, or time, and keep that context out of role names. Most production systems run a hybrid: a role grants the capability, and attributes constrain where and on which objects it applies.

Key definitions

  • Role explosion: the role count grows with each context combination (team x environment x data class) instead of with job functions.
  • PEP / PDP / PIP: the enforcement point asks the policy decision point, which pulls any missing attributes from the policy information point.
  • Fail-closed: a missing, malformed, stale, or erroring input produces deny.
  • Static SoD: conflicting roles cannot be assigned, checked against effective (inherited) roles.
  • Dynamic SoD: conflicting actions cannot occur in the same session or transaction.
  • Authoritative issuer: the single system allowed to write an attribute, with its schema, type, and freshness rule.

Formulas and complexity

Worked example from the replay in MCQ 25 (hypothetical labelling not needed; figures as given):

regression rate=13,000−12,4001,061,000−61,000=6001,000,000=0.06%\text{regression rate} = \frac{13{,}000 - 12{,}400}{1{,}061{,}000 - 61{,}000} = \frac{600}{1{,}000{,}000} = 0.06\%

Denominator is previously allowed traffic. Intended blocks are excluded from the numerator.

Cache staleness bound with stacked caches:

tstale≤TTLclient+TTLpolicyt_{\text{stale}} \le \text{TTL}_{\text{client}} + \text{TTL}_{\text{policy}}

With a 60 s client cache and a 5 s policy cache, the worst case is about 65 s, not the 10 minutes measured with the 600 s policy cache.

How it works

  1. The gateway builds a canonical request: authenticated principal, action, canonical resource ID, tenant, and resource attributes read from the system of record.
  2. The PDP resolves any attributes it lacks from the PIP, then evaluates the complete policy set under a stated combining rule.
  3. The enforcement point applies the decision to that exact object and records the policy version.
  4. List, search, export, bulk, and worker paths each repeat steps 1 to 3. One missed path is a bypass.
allow for this object deny or error Client request Gateway PEP Canonical request PDP evaluates policy set PIP attribute lookup Decision Forward Deny

When to use and when not to

SituationRBACABAC
Stable job functions, coarse resourcesFitsUsually overkill
Ownership, tenant, classification, time, networkRole per combination, explodesFits
Hot path with a tight p99Claims in the token, in memoryPIP fetches add variable latency
Auditor asks who can access object XRead role membershipNeeds simulation tooling
Revocation within minutesBounded by token lifetimeBounded by attribute freshness and cache TTLs

Traps interviewers probe

  1. Missing attribute treated as a value. A Go map returns an empty string for a missing key, so resource_team == caller_team is true when both are missing. Fix: test for presence and deny when absent.
  2. Checking the path tenant instead of the object. A query like WHERE id = $1 returns another tenant's row when the path tenant matches the token. Fix: scope the query by the token's tenant, or check the loaded row's tenant before returning it.
  3. Expecting a deny rule in Kubernetes RBAC. RBAC rules are allow-only, and a Role cannot subtract a grant from a ClusterRoleBinding. Fix: remove or narrow the binding, or enforce the restriction with admission policy.
  4. Caching decisions without the policy version. A cache keyed on principal, method, and path keeps serving ALLOW after a deploy removes the permission. Fix: put the policy version in the key, invalidate on deploy, and bound staleness by the TTLs.
  5. All-or-nothing batch that authorizes any item. Checking whether the caller can delete some item lets the whole batch through. Fix: require every ID to pass before any delete runs.

Interview tips

Open with the decision: "I would go hybrid. Roles grant capability, attributes constrain context, missing attributes deny, and the PDP is called on every path, including lists, exports, and jobs."

Expect these follow-ups: missing or stale attribute, revocation delay and the number that meets it, bulk, export and background-job paths, precedence between allow and deny, and who can access this object.

30-second outline:

  1. Model: hybrid, chosen on whether the rules track function or context.
  2. Attributes: issuer, schema, freshness, deny on missing.
  3. Enforcement: every path, applied to the exact object.
  4. Revocation: cache TTL sum and invalidation on deploy.
  5. Audit: policy version and attribute versions for each allow.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.