Policies
Policies are the core of Igris governance. Each policy contains an ordered list of rules evaluated against incoming MCP requests and LLM requests. The first matching rule determines the action.Concepts
A policy is attached to one or more connections and contains:- Name — human-readable label
- Connections — which connection(s) this policy applies to (
connectionSlugs).nullmeans org-wide: it applies to every connection. - Rules — ordered list of rules (at least one)
- Enabled — whether the policy is active
- Target — what to match (MCP tool name, LLM model, or LLM endpoint)
- Action — what to do when the target matches:
allow,deny,alert, orredact - Conditions (optional) — attribute-based gates on user identity or metadata
- Rate limit (optional, LLM rules only) — cap requests, tokens, or dollars per time period
- Token guard (optional, LLM rules) — cap input tokens or
max_tokensper request - Content guard (optional) — run detectors on request or response content
Rule Targets
Thetarget.kind field is the discriminator. Three variants are supported:
MCP tool glob matching
MCP tool targets use glob-style patterns with* as a wildcard:
LLM model glob matching
Themodel field also supports * as a wildcard:
Rule Evaluation: First Match Wins
Rules are evaluated top to bottom. The first rule whose target matches (and whose conditions pass) determines the action. Remaining rules are skipped. When several enabled policies apply to a connection, their rules are joined into one list: policies scoped to that connection come first, then org-wide policies. Within each group, older policies come first. A request is checked against that combined list in order. Igris evaluates these MCP methods:tools/call (matched on the tool name), resources/read (matched as resource://<uri>), and sampling/createMessage (matched as sampling:createMessage). Other methods, such as tools/list, are not policy-checked. LLM gateway requests are matched on the model and endpoint.
delete_users→ denied (matches rule 1)drop_table→ denied (matches rule 2)write_record→ allowed + alert sent (matches rule 3)read_data→ allowed (matches catch-all rule 4)
Actions
Allow
The request is forwarded to the upstream server or provider. An audit event is logged.Deny
The request is blocked and an audit event is logged with the denial reason. The caller sees:- MCP: a JSON-RPC error with code
-32001and messagePolicy denied: <reason>, returned with HTTP 200. See Tool Calls. - LLM gateway: HTTP
403with{ "error": { "message": "Policy denied: <reason>", ... } }.
Alert
The request is forwarded, same as allow. Igris also logs it as an alert and sends the Policy Denials webhook event (policy_deny) to webhooks subscribed to it. Alert does not emit the anomaly SSE event; that comes only from anomaly detection.
Redact
Redact needs acontentGuard on the rule. The configured detectors run over the request, and matched content is replaced with [REDACTED:<detector-id>] before the request is forwarded. The request is never blocked by redact. For MCP, Igris redacts the tool call’s arguments. If the rule has no content guard, or nothing matches, the request passes unchanged. The audit event records what was redacted. See Guards.
Conditions (Attribute-Based Access Control)
Rules can include conditions that match against user identity and request metadata. A rule with conditions only applies when all conditions are met. Only two kinds of condition field exist:user and metadata.<key>. Condition values are strings.
Example: Block destructive ops for interns
delete_* and drop_* calls only when metadata.role is "intern". Admins and developers can still use these tools.
Condition Fields
Any other field, such as
traceId or connectionSlug, is rejected with a 422 when you create a policy or change a rule. To scope a policy to a connection, set the policy’s connections instead of using a condition.
If a legacy policy already contains an unsupported field, that rule is never applied. The policy editor flags it and blocks saving until you replace or remove it.
Metadata keys sent as individual
X-Igris-Metadata-<Key> headers are lowercased by the gateway, so write the condition as metadata.<key> in lowercase (header X-Igris-Metadata-Role becomes metadata.role). Keys inside the X-Igris-Metadata JSON header keep their case, and the JSON header is ignored if any key contains a dot. Number and boolean values are compared as strings (true, 42). Comparisons are case-sensitive.Condition Operators
Missing Fields
If a condition references a field that isn’t present in the request, the rule is skipped — it does not deny or allow. Evaluation continues to the next rule.Rate Limits
Rate limits apply to LLM rules only (llm_model and llm_endpoint targets), and are enforced by the LLM gateway. The API rejects a limit on an mcp_tool rule with a 422: Rate limits apply to LLM rules only; remove "limit" from MCP tool rules. MCP traffic is only subject to the gateway-wide request limit; see Limits & errors.
A limit caps requests, tokens, or dollars over a minute, hour, or day:
per is required. Set any combination of the other three fields:
When a limit is exceeded, the gateway returns HTTP
429 with Rate limit exceeded: <reason> and logs the request as denied. This happens regardless of the rule’s action.
How the counters work:
- Windows are fixed and aligned to the clock (for example,
per: "minute"resets at the start of each minute). They are not rolling windows. - Counters are kept in Redis, per organization, per connection, per
<target>:<action>pair. Rules with the same target and action share a counter, even across policies. - Requests are counted before forwarding, so failed upstream calls still use quota.
- Token limits reserve an estimate before the call and are reconciled to actual usage afterward. Dollar limits are checked against spend recorded so far, so concurrent calls can overshoot a dollar cap.
Token Guards and Content Guards
Token guards cap the size of LLM requests before they are forwarded. Content guards run detectors on request content and, optionally, on responses. Both are documented on the Guards page.Creating Policies
- Go to Govern → Policies in the dashboard
- Click New Policy
- Choose the connection(s), or leave it org-wide
- Add rules in priority order (with optional conditions)
- Save
policies:write permission to create or edit policies (Owner, Admin, Developer, and CISO roles by default). See Permissions.
Policy Caching
Active policies are cached in Redis for 30 seconds. Creating or updating a policy invalidates the cache. On a cache miss, policies are loaded from the database and re-cached. Disabled policies are not evaluated.Best Practices
- Start restrictive — begin with deny-all, then add specific allows as needed.
- Use alert for new tools — when a new MCP tool appears, set it to alert before deciding on allow/deny.
- Group by risk — create separate policies for different risk levels (e.g., read-only vs. write operations).
- Use rate limits on expensive LLM traffic — cap requests, tokens, or dollars per model to contain runaway agents. For runaway MCP agents, use anomaly detection and the session kill switch.
- Review audit events — regularly check denied and alerted calls to refine your policies.
Related
- Guards — token guards and content guards
- Sessions — session lifecycle and kill switch
- Anomaly Detection — automatic detection for MCP and LLM traffic
- Limits & errors — gateway rate limits and error formats
- Identity & Metadata — passing user and metadata context