Glossary · R

Role-Based Access Control (RBAC)

Access control model in which permissions are assigned to roles and users receive permissions only through the roles they hold.

By Obseria TeamUpdated

Definition

Role-based access control (RBAC) is an access control model in which permissions are bundled into roles that reflect job functions, and users or service accounts are assigned to those roles instead of receiving permissions directly. A user can do exactly what the roles assigned to them allow. RBAC makes access easier to grant, review and revoke, and it is a common way to implement least privilege in applications, cloud platforms and Kubernetes.

What is RBAC?

Role-based access control answers the question "who may do what" with an intermediate layer: the role. Instead of giving Alice read access to ten dashboards and edit access to three alert rules, you define a role such as on-call engineer, attach the permissions to the role and assign Alice to it. When Alice changes teams, you change one assignment, not dozens of individual rights.

The model was formalised by David Ferraiolo and Richard Kuhn at NIST in the early 1990s and later standardised as ANSI/INCITS 359. Today it is the default model in most business software, in cloud IAM systems and in Kubernetes.

Core concepts

  • Users and subjects: people, but also service accounts, API keys and workloads.
  • Permissions: an allowed operation on a resource, for example read on dashboards or delete on pods in a namespace.
  • Roles: named sets of permissions that match a job function, such as viewer, editor, admin or billing manager.
  • Assignments: the link between a subject and a role, often scoped to a project, team or namespace.
  • Role hierarchies: a senior role can inherit the permissions of a junior role, for example admin includes editor.
  • Separation of duties: constraints that prevent one person from holding conflicting roles, such as creating and approving a payment.

The important property is that permissions are never granted to users directly. Every right can be explained by a role, which makes reviews and audits far simpler.

RBAC compared with other models

ModelAccess decided byStrengthsWeaknesses
Access control lists (ACL)A list of subjects per resourceSimple, precise for single objectsHard to review across many resources
RBACRoles assigned to subjectsEasy to understand, review and auditRoles multiply when every exception becomes a role
Attribute-based (ABAC)Attributes of user, resource and contextFine-grained, context awarePolicies are harder to read and test
Relationship-based (ReBAC)Relationships such as owner or member ofFits sharing and collaboration featuresNeeds a dedicated authorization service

In practice these models are combined. A cloud platform may use roles as the base and add conditions, such as region or resource tags, on top.

RBAC in Kubernetes

Kubernetes has RBAC built in through the rbac.authorization.k8s.io API. A Role defines permissions in one namespace, a ClusterRole applies cluster-wide or can be reused in many namespaces, and a RoleBinding or ClusterRoleBinding assigns them to users, groups or service accounts. Permissions are purely additive: there are no deny rules. The following binding gives a CI service account the built-in edit ClusterRole, but only in the checkout namespace:

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: ci-deployer
  namespace: checkout
subjects:
- kind: ServiceAccount
  name: ci-deployer
  namespace: ci
roleRef:
  kind: ClusterRole
  name: edit
  apiGroup: rbac.authorization.k8s.io

To check what a subject may do, ask the API server directly:

kubectl auth can-i delete pods -n checkout \
  --as=system:serviceaccount:ci:ci-deployer
kubectl auth can-i --list -n checkout \
  --as=system:serviceaccount:ci:ci-deployer

Every pod runs under a service account, so RBAC also decides what a compromised container could do with the Kubernetes API.

RBAC in your own applications

Inside an application, RBAC usually starts as a mapping from roles to permissions. The important design choice is to check permissions in code, not role names. Code that asks "is this user an admin?" has to change every time the role model changes; code that asks "may this user edit alert rules?" does not.

ROLE_PERMISSIONS = {
    "viewer": {"dashboard:read", "alert:read"},
    "editor": {"dashboard:read", "dashboard:write", "alert:read", "alert:write"},
    "admin":  {"dashboard:read", "dashboard:write", "alert:read", "alert:write",
               "user:manage", "apikey:manage"},
}

def can(user, permission):
    return any(permission in ROLE_PERMISSIONS[r] for r in user.roles)

if not can(current_user, "alert:write"):
    audit_log("denied", current_user.id, "alert:write")
    raise Forbidden()

A few rules keep such a model safe. Deny by default, so a missing entry never grants access. Enforce every check on the server, never only by hiding buttons in the interface. Scope assignments, for example to a team or project, so that an editor in one team is not automatically an editor everywhere. And log denied requests, because they show both misconfigured roles and attempts to reach data that a user should not see.

Common mistakes

  • Role explosion: a new role for every exception until nobody understands the set. Prefer a small number of roles plus scoping by team or project.
  • Admin by default: giving new users or service accounts the most powerful role to avoid support requests. In Kubernetes, bindings to cluster-admin are the classic case.
  • Wildcards: rules with verbs: ["*"] or resources: ["*"] that silently include future resources.
  • Dangerous permissions hidden in harmless roles: in Kubernetes, rights such as creating pods, reading secrets or the escalate, bind and impersonate verbs can enable privilege escalation.
  • Roles for individuals: a role named after a person is a direct permission in disguise.
  • No reviews: assignments accumulate as people change jobs, a pattern known as privilege creep.

Best practices

  • Start from job functions and tasks, not from the org chart, and keep the number of roles small.
  • Apply least privilege: the default role should be read-only, with write and admin rights granted deliberately.
  • Use groups from your identity provider for assignments, so leaving the company or a team removes access automatically.
  • Give every application and script its own service account or API key, with its own narrow role.
  • Manage roles and bindings as code with infrastructure as code, so changes go through review.
  • Review assignments regularly and remove roles that have not been used.
  • Log every role assignment, every permission change and every denied request.

The observability perspective

RBAC is only as good as the evidence that it works. Audit logs show which roles were assigned and changed, and access logs show which permissions are actually used. Denied requests are particularly useful: a sudden spike of 403 responses after a deployment usually means a missing permission, while repeated denials for one identity across many resources can point to probing with stolen credentials. Feeding these events into a SIEM lets teams correlate them with other signals and with the ideas of zero trust, where every request is checked.

How Obseria helps

Obseria does not manage permissions in your own systems, but it helps you check them and applies RBAC to itself. Cloud security posture management checks AWS, Azure and Google Cloud accounts for misconfigurations such as overly broad access rights, and IaC security reviews Terraform and Kubernetes manifests for insecure configuration before deployment. For access to Obseria, access control and SSO provides roles, permissions, teams and sign-in with your company login, plus API keys for scripts and integrations. The audit trail records who changed what and when.

Frequently asked questions

RBAC grants permissions through roles assigned to users. ABAC evaluates attributes of the user, the resource and the context, such as department, data classification or time of day. ABAC is more flexible, RBAC is easier to understand and review. Many systems combine both.

No. Least privilege is a principle, RBAC is a mechanism. RBAC can implement least privilege if roles are narrow and assignments are reviewed, but broad roles undermine it.

Role explosion happens when every special case leads to a new role, until there are more roles than anyone can manage. Scoping roles to projects or namespaces and adding attributes for exceptions keeps the number manageable.

No. Kubernetes RBAC rules are purely additive. A subject can do everything that any of its bindings allow. Restrictions beyond that require admission control or policy engines.

List roles and assignments, compare them with actual usage from audit and access logs, and remove what is unused. In Kubernetes, kubectl auth can-i --list shows the effective permissions of a subject in a namespace.

No. Single sign-on proves who someone is. Roles and permissions inside each application still decide what that person may do. Group information from the identity provider is often used to assign roles.

Put these concepts into practice

Try Obseria free for 14 days, with OpenTelemetry and no proprietary agents.