Skip to main content

RBAC Is Not Enough for AI Agents: A Practical Authorization Model

· 11 min read
Tian Pan
Software Engineer

Most teams building AI agents today treat authorization as an afterthought. They wire up an OAuth token, give the agent the same scopes as the human user who triggered it, and call it done. Then, months later, they discover that a manipulated prompt caused the agent to exfiltrate files, or that a compromised workflow had been silently escalating privileges across connected services.

The problem is not that RBAC is bad. It is that RBAC was designed for humans with stable job functions, and AI agents are neither stable nor human. An agent's "role" can shift from read-only research to write-capable code execution within a single conversation turn. Static roles cannot express this, and the mismatch creates a predictable vulnerability surface.

The Principal Confusion Problem

The root issue has a name from classical security theory: the confused deputy problem. A confused deputy is a privileged program that gets tricked into misusing its authority by a less-privileged caller. For AI agents, this is not an edge case — it is the default architecture.

Here is how it typically works: a user authenticates to a platform, the platform issues an agent on the user's behalf, and that agent inherits the user's OAuth token with its full scope. The agent now has access to email, calendar, cloud storage, GitHub, and Slack — not because it needs all of it, but because the user happened to have granted all of it at some earlier point. When a prompt injection attack steers the agent toward a malicious action, the target systems see a fully authorized call. There is nothing to block because, technically, the agent has permission.

Multi-agent systems amplify this. When one orchestrator delegates subtasks to specialized agents, each hop can propagate the ambient permission set of the original user without any explicit grant review. A single compromised agent becomes a lateral movement vector across the entire graph.

The fix is conceptually simple but architecturally demanding: treat the agent as its own identity. Give it a distinct OAuth client ID. Scope its access to what the current task requires. Make that access expire when the task ends.

Why RBAC Alone Breaks Down

Role-based access control works by assigning a role to a principal, then mapping roles to permissions at provisioning time. This model fits humans well — a developer role grants read/write on repositories but not database admin. The role reflects a stable job function that changes on an organizational timescale.

AI agents operate on a different timescale. A single agent may perform read-only analysis, then propose a schema change, then execute a code deployment, all within a ten-minute task. Keeping up with these transitions via role assignment produces two failure modes:

  • Over-privileged single role: Grant one role that covers every operation the agent might ever need. This is the common path and it defeats the purpose of access control entirely.
  • Role thrashing: Swap roles at each subtask. This floods audit logs with role change events and creates race conditions in concurrent workflows.

Neither outcome is acceptable in a system where the agent can initiate writes on external services at machine velocity.

Attribute-based access control (ABAC) addresses this by moving the authorization decision to runtime. Instead of asking "what role does this principal have?", an ABAC policy engine asks "given all current context — who is requesting, what resource, under what conditions, at what time — should this action proceed?" The policy can express rules like: the agent can write to this repository only when a prior code review approval exists in the task context. RBAC cannot express that relationship; ABAC can.

The practical pattern that emerges is a hybrid: RBAC sets the outer boundary, ABAC enforces the inner constraint. An RBAC rule says agents of type "code-generation" can never delete production databases. An ABAC policy says this specific agent, for this specific task, can only read files in the /tmp directory for the next eight minutes. Neither layer alone provides the right granularity; together they cover both the structural invariants and the dynamic per-task constraints.

Minimal-Privilege Tool Scoping

Beyond the access control model itself, the tool interface is the primary place where permissions either narrow or sprawl.

The typical mistake is building broad tools. A tool called manage_github that accepts arbitrary GitHub API calls is flexible and easy to build. It is also a write-access footgun. When the agent needs to open a PR, it uses the tool. When a prompt injection tells it to delete branches, it also uses the tool — and your authorization layer never sees a permission boundary crossed.

The effective alternative is narrow tools: open_pull_request, read_file, list_open_issues. Each tool encodes a specific operation with a specific permission scope. The tool interface becomes the permission interface. An agent that only has read_file in its tool set cannot delete a branch, no matter what the prompt says, because the capability does not exist in its available action space.

Several practical principles fall out of this:

  • Default tools to read-only. Add write-capable tools only when the task explicitly requires it, and revoke them when it is done.
  • Push authorization context into the server, not the prompt. Org ID, user ID, and permission scope come from the authenticated session token on the backend — not from the agent's context window, which can be overwritten.
  • Prefer several focused tools to one generic endpoint. Three tools with one operation each are easier to audit and scope than one tool with a "mode" parameter that the agent interprets.

OWASP's Top 10 for Agentic Applications identifies tool abuse and privilege escalation as critical risks, specifically calling out agents that receive overly permissive tools and exploit them for unintended actions. The mitigation is architectural: design the tool surface to make unintended actions impossible, not just unauthorized.

Per-Task Credential Issuance

Loading…
References:Let's stay in touch and Follow me for more thoughts and updates