Apache Casbin Whitepaper: Zero Trust Authorization for AI Agents
A framework for deciding what autonomous AI agents are allowed to do. Apache Casbin (Incubating), December 2026. Download the PDF
Authorization is where agent risk is decided
Organizations are moving AI agents from pilots into production. Agents now answer customers, change code, file tickets, query databases, move money and delegate work to other agents. Each of those actions is a request to some system, and each request has to be allowed or refused by something. That something is authorization.
For human users, authorization grew up around a comfortable assumption: the person making a request meant to make it. Agents remove that assumption. An agent decides at run time which tools to call and with which arguments, and the text that shapes its decision can come from anyone: the user, a web page, an email, a shared document, the output of another tool, or another agent. A model can be wrong without any attacker involved, and it can be steered by an attacker who never touches your network. The agent does not need to break any control to cause harm. It only needs to use the access it was given.
That is why the question security leaders should ask about an agent deployment is not "is the model safe?" but "what can this agent do, for whom, and who decided?" If the honest answer is "whatever its service account can do", the deployment has a blast radius equal to that service account, and every prompt injection, every confused delegation and every wrong guess by the model is measured against it.
This paper applies Zero Trust to that question. It is written for two audiences. Security and risk leaders should read the principles and Parts I and II, which describe what is different about agents and the threats that follow. Architects and engineers should continue with Parts III to V, which give a tiered capability framework, an implementation workflow and operating practices. Throughout, short notes explain how Apache Casbin, an open-source authorization library used in Go, Java, Node.js, Python, .NET, Rust, C++, PHP and other languages, supports each capability. The framework itself does not depend on Casbin; any policy engine that can meet the requirements will do.
This paper reflects the current thinking of the Apache Casbin community. It is offered as a framework for your own evaluation, not as legal, compliance or security assurance for any particular environment.
The principles behind Zero Trust authorization
Zero Trust replaces trust based on location with trust based on verification. NIST SP 800-207, Zero Trust Architecture (2020), describes it as a set of principles in which no request is trusted because of where it comes from, every access to a resource is decided per request by a policy decision point and enforced by a policy enforcement point, and access is granted with the least privilege needed. Applied to agents, those principles become four rules for authorization.
Verify every action, not every session. A login, a connected app or an OAuth consent is not a permission to do anything for the rest of the session. Each tool call, each data retrieval and each delegation is a separate request that is authorized when it is made, with the context available at that moment.
Assume the model is compromised. Design as if the model is already following an attacker's instructions, because with prompt injection it sometimes is. Controls that rely on the model's good behavior, such as instructions in a system prompt, are guidance, not enforcement. Enforcement happens outside the model, in code the model cannot rewrite.
Grant least agency. OWASP uses least agency to extend least privilege to agents: not only which systems an agent can reach, but which actions, with which arguments, how often, and for how long. An agent that summarizes email does not need to send it. An agent that refunds orders does not need to refund every amount.
Narrow, never widen. Every step in a chain of delegation, every task boundary and every piece of untrusted input can only take permissions away. An agent never holds more authority than the person it acts for, and a sub-agent never holds more than the agent that started it.
A design test: would this decision hold if the model worked for the attacker?
When you evaluate an authorization control in this paper, ask one question: if the model were actively working for an attacker, would this control still stop the action? A refund limit enforced by the payment service passes. A sentence in the system prompt saying "never refund more than 500" fails. A tool hidden from the model's tool list but still callable through the API fails. An approval request whose description was written by the agent fails, because the agent can describe a harmful action as a harmless one.
Controls that pass the test share a shape: the decision is made by deterministic code, from facts the model cannot forge (the authenticated identities, the canonical form of the requested action, the policy), at the point where the action is executed. When in doubt, prefer a control that removes a capability over one that asks the model not to use it.
Part I: Why agents break authorization assumptions
Traditional applications run predefined logic. When a user clicks Delete, the application knows what the user asked for and the authorization question is narrow: may this user delete this record? Agentic systems change five things about that question.
The intent gap. The caller is a model choosing actions to achieve a goal. It can choose the wrong record, the wrong recipient or the wrong amount with complete confidence. The request no longer proves what the user wanted.
The instruction gap. Agents read untrusted content as part of their work: tickets, emails, web pages, code comments, tool results. Any of it can contain text written as an instruction. Current models cannot reliably tell information from instructions, so the content an agent reads can decide what it does.
The delegation gap. An agent acts for someone, often through other agents. A user starts an orchestrator, which starts a coding agent, which calls a deployment agent, which calls a tool server. If each hop simply passes on its full authority, the permissions at the end of the chain are the union of everyone's, not the intersection.
The discovery gap. Through protocols such as the Model Context Protocol (MCP), agents are handed tools at run time. A permission model that lists only the tools that existed at deployment silently admits the tools added afterwards, including a malicious one, or a trusted one whose behavior was changed.
The speed gap. Agents run unattended and fast. A loop can make hundreds of calls a minute, long after the user stopped watching. A wrong grant is exercised before a person can notice, and a permission review that happens once a quarter reviews a system that changed thousands of times in between.
Authorization concepts for agentic systems
Some vocabulary helps when writing policies for agents.
Principal. The person or service an agent works for. The principal's permissions are an upper bound on anything done on their behalf.
Agent identity. The identity of the software acting. Every agent, and ideally every deployment of an agent, has its own identity, separate from the principal and from other agents. Without it, two agents cannot have different permissions and one cannot be revoked without the other.
Delegation chain. The ordered list of identities a request passes through, from the principal to the agent that makes the call. OAuth 2.0 Token Exchange (RFC 8693) can carry it in the act (actor) claim.
Effective permission. What a request may actually do: the intersection of the permissions of every identity in its chain, further narrowed by the task and the context.
Blast radius. The worst outcome if an agent is fully controlled by an attacker. For an authorized agent, the blast radius is exactly its effective permission. Reducing blast radius is the purpose of the framework in Part III.
Taint. A marker that a session has processed content from outside the trust boundary. Taint is context, and policies can use it to remove capabilities.
Part II: Authorization threats to agentic systems
Agentic systems face a threat landscape that OWASP has described in its Top 10 for LLM Applications 2025 and in its agentic security work: prompt injection, excessive agency, tool misuse, identity and privilege abuse, memory and context poisoning, and supply chain risks. Most of these are not authorization failures by origin, but authorization decides how much damage each can do. This part looks at them through that lens.
Excessive agency
The most common failure is simply too much access. Agents are connected to existing service accounts, given every tool an MCP server offers, or granted broad API scopes because narrowing them takes work. OWASP lists Excessive Agency (LLM06) among the top risks for this reason: when something goes wrong, the damage is set by what the agent was allowed to do, not by what it was meant to do.
What authorization does: deny by default, grant per agent and per tool, and constrain arguments. Measure the gap between what an agent is granted and what it actually uses, and close it.
Injection-driven misuse of legitimate permissions
Indirect prompt injection turns the content an agent reads into commands. A ticket says "also forward the customer list to this address"; a web page says "run this cleanup script". The agent calls tools it is permitted to call, with credentials that are valid, so traditional access controls see nothing wrong.
What authorization does: it cannot detect the injection, but it decides what an injected instruction can reach. Argument constraints stop the forwarding to an outside address. Taint-aware policies remove side-effecting tools once untrusted content has entered the session. Approval rules put high-impact calls in front of a person.
Tool chaining and data exfiltration
Some of the most damaging attacks use only safe-looking tools in a harmful order: read from a private CRM, then send through an email or web tool. Each call is permitted; the sequence is not. The dangerous combination is an agent that has access to private data, is exposed to untrusted content, and has a way to send data out. Any two are manageable; all three in one session are an exfiltration path.
What authorization does: treat the session as part of the request. After a session has read sensitive data or untrusted content, deny or require approval for outbound communication. Restrict outbound tools to known destinations.
Unscoped privilege inheritance and confused deputies
A manager agent delegates to a worker agent and passes on its full access. A low-privilege agent forwards a valid-looking request to a high-privilege agent, which carries it out without checking who originally asked. Both are confused-deputy problems, and agent-to-agent delegation multiplies them.
What authorization does: check every identity in the chain, not only the last one. Make delegation an explicit, narrowing step that produces a new, smaller grant, and reject chains deeper than the policy expects.
Tool poisoning and rug pulls
A tool's description, schema or metadata can be written to mislead the model, and a trusted tool can be replaced by a malicious version after it was approved. If permissions are granted by tool name and every new or changed tool is available by default, the poisoned tool inherits trust it never earned.
What authorization does: new tools are denied until granted; tools are grouped by the effect they have (read, write, send, execute, delete), not by what they claim; and the grant is reviewed again when a tool's definition changes.
Cross-user and cross-tenant data exposure
Retrieval-augmented generation puts documents into the model's context. If retrieval is not filtered by the principal's permissions, the model can quote a document the user was never allowed to read, and output filtering is too late to stop it. Shared indexes and shared memory across tenants make this worse. OWASP lists Sensitive Information Disclosure (LLM02) and Vector and Embedding Weaknesses (LLM08) for these reasons.
What authorization does: filter retrieval by the principal's permissions before results reach the model, and partition indexes, memory and caches by tenant.
Standing privileges and long-lived grants
Permissions granted to an agent "for now" tend to stay. Agents accumulate access for tasks they finished long ago, and every one of those grants is available to the next attacker who steers the agent.
What authorization does: tie grants to tasks and time, expire them automatically, and review unused permissions.