Apache Casbin Gateway
4. Governance

4.1 Permissions

Permissions is every agent on this machine down one side, and what the one you picked may do beside it. The same card is on the agent's own page.

An agent can be given less than it came with, without editing its own configuration.

Permissions

Tools

Around forty switches, in six groups:

GroupCovers
The terminalRunning a command, reading a running command's output, stopping one — three separate switches
Reading the projectFile reads, listings, search
Changing the projectWrites, edits, deletions
The internetFetching pages, web search
Planning and delegationTask planning, sub-agents
MCPOne switch per MCP server that agent has installed
  • The switch on a group's header sets the whole group at once; open the group and the answer gets as fine as you like.
  • A tool whose switch is off is taken out of the request before it leaves this machine, so the model is never offered it and the agent never gets to call it.
  • Every agent names its tools differently. Bash, shell and run_shell_command are all the same switch.
  • Each group ends in a catch-all for tools Gateway has never seen, which is what closes a group for good rather than only for the tools that happened to be listed the day it was set.

Models

Any model, only the ones you pick, or all but them. A name may end in *, so claude-opus-* covers a whole family.

Providers

Which of the providers this agent's requests may be sent to.

What a refusal looks like

A request that asks for something switched off comes back as a permission_error in the API the agent speaks, so it reads as a refusal rather than as a broken gateway.

Where the rules are enforced

Two enforcement points, and the page says which one an agent is in:

AgentToolsModels and providers
Routed through Gateway (3.2)Taken out of the relayed requestEnforced on every request
Not routed, but monitored (2.3)Refused by the hook Gateway installed, before the tool runsNot enforced — nothing passes through Gateway to hold
Neither——

Underneath: Casbin

The switches compile to a Casbin policy, and every relayed request is decided by an enforcer rather than by a hand-written check.

Advanced shows the model.conf and policy.csv they compile to, and takes extra policy lines of your own:

p, claude-code, model:claude-opus-*, use, deny
p, claude-code, model:*, use, allow
p, claude-code, tool:shell/run, use, deny
p, claude-code, tool:mcp/github, use, allow
p, claude-code, tool:mcp/*, use, deny
p, claude-code, tool:*, use, allow

The first rule that matches decides, which is what lets one exception stand in front of the rule behind it: every MCP server taken away except the one that stays.

The lines you write yourself are checked before the ones the switches wrote.

Next: 4.2 LLM Records.

Edit on GitHub
Apache Incubator

Apache Casbin (Incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Copyright © 2026 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

Apache, Apache Casbin, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

On this page