Access Control Models and Least Privilege
Learn how DAC, MAC, RBAC, and ABAC control access, how least privilege limits damage, and how to review human and service permissions safely.
Access control models give teams different ways to decide which identities may act on which resources. This guide compares DAC, MAC, RBAC, and ABAC, then applies least privilege to human and workload permissions through access reviews, service identity ownership, and production examples. Use the review and troubleshooting guidance to keep grants understandable, test both allowed and denied actions, and remove access when its purpose ends.
Access Control Models and Least Privilege
Introduction
Access control determines which identity can perform which action on a resource. It applies whenever a person opens a document, a service reads a database, or an administrator changes a production setting. Authentication answers “who or what is making this request?” Authorization answers “is this identity allowed to do this here?” (Authentication and authorization explains that distinction in more detail.)
An access control model gives a system a consistent way to make authorization decisions. Least privilege is the operating principle that keeps each grant as narrow as the task permits. Together, they help teams make permissions understandable and limit the damage when an account or system is misused.
Four Common Access Control Models
These models describe different ways to decide who may do what. Real systems can combine them, but the distinction helps when choosing a policy approach.
Discretionary Access Control (DAC)
With DAC, a resource owner can grant access to other identities. A familiar example is a file owner sharing a document with a colleague. The owner has discretion over the permissions, often read or edit.
DAC is convenient when people manage their own files and collaboration needs change often. The risk is that permissions can spread: a recipient may share the file again, or an owner may grant access without understanding the sensitivity of the data. Central rules and periodic review can constrain that drift.
Mandatory Access Control (MAC)
With MAC, a central authority defines policy using labels or classifications. A subject and a resource receive labels, and the system compares them before granting access. For example, a document marked “confidential” may only be available to identities with an approved clearance.
MAC can provide consistent boundaries in environments where classification rules matter. It is less flexible for everyday collaboration because users cannot simply override the policy. Label quality and administration also matter: an incorrect classification can block legitimate work or expose information to the wrong group.
Role-Based Access Control (RBAC)
With RBAC, permissions are assigned to roles, and identities receive roles based on their responsibilities. A “billing analyst” role might read invoices and export monthly reports, while a “billing administrator” can also change billing settings.
RBAC is usually easy to explain and audit when jobs map cleanly to a manageable set of roles. It can become difficult when each exception produces another narrowly named role. Broad roles also accumulate permissions as teams add new duties. Review role membership and role permissions separately.
Attribute-Based Access Control (ABAC)
With ABAC, a policy evaluates attributes about the subject, resource, action, or environment. A rule might allow a support engineer to read a ticket only when they belong to its assigned team and are using an approved device.
ABAC can express context-sensitive rules without creating a role for every combination. Its flexibility comes with a cost: policies and attributes are harder to reason about, troubleshoot, and test. Use clear names, document important rules, and make the decision understandable to operators.
| Model | Main decision input | Useful when | Common difficulty |
|---|---|---|---|
| DAC | Resource owner’s grants | Users need to share their own resources | Access can spread beyond the intended audience |
| MAC | Central labels and classification rules | Data needs strict, centrally managed boundaries | Classification and administration can be rigid |
| RBAC | Role membership | Responsibilities map to stable job functions | Roles can become too broad or too numerous |
| ABAC | Subject, resource, action, and context attributes | Access depends on several changing conditions | Complex policies can be hard to debug |
Least Privilege and Permission Scope
Least privilege means giving an identity only the permissions needed for its current task, for only the time and scope needed. It is related to security principles and defense in depth: a narrow permission grant reduces the impact of a compromised identity, while other safeguards help catch or contain misuse.
Scope has several dimensions. A grant can be narrowed by:
- Resource: one record or bucket instead of every resource in an account.
- Action: read-only access instead of read, write, delete, and administer.
- Boundary: one project or environment instead of the whole organization.
- Time: access for a short task instead of a standing grant.
- Context: a condition such as an approved device, network, or assigned ticket.
For example, a developer investigating a production issue may need temporary read access to one service’s logs. Granting permanent administrator access to the entire production account makes the request easy to fulfill but much harder to contain if the account is misused.
Least privilege does not mean making every task painful. Start with the smallest grant that supports the work, then add a documented exception when evidence shows the task needs more. For privileged or temporary work, use a time limit and record who approved it.
Permission Review and Removal
Access changes as people change teams, projects end, and systems are replaced. A permission review checks both who has access and whether the access still matches a real need.
Review process
- Inventory identities and grants. Include user accounts, groups, roles, API keys, service accounts, and inherited permissions.
- Name an owner. Each permission set or resource should have someone who can confirm its business purpose.
- Check necessity and scope. Ask whether the identity still needs the resource and each granted action.
- Expire or remove stale access. Revoke unused grants and set an expiration when continued access is uncertain.
- Record decisions. Keep enough information to explain what was reviewed, who approved it, and what changed.
Reviews work best when they happen on a schedule and after meaningful changes, such as a team transfer, contractor departure, incident, or application retirement. A review that only confirms group membership can miss permissions granted directly to an individual or inherited from a parent scope.
Service Identities Need Least Privilege Too
Applications and automated jobs use nonhuman identities to call APIs, read secrets, write data, and deploy software. These identities are sometimes called service accounts, workload identities, or machine identities. Service identity covers their role in a larger system.
Give each workload a distinct identity where practical. A shared credential used by several jobs makes it difficult to tell which job acted and to revoke only the affected access. Scope each identity to its required resources and actions, avoid long-lived credentials when a platform can provide short-lived credentials, and assign an owner who will review its grants.
Treat identity lifecycle as part of application lifecycle. When a job is retired, remove its credentials and permissions. When a service gains a new responsibility, add the narrow required grant and document why it exists. Avoid giving a deployment pipeline broad administrator access simply because it is convenient; separate deployment permissions from routine runtime permissions when feasible.
When to Use
- Choose DAC for user-managed resources when sharing flexibility matters and resource owners understand the data.
- Choose MAC when centrally enforced classification boundaries are a core requirement.
- Start with RBAC when stable responsibilities map to a modest set of roles.
- Consider ABAC when a decision depends on conditions that would otherwise create many one-off roles.
- Apply least privilege with any model. A model does not automatically make grants narrow or current.
- Combine models only when each policy layer has a clear purpose and operators can explain the final decision.
Production Failure Scenarios
A compromised account can reach too much
A user’s account is phished. Because the account has permanent administrator access across every cloud project, the attacker can disable logging and change production resources. Short-lived elevation and project-level scope would have limited the account’s reach.
A stale role outlives a job change
An engineer moves to another team but remains in an old deployment group. The access review checks only the new team’s role, so the old permissions remain. Reviews should include direct, inherited, and group-based grants.
A shared service credential hides the source
Several batch jobs use one API key with write access to every customer record. A job begins making unexpected changes, but logs identify only the shared account. Separate workload identities and action-specific permissions make investigation and revocation more precise.
A policy is so fragmented that operators bypass it
Every exception creates another role with a slightly different name. Nobody can tell which role is appropriate, so staff request a broad “temporary” role for ordinary work. Consolidate roles around real responsibilities and reserve contextual rules for the cases that need them.
Trade-Off Table
| Access pattern | Benefit | Cost or risk | Practical guardrail |
|---|---|---|---|
| Broad administrator grants | Fast to provision and less likely to block unusual tasks | A mistake or compromise can affect many resources | Require approval, logging, and time-bound elevation |
| Very narrow one-off grants | Small blast radius | More administration and confusing exceptions | Reuse a small number of understandable role patterns |
| Many detailed roles | Fine-grained job mapping | Role sprawl and uncertain assignments | Assign role owners and remove unused roles |
| Context-heavy ABAC rules | Decisions can reflect current conditions | Difficult policy debugging | Test rules and log the reason for allow or deny |
| Permanent access | Fewer interruptions | Stale permissions accumulate | Set review dates and expiration where possible |
The right level of detail depends on the risk and operational cost. A production database deserves tighter scope than a public read-only status page. Keep the policy as simple as it can be while still expressing the boundary the system needs.
Observability Checklist
- Record which identity requested an action, what it attempted, which resource was involved, and whether the request was allowed.
- Include enough policy context to explain a decision without logging passwords, tokens, or sensitive payloads.
- Alert on unusual privilege changes, repeated denied requests, and unexpected use of administrative actions.
- Track service identity ownership, last use, credential age, and permission scope.
- Review whether audit records are retained and protected from modification by the identity being monitored.
- Make denied requests diagnosable so teams can distinguish a policy error from an application defect.
Security and Compliance Notes
Access control can support security and compliance requirements, but a role model by itself does not prove that a control is effective. Teams need evidence that access is approved, appropriate to the task, reviewed, and removed when no longer needed. Applicable rules differ by industry and jurisdiction, so map the system’s controls to the requirements that actually apply to the organization.
Separate highly sensitive duties when one person should not be able to both perform and approve a risky action. Protect audit records and restrict who can change access policies. Keep approval and review records with enough context to reconstruct decisions during an incident or audit. Avoid collecting unnecessary personal data in authorization logs.
Common Pitfalls / Anti-Patterns
- One all-powerful role: convenient at first, but every member can affect every resource.
- Shared human or service accounts: actions cannot be confidently tied to an individual or workload.
- Never-expiring exceptions: temporary access becomes permanent through inattention.
- Role names without owners: nobody knows who should confirm whether their permissions remain justified.
- Granting access at the largest scope by default: account-level grants may expose unrelated projects or data.
- Treating “authenticated” as “authorized”: a valid login still needs a permission check for each protected action.
- Unexplained denials: operators work around policies when the system cannot show which rule blocked a request.
- Removing permissions without checking dependencies: sudden revocation can break critical work; staged changes and monitoring help catch legitimate use.
Quick Recap Checklist
- Identify the subject, action, resource, and relevant context for each protected request.
- Choose an access model that matches how permissions need to be managed.
- Grant only the necessary actions at the smallest practical resource and time scope.
- Review direct, inherited, group, role, and service identity permissions.
- Log decisions so operators can explain and investigate access.
- Remove grants when a person, workload, or business need changes.
Interview Questions
Further Reading
- Security principles and defense in depth
- Threat modeling basics
- Service identity
- NIST SP 800-162: Guide to Attribute Based Access Control — a formal ABAC definition and implementation considerations.
- OWASP Authorization Cheat Sheet — practical authorization and least-privilege guidance for applications.
Conclusion
DAC, MAC, RBAC, and ABAC offer different ways to express authorization policy. None guarantees safe access on its own. Keep grants scoped to a real task, review them as people and systems change, and make decisions visible enough to investigate. That is how least privilege stays practical instead of becoming a rule that exists only on paper.
Category
Tags
Related Posts
Identity Lifecycle and Account Recovery
Learn how teams create, change, review, and retire identities, then recover accounts safely without letting attackers turn a reset into a takeover.
Injection and Broken Access Control: Practical Defenses
Learn why injection and broken access control happen, how parameterized queries and contextual encoding help, and how to verify object and action checks.
Confidentiality, Integrity, and Availability: The CIA Triad
Learn how confidentiality, integrity, and availability shape security decisions, with practical examples, trade-offs, failure scenarios, and a checklist.