The Apache Casbin community has published a whitepaper, Zero Trust Authorization for AI Agents. It is a framework for security leaders and architects, and it does not depend on Casbin. This post summarizes the framework and then walks through the reference policy in its appendix, which you can run with any Casbin implementation.

Full paper: https://casbin.apache.org/docs/ai-agent-authorization-whitepaper (29-page PDF: https://casbin.apache.org/files/apache-casbin-zero-trust-authorization-for-ai-agents.pdf)

The problem

Authorization for people assumes the person making a request meant to make it. An agent decides at run time which tools to call and with which arguments, and the text shaping that decision can come from a ticket, an email, a web page or another agent. The agent does not need to break any control to cause harm. It only needs to use the access it was given.

The framework in one screen

  • Four principles: verify every action, not every session; assume the model is compromised; grant least agency; narrow, never widen.
  • A design test: if the model were working for an attacker, would this control still stop the action? A limit in the system prompt fails. A limit enforced where the action executes passes.
  • Five gaps: intent, instruction, delegation, discovery, speed.
  • Eight threat classes seen through authorization: excessive agency, injection-driven misuse of legitimate permissions, tool chaining and exfiltration, confused deputies, tool poisoning and rug pulls, cross-tenant exposure, standing privileges, policy tampering and approval manipulation.
  • Ten capability areas at three tiers (Essential, Managed, Adaptive), from agent identity and delegation to tool and argument authorization, human approval, decision logging and revocation.
  • A seven-phase rollout and operating practices, mapped to NIST SP 800-207, OWASP, the MCP authorization spec, RFC 8693, RFC 9396 and the EU AI Act.

Three terms matter when you write policy. Effective permission is the intersection of the permissions of every identity in the delegation chain, narrowed further by task and context. Blast radius is the worst outcome if the agent is fully controlled by an attacker; for an authorized agent it equals its effective permission. Taint marks a session that has processed content from outside the trust boundary.

The reference policy

A request carries four fields: subject, tool, arguments and context.

[request_definition] r = sub, tool, args, ctx [policy_definition] p = sub, tool, cond, eft [role_definition] g = _, _ g2 = _, _ [policy_effect] e = some(where (p.eft == allow)) && !some(where (p.eft == deny)) [matchers] m = g(r.sub, p.sub) && (globMatch(r.tool, p.tool) || g2(r.tool, p.tool)) && (p.cond == '' || eval(p.cond)) 
p, support-agent, tickets.*, , allow p, support-agent, orders.read, , allow p, support-agent, orders.refund, r.args.amount <= 500, allow p, support-agent, email.send, r.args.to_domain == 'example.com', allow p, any-agent, shell.*, , deny p, any-agent, *.delete, , deny p, any-agent, side-effect, r.ctx.untrusted_input, deny p, support-staff, tickets.*, , allow p, support-staff, orders.*, , allow p, support-staff, email.send, , allow p, approval-required, orders.refund, r.args.amount > 100, allow p, approval-required, email.send, , allow g, support-agent, any-agent g, alice, support-staff g2, orders.refund, side-effect g2, email.send, side-effect 

What each part does:

  • support-agent is the agent's own role, separate from the role of alice, the employee it works for.
  • Refund limits and recipient domains are argument conditions in policy, not sentences in a prompt.
  • Deny rules on any-agent, with the deny-override effect, are guardrails no grant can get around. Nobody granted shell.*, so it is denied by default anyway.
  • g2 groups the tools with side effects. Once the session has read untrusted content, the whole group is withdrawn; read-only tools keep working.
  • approval-required decides from policy which actions a person must confirm, so the agent never gets to describe its own approval request.

The decisions

An action is checked for every identity in the chain (alice, then her support agent). If all allow it, the approval-required rules decide whether a person must confirm it.

Action by alice's support agent Untrusted input Decision
tickets.read no allow
orders.refund, 80 no allow
orders.refund, 240 no approval required
orders.refund, 900 no deny: exceeds the agent's limit
orders.refund, 80 yes deny: side effects after untrusted input
email.send to example.com no approval required
email.send to attacker.test no deny: outside domain
shell.exec no deny: no one granted it
tickets.read yes allow

The paper ran this with pycasbin; the Go implementation gives the same nine decisions. Two things to notice: a 900 refund is refused even though alice herself may refund it, because effective permission is an intersection; and after untrusted input the same 80 refund is refused while reading tickets still works, because untrusted input can only take capabilities away.

To wire a model like this into an agent loop and an MCP server, see the hands-on guide: https://casbin.apache.org/docs/ai-agent-authorization

Apache Casbin (Incubating) is an open-source authorization library under the Apache License 2.0, with implementations in Go, Java, Node.js, Python, .NET, Rust, C++, PHP and more: https://github.com/apache/casbin