Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Production Proof & Zero-Trust Hardening Guide

This guide provides everything required in one place to deploy Dmint in production so that no AI agent—even under full prompt injection, jailbreak, or arbitrary code execution inside its workspace—can bypass policies, forge approvals, steal credentials, or tamper with hooks.
THE GOLDEN RULE OF PRODUCTION AGENT SECURITY
Never run an untrusted AI agent under the same OS user (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).

1. The 3-Zone Production Architecture

╔══════════════════════════════════════════════════════════════════════════════╗ ║ 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 ║ ╚══════════════════════════════════════════════════════════════════════════════╝

2. Complete Cryptographic Key & Digest Reference

When you run 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:
ArtifactCryptographic PrimitivePurposeWho Holds ItWho Must NEVER Have ItProduction 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 3Read-onlyexport 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.jsonAutomatically pinned in policy.json (tool_schemas) by dmint create-mcp-policy
Why Separating 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.

3. Step-by-Step Hardening for AI Coding Agents (dmint hook)

When protecting Claude Code, OpenAI Codex CLI, OpenCode, Cursor, Windsurf, or Cline on a Linux workstation, VM, or DevContainer:
  1. Create Separate OS Accounts
    sudo useradd -m -s /bin/bash dmint-approver sudo useradd -m -s /bin/bash ai-agent
  2. Generate Keys in the Approver Vault & Export Public Key
    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
  3. Initialize Per-Harness Policies & Lock Files with chattr +i
    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
  4. Approve Requests Exclusively from the Approver Account
    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"

4. Defeating All 7 Real-World AI Agent Escape Vectors

Attack VectorHow Dmint + Production Isolation Stops ItError Code
1. Signing Key Theft / Self-Approvalsigning.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 ModificationEd25519 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 Attackconsume_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 & SSRFdmint-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

5. Production Go-Live Verification

Run the built-in self-test and offline policy verifier in your CI/CD pipeline and on production boot:
# 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)