UID) that owns your Ed25519 private signing key (signing.key) or writable policy.json. In production, separate the AI Agent (Zone 1), the Dmint Enforcement Gate (Zone 2), and the Human Approval Authority (Zone 3).╔══════════════════════════════════════════════════════════════════════════════╗ ║ ZONE 1: UNTRUSTED AI AGENT SANDBOX (OS User: ai-agent / Container A) ║ ║ ║ ║ • Runs Claude Code, Codex, OpenCode, Cursor, or LangChain/CrewAI agent ║ ║ • Holds ZERO private keys (no signing.key) ║ ║ • Holds ZERO downstream API secrets (no raw DB passwords or Stripe keys) ║ ║ • Cannot write to policy.json, .dmint/policies/*.json, or hook configs ║ ║ (enforced via root ownership + chmod 0444 + chattr +i or Docker :ro) ║ ╚══════════════════════════════════════╦═══════════════════════════════════════╝ │ │ Tool Call (PreToolUse Hook / MCP RPC) ▼ ╔══════════════════════════════════════════════════════════════════════════════╗ ║ ZONE 2: DMINT ENFORCEMENT GATE (OS User: dmint-gate / Container B) ║ ║ ║ ║ • Evaluates immutable policy.json (pinned via DMINT_EXPECTED_POLICY_DIGEST) ║ ║ • Verifies MCP tool schemas (pinned via SHA-256 schema_hash) ║ ║ • Holds ONLY the Ed25519 PUBLIC Key (public_key_hex in trusted_issuers) ║ ║ -> Can VERIFY human approvals, but can NEVER SIGN or FORGE an approval! ║ ║ • Holds HMAC-SHA256 integrity.key (0400) + Downstream MCP credentials ║ ╚══════════════════════════════════════╦═══════════════════════════════════════╝ │ │ Writes PENDING / Consumes APPROVED ▼ ╔══════════════════════════════════════════════════════════════════════════════╗ ║ ZONE 3: HUMAN APPROVAL AUTHORITY (OS User: dmint-approver / Container C) ║ ║ ║ ║ • Runs `dmint approve <id>` or `dmint dashboard` (bound to 127.0.0.1/VPN) ║ ║ • Sole holder of Ed25519 PRIVATE Signing Key (`signing.key`, mode 0400) ║ ║ • Re-verifies request against authoritative policy before signing ║ ║ • Signs single-use Ed25519 assertion bound to RFC 8785 argument_hash ║ ╚══════════════════════════════════════════════════════════════════════════════╝
dmint init-keys (or dmint init), Dmint generates two distinct cryptographic keys and supports two SHA-256 pinning digests. Understanding where each key lives and what it does is the foundation of a zero-trust deployment:| Artifact | Cryptographic Primitive | Purpose | Who Holds It | Who Must NEVER Have It | Production Location & Mode |
1. Private Signing Key (signing.key) | Ed25519 Private Seed (RFC 8032, 32 bytes) | Signs single-use ApprovalAssertion tokens when a human runs dmint approve <id> or approves in dmint dashboard. | Zone 3 Only (Human Approver / Dashboard Authority) | AI Agent (Zone 1) and Enforcement Gate (Zone 2) | /etc/dmint/authority/signing.key (chown dmint-approver, chmod 0400, dir 0700) |
2. Public Verification Key (public_key_hex / PEM) | Ed25519 Public Key (32 bytes / 64 hex chars) | Verifies that an APPROVED assertion was signed by signing.key over the exact (request_id, argument_hash, policy_digest, capability_id, deployment_epoch, expires_at, nonce). | Zone 2 (Dmint Gate, dmint-mcp, dmint hook run, ApprovalVerifier) | Safe to be public (cannot sign or forge anything) | Exported via dmint export-public-key --json into trusted_issuers |
3. Store Integrity Key (integrity.key) | HMAC-SHA256 Secret Key (32 bytes, domain dmint/approval-record-integrity/v2\x00) | Computes row_mac over every row in SQLite/PostgreSQL (approvals table) to detect unauthorized SQL edits to request parameters or state columns. | Zone 2 (Gate) & Zone 3 (Approver) | AI Agent (Zone 1) | /etc/dmint/shared/integrity.key (chmod 0400) or DMINT_INTEGRITY_KEY_FILE |
4. Policy Digest (policy_digest) | SHA-256 (dmint/policy-digest/v1\x00 + file SHA-256) | Ensures policy.json has not been modified on disk and voids prior approvals if policy rules change. | Zone 2 & Zone 3 | Read-only | export DMINT_EXPECTED_POLICY_DIGEST=$(dmint policy-digest policy.json) |
5. Tool Schema Hash (schema_hash) | SHA-256 over RFC 8785 JCS {"description": ..., "inputSchema": ...} | Pins exact downstream MCP tool definitions so an MCP server cannot silently alter tool descriptions or parameters ("rug-pull attack"). | Zone 2 (dmint-mcp) | Read-only in policy.json | Automatically pinned in policy.json (tool_schemas) by dmint create-mcp-policy |
signing.key from public_key_hex Guarantees Unforgable Approvals:
Even if an attacker compromises the SQLite/PostgreSQL database AND steals integrity.key to write state = 'APPROVED' with a valid row_mac, Dmint.consume_approved() verifies the 64-byte Ed25519 signature using public_key_hex. Without signing.key, forging an Ed25519 signature over the RFC 8785 request digest is computationally infeasible ($2^128$ security level), and the gate rejects the call with DMT_APPROVAL_SIGNATURE_INVALID.dmint hook)sudo useradd -m -s /bin/bash dmint-approver sudo useradd -m -s /bin/bash ai-agent
sudo mkdir -p /etc/dmint/authority /etc/dmint/shared sudo chmod 0700 /etc/dmint/authority sudo chmod 0750 /etc/dmint/shared sudo dmint init-keys \ --key-file /etc/dmint/authority/signing.key \ --integrity-key-file /etc/dmint/shared/integrity.key \ --issuer-id "prod-secops-authority" sudo chown -R dmint-approver:dmint-approver /etc/dmint/authority sudo chmod 0400 /etc/dmint/authority/signing.key sudo -u dmint-approver dmint export-public-key \ --key-file /etc/dmint/authority/signing.key \ --json | sudo tee /etc/dmint/shared/trusted_issuer.json
cd /srv/workspace/my-project sudo dmint init --harness all --templates shell,filesystem,postgres,github --dir . sudo rm -f .dmint/signing.key # Lock ownership to root and make policies & hooks read-only (0444) sudo chown -R root:root policy.json .dmint/policies .claude .codex .opencode .cursor .windsurf .clinerules .cline sudo chmod 0444 policy.json .dmint/policies/*.policy.json sudo chmod 0444 .claude/settings.json .codex/hooks.json .cursor/hooks.json .windsurf/hooks.json .clinerules/hooks.json # Set Linux kernel immutable bit (+i) so no process in the workspace can modify or delete them sudo chattr +i policy.json .dmint/policies/*.policy.json sudo chattr +i .claude/settings.json .codex/hooks.json .codex/dmint-hook.sh sudo chattr +i .opencode/plugins/dmint-guard.ts .opencode/plugin/dmint-guard.ts sudo chattr +i .cursor/hooks.json .windsurf/hooks.json .clinerules/hooks/PreToolUse .cline/hooks/PreToolUse.sh
sudo -u dmint-approver dmint approve apr_... \ --key-file /etc/dmint/authority/signing.key \ --db /srv/workspace/my-project/.dmint/approvals.sqlite3 \ --by "alice@company.com" \ --reason "Verified safe deployment command"
| Attack Vector | How Dmint + Production Isolation Stops It | Error Code |
| 1. Signing Key Theft / Self-Approval | signing.key lives in Zone 3 (dmint-approver, 0400). Zone 2 only holds public_key_hex. Any forged DB row fails Ed25519 signature verification. | DMT_APPROVAL_SIGNATURE_INVALID |
| 2. Post-Approval Argument Modification | Ed25519 assertion signs argument_hash (RFC 8785 JCS SHA-256). Changing git push origin staging to git push origin main invalidates the hash. | DMT_APPROVAL_FINGERPRINT_MISMATCH |
| 3. Replay / Parallel Race Attack | consume_approved() atomically transitions APPROVED -> CONSUMED under BEGIN IMMEDIATE / SELECT ... FOR UPDATE + replay cache. | DMT_APPROVAL_CONSUMED |
4. Compound Shell Smuggling (&&, ;, |, $()) | split_compound_shell_command() splits compound operators and subshells, evaluating every sub-command independently (DENY overrides ALLOW). | DMT_POLICY_DENIED |
5. Symlink & Path Traversal (ln -s /etc/passwd) | hooks.py resolves Path.resolve() on symlink targets before evaluation; resources.py blocks .., %2e%2e, %2f, and NUL bytes. | DMT_POLICY_DENIED / DMT_RESOURCE_INVALID |
6. Multi-File Patch Smuggling (apply_patch) | extract_hook_invocations() inspects every *** Add/Update/Delete File: target in a patch and blocks the entire patch if any target is denied. | DMT_POLICY_DENIED |
| 7. Downstream MCP Rug-Pull & SSRF | dmint-mcp checks compute_tool_schema_hash() against pinned schema_hash on every call and pins resolved DNS IPs to block SSRF & DNS rebinding. | DMT_SCHEMA_MISMATCH / DMT_SSRF_BLOCKED |
# 1. Run 4-vector security self-test, crypto check, and hook/policy audit: dmint doctor # 2. Verify all policy files offline: dmint verify-policy policy.json # 3. Pin the exact SHA-256 policy digest: export DMINT_EXPECTED_POLICY_DIGEST=$(dmint policy-digest policy.json)