DENY).DENY rules take precedence over ALLOW and APPROVAL_REQUIRED.resource_kind: "path").┌────────────────────────────────────────────────────────────────────────┐ │ Dmint Policy Templates │ ├───────────────┬───────────────────┬───────────────────┬────────────────┤ │ Template │ Allowed (Read) │ Approval Required │ Denied (Risky) │ ├───────────────┼───────────────────┼───────────────────┼────────────────┤ │ shell │ git, tests, ls │ systemctl, docker │ rm -rf /, dd │ │ filesystem │ src/*, docs/* │ write_file, mkdir │ .env*, /etc/* │ │ postgres │ SELECT, EXPLAIN │ INSERT, UPDATE │ DROP, TRUNCATE │ │ github │ list_issues, PRs │ create_pr, merge │ delete_repo │ │ stripe │ list_customers │ charges, refunds │ payouts, keys │ │ aws │ describe, list │ start/stop, s3:put│ delete_bucket │ │ kubernetes │ get_pods, logs │ scale, rollout │ delete_cluster │ └───────────────┴───────────────────┴───────────────────┴────────────────┘
shell)allow: Safe read-only inspection commands (git status, git diff, git log, npm test, pytest, cargo test, ls, pwd).approval_required: System mutations and service changes (systemctl *, docker *, kill *, npm install *).deny: Catastrophic and unconstrained commands (rm -rf /*, mkfs *, dd *, * | sh, * | bash).{ "rules": [ { "effect": "allow", "tool": "shell", "action": "execute", "resource": "git status", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "git diff", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "git log", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "npm test", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "pytest", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "cargo test", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "ls", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "ls *", "resource_kind": "exact" }, { "effect": "allow", "tool": "shell", "action": "execute", "resource": "pwd", "resource_kind": "exact" }, { "effect": "approval_required", "tool": "shell", "action": "execute", "resource": "git push *", "resource_kind": "exact" }, { "effect": "approval_required", "tool": "shell", "action": "execute", "resource": "systemctl *", "resource_kind": "exact" }, { "effect": "approval_required", "tool": "shell", "action": "execute", "resource": "docker *", "resource_kind": "exact" }, { "effect": "approval_required", "tool": "shell", "action": "execute", "resource": "kill *", "resource_kind": "exact" }, { "effect": "approval_required", "tool": "shell", "action": "execute", "resource": "npm install *", "resource_kind": "exact" }, { "effect": "approval_required", "tool": "shell", "action": "execute", "resource": "pip install *", "resource_kind": "exact" }, { "effect": "deny", "tool": "shell", "action": "execute", "resource": "rm -rf /", "resource_kind": "exact" }, { "effect": "deny", "tool": "shell", "action": "execute", "resource": "rm -rf /*", "resource_kind": "exact" }, { "effect": "deny", "tool": "shell", "action": "execute", "resource": "mkfs *", "resource_kind": "exact" }, { "effect": "deny", "tool": "shell", "action": "execute", "resource": "dd *", "resource_kind": "exact" }, { "effect": "deny", "tool": "shell", "action": "execute", "resource": "* | sh", "resource_kind": "exact" }, { "effect": "deny", "tool": "shell", "action": "execute", "resource": "* | bash", "resource_kind": "exact" } ], "strict_arguments": false }
filesystem)allow: Reading project code and documentation (src/*, docs/*, tests/*, list_directory).approval_required: Writing code in src/*, creating directories, deleting files.deny: Reading or writing secrets (.env*, *.key, *.pem, /etc/*).{ "rules": [ { "effect": "allow", "tool": "filesystem", "action": "read_file", "resource": "src/*", "resource_kind": "path" }, { "effect": "allow", "tool": "filesystem", "action": "read_file", "resource": "docs/*", "resource_kind": "path" }, { "effect": "allow", "tool": "filesystem", "action": "read_file", "resource": "tests/*", "resource_kind": "path" }, { "effect": "allow", "tool": "filesystem", "action": "list_directory", "resource": "*", "resource_kind": "path" }, { "effect": "approval_required", "tool": "filesystem", "action": "write_file", "resource": "src/*", "resource_kind": "path" }, { "effect": "approval_required", "tool": "filesystem", "action": "create_directory", "resource": "*", "resource_kind": "path" }, { "effect": "approval_required", "tool": "filesystem", "action": "delete_file", "resource": "*", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "read_file", "resource": ".env*", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "read_file", "resource": "*/.env*", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "read_file", "resource": "*.key", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "read_file", "resource": "*.pem", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "read_file", "resource": "/etc/*", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "write_file", "resource": ".env*", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "write_file", "resource": "*/.env*", "resource_kind": "path" }, { "effect": "deny", "tool": "filesystem", "action": "write_file", "resource": "/etc/*", "resource_kind": "path" } ], "strict_arguments": false }
postgres)allow: Read-only queries (select, explain, show, describe).approval_required: Data mutations (insert, update, delete) and schema changes (create_table, alter_table).deny: Destructive and privilege-escalating commands (drop_table, drop_database, truncate, grant).{ "rules": [ { "effect": "allow", "tool": "postgres", "action": "select", "resource": "*" }, { "effect": "allow", "tool": "postgres", "action": "explain", "resource": "*" }, { "effect": "allow", "tool": "postgres", "action": "show", "resource": "*" }, { "effect": "allow", "tool": "postgres", "action": "describe", "resource": "*" }, { "effect": "approval_required", "tool": "postgres", "action": "insert", "resource": "*" }, { "effect": "approval_required", "tool": "postgres", "action": "update", "resource": "*" }, { "effect": "approval_required", "tool": "postgres", "action": "delete", "resource": "*" }, { "effect": "approval_required", "tool": "postgres", "action": "create_table", "resource": "*" }, { "effect": "approval_required", "tool": "postgres", "action": "alter_table", "resource": "*" }, { "effect": "deny", "tool": "postgres", "action": "drop_table", "resource": "*" }, { "effect": "deny", "tool": "postgres", "action": "drop_database", "resource": "*" }, { "effect": "deny", "tool": "postgres", "action": "truncate", "resource": "*" }, { "effect": "deny", "tool": "postgres", "action": "grant", "resource": "*" } ], "strict_arguments": false }
github)allow: Inspecting repos, issues, PRs, commits, and code search (get_repository, list_issues, get_pull_request, search_code, list_commits).approval_required: Interacting with collaborators (create_issue, create_pull_request, create_issue_comment, merge_pull_request, close_issue).deny: Irreversible administrative actions (delete_repository, delete_branch, remove_branch_protection, force_push, delete_release).{ "rules": [ { "effect": "allow", "tool": "github", "action": "get_repository", "resource": "*" }, { "effect": "allow", "tool": "github", "action": "list_issues", "resource": "*" }, { "effect": "allow", "tool": "github", "action": "get_issue", "resource": "*" }, { "effect": "allow", "tool": "github", "action": "list_pull_requests", "resource": "*" }, { "effect": "allow", "tool": "github", "action": "get_pull_request", "resource": "*" }, { "effect": "allow", "tool": "github", "action": "search_code", "resource": "*" }, { "effect": "allow", "tool": "github", "action": "list_commits", "resource": "*" }, { "effect": "approval_required", "tool": "github", "action": "create_issue", "resource": "*" }, { "effect": "approval_required", "tool": "github", "action": "create_issue_comment", "resource": "*" }, { "effect": "approval_required", "tool": "github", "action": "create_pull_request", "resource": "*" }, { "effect": "approval_required", "tool": "github", "action": "merge_pull_request", "resource": "*" }, { "effect": "approval_required", "tool": "github", "action": "close_issue", "resource": "*" }, { "effect": "deny", "tool": "github", "action": "delete_repository", "resource": "*" }, { "effect": "deny", "tool": "github", "action": "delete_branch", "resource": "*" }, { "effect": "deny", "tool": "github", "action": "remove_branch_protection", "resource": "*" }, { "effect": "deny", "tool": "github", "action": "force_push", "resource": "*" }, { "effect": "deny", "tool": "github", "action": "delete_release", "resource": "*" } ], "strict_arguments": false }
stripe)allow: Safe customer, charge, invoice, and catalog queries (list_customers, retrieve_customer, list_charges, list_invoices, list_products).approval_required: Billing actions (create_customer, create_charge, create_refund, update_subscription, cancel_subscription).deny: Payout draining and API key generation (create_payout, update_payout, delete_account, create_secret_key, expire_secret_key).aws)allow: State inspections (s3.list_buckets, s3.get_object, ec2.describe_instances, ec2.describe_security_groups, cloudwatch.get_metric_data).approval_required: Resource operations (s3.put_object, ec2.start_instances, ec2.stop_instances, lambda.update_function_code, iam.create_role).deny: High-impact deletions (s3.delete_bucket, ec2.terminate_instances, rds.delete_db_instance, iam.delete_role_policy, organizations.leave_organization).kubernetes)allow: Cluster telemetry and diagnostics (get_pods, list_pods, get_services, get_deployments, get_logs, describe_pod).approval_required: Workload updates (scale_deployment, rollout_restart, apply_manifest, create_configmap).deny: Cluster-level destruction (delete_namespace, delete_node, delete_cluster, delete_deployment).dmint.templates:from dmint.templates import list_templates, get_template_policy, get_template_dict # 1. Discover available templates templates = list_templates() print("Available templates:", templates) # Output: ['aws', 'filesystem', 'github', 'kubernetes', 'postgres', 'shell', 'stripe'] # 2. Load as a validated Policy object policy = get_template_policy("postgres") print(f"Loaded {len(policy.rules)} rules") # 3. Use directly with Dmint engine from dmint import Dmint dmint = Dmint.local(policy)
from dmint.templates import deduplicate_policy_dict, deduplicate_policy_rules # Deduplicate raw JSON dictionary: clean_dict = deduplicate_policy_dict(raw_policy_dict) # Or deduplicate an immutable Policy instance: clean_policy = deduplicate_policy_rules(policy)
tool, action, agent_id, resource, resource_kind, conditions, constraints).