dmint CLI (dmint create-policy / dmint create-mcp-policy).Policy.from_mapping().{"rules": [...]}:{ "rules": [ { "effect": "allow", "tool": "postgres", "action": "query", "resource": "*" }, { "effect": "approval_required", "tool": "postgres", "action": "update", "resource": "*" }, { "effect": "deny", "tool": "postgres", "action": "drop", "resource": "*" } ] }
PolicyError: unknown policy field). Do not include metadata fields such as $schema, name, description, or policy_version in the dictionary passed to Policy.from_mapping(). If your deployment stores human metadata in policy files, that metadata must be stripped or extracted before passing the object into Policy.from_mapping().| Field | Type | Required | Description |
rules | array | Yes | Non-empty array of rule objects evaluated sequentially using fail-closed semantics. |
strict_arguments | boolean | No | Optional policy-wide flag (default false). When true, argument constraints default additionalProperties to false across all rules. |
tool_schemas | object | No | Optional mapping of <tool>.<action> capability names to pinned SHA-256 JSON Schema digests. |
rules array defines an authorization rule for an agent action:| Field | Type | Required | Description |
effect | string | Yes | Decision effect: "allow", "deny", or "approval_required". |
tool | string | Yes | Tool identifier or namespace (e.g. "postgres", "filesystem", "ledger"). |
action | string | Yes | Specific action or method name (e.g. "query", "transfer", "read"). |
resource | string | No | Targeted resource string or wildcard ("*"). Defaults to matching requests with no resource concept if omitted. |
resource_kind | string | No | Deterministic matching engine kind: "exact", "path", "url", "host", or "identifier". Defaults to "exact" if omitted. Unknown values are rejected with PolicyError. |
case_sensitive | boolean | No | Case sensitivity for resource matching (defaults to true). Only supported for "path" and "exact" kinds; rejected on "host", "url", and "identifier". Set to false on case-insensitive filesystems (macOS, Windows). |
agent_id | string | No | Optional agent identifier to restrict this rule to a specific agent identity. |
conditions | array | No | Optional trusted context conditions evaluated against environmental attributes. |
"resource": "*"): Matches any resource specified in the tool request.resource_kind: "exact" or omitted): Matches the exact string (rule == request.resource), and also supports bounded command prefix/suffix wildcards ("docker *", "rm -rf /*", "* | sh") for shell rules.resource_kind: "path"):* matches characters within a single path segment (does not cross /).** matches zero or more complete path segments across slashes (e.g. /workspace/**/*.py).? is not supported.case_sensitive=False.resource_kind: "identifier"):* matches alphanumeric and delimiter characters [A-Za-z0-9_.-]*./../, NUL byte \x00, backslash \, encoded traversal %2f/%2e%2e, userinfo in URLs), policy evaluation immediately returns DENY with code DMT_RESOURCE_INVALID before any rule matching."resource" means the rule only matches requests that have no resource concept at all. It does not mean "any resource".NaN, Infinity, -Infinity) and integers outside the IEEE 754 safe integer range ([-2^53 + 1, 2^53 - 1]) are strictly rejected with CanonicalizationError (DMT_CANONICALIZATION_ERROR). In parameter constraints (type: "integer"), whole floats like 5000.0 are rejected so integer fields require exact Python int values.{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "DmintPolicy", "type": "object", "required": ["rules"], "additionalProperties": false, "properties": { "strict_arguments": { "type": "boolean" }, "rules": { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["effect", "tool", "action"], "additionalProperties": false, "properties": { "effect": { "type": "string", "enum": ["allow", "deny", "approval_required"] }, "tool": { "type": "string", "minLength": 1 }, "action": { "type": "string", "minLength": 1 }, "resource": { "type": "string" }, "resource_kind": { "type": "string", "enum": ["exact", "path", "url", "host", "identifier"] }, "case_sensitive": { "type": "boolean", "default": true }, "agent_id": { "type": "string" }, "conditions": { "type": "array", "items": { "type": "object", "required": ["field", "operator", "value"], "additionalProperties": false, "properties": { "field": { "type": "string" }, "operator": { "type": "string", "enum": ["equals", "notEquals", "in", "contains", "startsWith", "endsWith"] }, "value": {} } } }, "constraints": { "type": "object", "additionalProperties": false, "properties": { "type": { "type": "string", "enum": ["object"] }, "required": { "type": "array", "items": { "type": "string" } }, "additionalProperties": { "type": "boolean" }, "properties": { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": false, "properties": { "type": { "type": "string", "enum": ["string", "number", "integer", "boolean", "array", "object"] }, "minimum": { "type": "number" }, "maximum": { "type": "number" }, "exclusiveMinimum": { "type": "number" }, "exclusiveMaximum": { "type": "number" }, "minLength": { "type": "integer", "minimum": 0 }, "maxLength": { "type": "integer", "minimum": 0 }, "pattern": { "type": "string" }, "enum": { "type": "array", "minItems": 1 }, "minItems": { "type": "integer", "minimum": 0 }, "maxItems": { "type": "integer", "minimum": 0 }, "items": { "type": "object" }, "required": { "type": "array", "items": { "type": "string" } }, "additionalProperties": { "type": "boolean" }, "properties": { "type": "object" } } } } } } } } } } }