dmint 2.0.0__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dmint-2.0.0/src/dmint.egg-info → dmint-2.0.2}/PKG-INFO +70 -20
- {dmint-2.0.0 → dmint-2.0.2}/README.md +64 -16
- {dmint-2.0.0 → dmint-2.0.2}/pyproject.toml +6 -4
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/__init__.py +31 -2
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/canonicalize.py +8 -1
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/__main__.py +27 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/approvals.py +56 -6
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/create_mcp_policy.py +136 -32
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/create_policy.py +47 -1
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/dashboard.py +9 -1
- dmint-2.0.2/src/dmint/cli/keys.py +164 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/mcp_auth.py +216 -37
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/mcp_connections.py +1 -1
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/mcp_credentials.py +8 -2
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/mcp_oauth.py +51 -16
- dmint-2.0.2/src/dmint/cli/policy_digest.py +37 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/verify_policy.py +3 -6
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/__init__.py +85 -4
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/approvals.py +11 -0
- dmint-2.0.2/src/dmint/core/authority.py +209 -0
- dmint-2.0.2/src/dmint/core/canonicalize.py +337 -0
- dmint-2.0.2/src/dmint/core/constraints.py +720 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/enforcement.py +279 -44
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/errors.py +24 -0
- dmint-2.0.2/src/dmint/core/keys.py +610 -0
- dmint-2.0.2/src/dmint/core/policy.py +717 -0
- dmint-2.0.2/src/dmint/core/redaction.py +137 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/request_binding.py +4 -6
- dmint-2.0.2/src/dmint/core/resources.py +686 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/storage/factory.py +10 -3
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/storage/postgres_schema.sql +1 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/storage/sql.py +92 -11
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/storage/sqlite.py +287 -32
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/storage/thread_safe.py +60 -14
- dmint-2.0.0/src/dmint/core/authority.py → dmint-2.0.2/src/dmint/core/verification.py +193 -222
- dmint-2.0.2/src/dmint/core/versions.py +8 -0
- dmint-2.0.2/src/dmint/core/webhooks.py +736 -0
- dmint-2.0.2/src/dmint/dashboard/__main__.py +195 -0
- dmint-2.0.2/src/dmint/dashboard/app.py +277 -0
- dmint-2.0.2/src/dmint/dashboard/auth.py +136 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/core_client.py +61 -5
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/routes.py +290 -35
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/templates/approval.html +23 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/templates/base.html +24 -2
- dmint-2.0.2/src/dmint/dashboard/templates/login.html +50 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/enforcement.py +8 -1
- dmint-2.0.2/src/dmint/hashing.py +15 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/__init__.py +3 -1
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/__main__.py +11 -1
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/auth.py +23 -3
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/client.py +18 -2
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/config.py +1 -1
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/config_loader.py +136 -21
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/errors.py +1 -1
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/gateway.py +84 -9
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/mapper.py +4 -4
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/proxy.py +75 -17
- dmint-2.0.2/src/dmint/mcp/ssrf.py +510 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/skills/skills/dmint-policy-manager/SKILL.md +3 -3
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/version.py +5 -5
- {dmint-2.0.0 → dmint-2.0.2/src/dmint.egg-info}/PKG-INFO +70 -20
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint.egg-info/SOURCES.txt +9 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint.egg-info/requires.txt +4 -3
- dmint-2.0.0/src/dmint/core/canonicalize.py +0 -161
- dmint-2.0.0/src/dmint/core/policy.py +0 -353
- dmint-2.0.0/src/dmint/core/versions.py +0 -8
- dmint-2.0.0/src/dmint/core/webhooks.py +0 -380
- dmint-2.0.0/src/dmint/dashboard/__main__.py +0 -114
- dmint-2.0.0/src/dmint/dashboard/app.py +0 -47
- dmint-2.0.0/src/dmint/hashing.py +0 -8
- dmint-2.0.0/src/dmint/mcp/ssrf.py +0 -273
- {dmint-2.0.0 → dmint-2.0.2}/LICENSE +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/setup.cfg +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/setup.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/approvals.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/authority.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/__init__.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/api.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/compile_policy.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/errors.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/install_skill.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/io_utils.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/limits.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/prompts/__init__.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/prompts/policy_skill.md +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/py.typed +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/cli/version.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/hashing.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/models.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/py.typed +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/storage/__init__.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/core/storage/base.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/__init__.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/py.typed +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/static/favicon.svg +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/static/logo.svg +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/static/style.css +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/static/theme.js +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/templates/audit.html +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/templates/error.html +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/dashboard/templates/index.html +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/errors.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/mcp/py.typed +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/models.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/policy.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/py.typed +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/request_binding.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/skills/__init__.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/skills/manager.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/skills/py.typed +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/skills/skill.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/skills/version.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/storage/__init__.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/storage/sqlite.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint/versions.py +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint.egg-info/dependency_links.txt +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint.egg-info/entry_points.txt +0 -0
- {dmint-2.0.0 → dmint-2.0.2}/src/dmint.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dmint
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Deterministic authorization and security enforcement for AI-agent tool execution
|
|
5
5
|
Author: Dmint Authors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
16
|
Classifier: Topic :: Security
|
|
16
17
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
18
|
Requires-Python: >=3.10
|
|
@@ -19,16 +20,17 @@ Description-Content-Type: text/markdown
|
|
|
19
20
|
License-File: LICENSE
|
|
20
21
|
Requires-Dist: cryptography<51,>=42
|
|
21
22
|
Requires-Dist: rfc8785<0.2,>=0.1.2
|
|
22
|
-
Requires-Dist: questionary
|
|
23
|
-
Requires-Dist: sqlalchemy
|
|
23
|
+
Requires-Dist: questionary<3.0.0,>=2.0.0
|
|
24
|
+
Requires-Dist: sqlalchemy<3.0.0,>=2.0.0
|
|
24
25
|
Provides-Extra: postgres
|
|
25
26
|
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
|
|
27
|
+
Requires-Dist: psycopg[binary]>=3.1.0; extra == "postgres"
|
|
26
28
|
Provides-Extra: mcp
|
|
27
29
|
Requires-Dist: mcp<3.0.0,>=2.2.0; extra == "mcp"
|
|
28
30
|
Requires-Dist: anyio>=4.9; extra == "mcp"
|
|
29
31
|
Requires-Dist: starlette>=0.27; extra == "mcp"
|
|
30
32
|
Requires-Dist: uvicorn>=0.31; extra == "mcp"
|
|
31
|
-
Requires-Dist: httpx2
|
|
33
|
+
Requires-Dist: httpx2<3.0.0,>=2.5; extra == "mcp"
|
|
32
34
|
Provides-Extra: dashboard
|
|
33
35
|
Requires-Dist: fastapi<1.0,>=0.110; extra == "dashboard"
|
|
34
36
|
Requires-Dist: uvicorn[standard]<1.0,>=0.31; extra == "dashboard"
|
|
@@ -130,13 +132,13 @@ Modern AI agents (Claude Code, Cursor, Antigravity, AutoGPT, custom LangChain/Ll
|
|
|
130
132
|
|
|
131
133
|
## Subsystems
|
|
132
134
|
|
|
133
|
-
`dmint` v2.0.
|
|
135
|
+
`dmint` v2.0.2 is organized as a unified monorepo providing modular packages under a single distribution:
|
|
134
136
|
|
|
135
137
|
| Module | Description | Primary Exports / Entrypoint |
|
|
136
138
|
| :--- | :--- | :--- |
|
|
137
139
|
| **`dmint.core`** | Deterministic policy engine, RFC 8785 canonicalizer, SQLite approval store | `from dmint import Dmint, Policy, Rule` |
|
|
138
140
|
| **`dmint.cli`** | Developer CLI for authoring, compiling, validating, and managing policies | `dmint` command |
|
|
139
|
-
| **`dmint.mcp`** | Transparent security proxy for Model Context Protocol (stdio &
|
|
141
|
+
| **`dmint.mcp`** | Transparent security proxy for Model Context Protocol (stdio & Streamable HTTP) | `dmint-mcp` command |
|
|
140
142
|
| **`dmint.dashboard`** | Local web dashboard for human review and Ed25519 approval signing | `dmint dashboard` or `dmint-dashboard` |
|
|
141
143
|
| **`dmint.skills`** | Packaged AI agent skills (`dmint-policy-manager`) for self-authoring policies | `dmint install-skill` |
|
|
142
144
|
|
|
@@ -173,6 +175,14 @@ pip install "dmint[all]"
|
|
|
173
175
|
|
|
174
176
|
## Quickstart: Python SDK
|
|
175
177
|
|
|
178
|
+
Dmint's approval store is tamper-evident: pending records are HMAC-signed with a local integrity key, and approvals are signed with an Ed25519 key. Generate both once before running the example:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
dmint init-keys
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This writes `~/.config/dmint/signing.key` and `~/.config/dmint/integrity.key` (mode `0600`). In CI or containers, provide the integrity key with `DMINT_INTEGRITY_KEY` (64 hex characters) or `DMINT_INTEGRITY_KEY_FILE` (path to a `0600` key file) instead.
|
|
185
|
+
|
|
176
186
|
Protecting local Python functions and agent tools with Dmint:
|
|
177
187
|
|
|
178
188
|
```python
|
|
@@ -250,6 +260,11 @@ except ApprovalRequiredError as exc:
|
|
|
250
260
|
print(f" Request Fingerprint: {exc.request_fingerprint}")
|
|
251
261
|
```
|
|
252
262
|
|
|
263
|
+
> [!NOTE]
|
|
264
|
+
> **Supported callable types**: `@engine.protect` supports synchronous functions (`def`), asynchronous functions (`async def`), instance methods, class methods (`@classmethod`), and static methods (`@staticmethod`). Generator and async-generator functions are not supported.
|
|
265
|
+
>
|
|
266
|
+
> **Measured Performance**: In-memory policy evaluation runs in ~3 µs; persistent storage operations (SQLite/PostgreSQL approval lifecycle) take ~2-5 ms.
|
|
267
|
+
|
|
253
268
|
### Pluggable Storage: SQLite & Production PostgreSQL
|
|
254
269
|
|
|
255
270
|
Dmint provides a pluggable approval persistence interface (`ApprovalStore`) driven by SQLAlchemy Core.
|
|
@@ -339,13 +354,17 @@ Add Dmint MCP as a stdio server in your client configuration (e.g. `.cursor/mcp.
|
|
|
339
354
|
| :--- | :--- | :--- |
|
|
340
355
|
| `dmint create-policy` | `dmint create-policy -f access.md -o policy.json` | Interactive LLM wizard that converts markdown access requirements into validated policies. |
|
|
341
356
|
| `dmint create-mcp-policy` | `dmint create-mcp-policy --url https://api.example.com/mcp` | Discovers live MCP server tools and generates `policy.json` and `mcp_protection.json`. |
|
|
342
|
-
| `dmint
|
|
343
|
-
| `dmint
|
|
357
|
+
| `dmint protect-mcp` | `dmint protect-mcp --url https://api.example.com/mcp` | Compatibility alias for `dmint create-mcp-policy` (identical options). |
|
|
358
|
+
| `dmint verify-policy` | `dmint verify-policy policy.json` | 100% offline schema and capability validation. Zero network, zero LLM. |
|
|
359
|
+
| `dmint policy-digest` | `dmint policy-digest policy.json` | Computes the SHA-256 digest of the exact policy file bytes (for `DMINT_EXPECTED_POLICY_DIGEST`). |
|
|
360
|
+
| `dmint compile-policy` | `dmint compile-policy -f access.md -o policy.json` | [Compatibility] Legacy LLM wizard delegating to `create-policy` non-interactive mode. |
|
|
344
361
|
| `dmint pending` | `dmint pending` | Lists all approval requests currently in `PENDING` state across SQLite or PostgreSQL. |
|
|
345
362
|
| `dmint approve` | `dmint approve <id> [--reason "..."]` | Signs and approves a pending request via Core Ed25519 primitives after policy re-verification. |
|
|
346
363
|
| `dmint reject` | `dmint reject <id> [--reason "..."]` | Marks a pending request as `REJECTED` with an optional audit reason. |
|
|
347
364
|
| `dmint dashboard` | `dmint dashboard --db-path ./approvals.sqlite3` | Launches the local human approval web dashboard (FastAPI). |
|
|
348
365
|
| `dmint install-skill` | `dmint install-skill -y` | Installs the `dmint-policy-manager` skill into `.agents/skills/` for AI coding assistants. |
|
|
366
|
+
| `dmint init-keys` | `dmint init-keys` | Generates and persists Ed25519 signing and HMAC integrity keys (`0600`, atomic). |
|
|
367
|
+
| `dmint export-public-key` | `dmint export-public-key --format json` | Prints the public key (hex + PEM) and issuer ID for gateway `trusted_issuers`. |
|
|
349
368
|
|
|
350
369
|
---
|
|
351
370
|
|
|
@@ -363,6 +382,10 @@ export DMINT_TEAMS_WEBHOOK_URL="https://example.webhook.office.com/webhookb2/...
|
|
|
363
382
|
- **Fail-Safe & Isolated**: Webhook errors or timeouts never block, weaken, or compromise runtime authorization decisions.
|
|
364
383
|
- **Zero-Config Default**: Webhook dispatch is a pure no-op when URLs are unset.
|
|
365
384
|
|
|
385
|
+
> [!NOTE]
|
|
386
|
+
> **TODO (Approver Environment)**: Because `--database-url` credentials are strictly stripped from outgoing webhook notifications to prevent credential leakage in chat channels, approvers executing `dmint approve <id>` must ensure the `DMINT_DATABASE_URL` environment variable is configured in their execution environment if using a remote PostgreSQL store.
|
|
387
|
+
|
|
388
|
+
|
|
366
389
|
---
|
|
367
390
|
|
|
368
391
|
## Security Invariants
|
|
@@ -373,12 +396,30 @@ Dmint enforces five fundamental invariants across all modules:
|
|
|
373
396
|
2. **Fail-Closed Default**: Any request not explicitly allowed by a matching rule evaluates to `DENY`.
|
|
374
397
|
3. **Exact Request Binding**: Requests are canonicalized using RFC 8785 and fingerprinted with SHA-256 domain separation. Mismatched arguments invalidate approval tokens.
|
|
375
398
|
4. **Single-Use Approvals**: Approvals transition atomically in SQLite (`PENDING` $\to$ `APPROVED` $\to$ `CONSUMED`) to prevent race conditions and replay attacks.
|
|
376
|
-
5. **SSRF & Network Hardening**: Remote MCP transports reject loopback, link-local, private RFC 1918 addresses,
|
|
399
|
+
5. **SSRF & Network Hardening**: Remote MCP transports reject loopback, link-local, private RFC 1918 addresses, cloud instance metadata endpoints (`169.254.169.254`), and DNS-rebinding attempts via connection-level IP pinning.
|
|
377
400
|
|
|
378
401
|
For complete vulnerability reporting guidelines and threat boundaries, see [SECURITY.md](SECURITY.md).
|
|
379
402
|
|
|
380
403
|
---
|
|
381
404
|
|
|
405
|
+
## What Dmint Does NOT Protect Against
|
|
406
|
+
|
|
407
|
+
> [!CAUTION]
|
|
408
|
+
> **CRITICAL OS USER & PROCESS ISOLATION REQUIREMENT**
|
|
409
|
+
>
|
|
410
|
+
> Dmint is an application- and protocol-level authorization gate. It **does NOT protect against an agent executing under the same OS user account**:
|
|
411
|
+
>
|
|
412
|
+
> In adversarial attack matrix testing, a same-OS-user agent succeeded in all five host attack vectors:
|
|
413
|
+
> 1. **Signing Key Theft**: Reading the private Ed25519 signing key (`signing.key`) from disk to self-sign approvals.
|
|
414
|
+
> 2. **Policy File Tampering**: Directly editing `policy.json` to insert unrestricted `ALLOW` rules.
|
|
415
|
+
> 3. **Database Modification**: Directly rewriting rows or checksums in the SQLite approvals database.
|
|
416
|
+
> 4. **Dashboard Token Theft**: Reading the dashboard token from configuration files or `/proc/<pid>/environ`.
|
|
417
|
+
> 5. **Client Configuration Replacement**: Overwriting `.cursor/mcp.json` or client settings to bypass `dmint-mcp` entirely and talk to unprotected tools directly.
|
|
418
|
+
>
|
|
419
|
+
> **Protection Guarantee**: Dmint's cryptographic security boundary holds **strictly when the AI agent process runs under a different OS user or in an isolated container** with no filesystem access to Dmint keys, policies, or stores. See [docs/deployment-model.md](docs/deployment-model.md).
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
382
423
|
---
|
|
383
424
|
|
|
384
425
|
## Local Development & Testing
|
|
@@ -414,19 +455,21 @@ ruff format .
|
|
|
414
455
|
# 2. Lint and check for syntax / rule errors
|
|
415
456
|
ruff check .
|
|
416
457
|
|
|
417
|
-
# 3. Type check all
|
|
458
|
+
# 3. Type check all 79 source files
|
|
418
459
|
mypy src/
|
|
419
460
|
|
|
420
461
|
# 4. Run targeted tests for what you changed
|
|
421
462
|
pytest tests/<subsystem>/ -v # e.g., tests/core/, tests/cli/, tests/mcp/, tests/dashboard/
|
|
422
463
|
|
|
423
|
-
# 5. Run full test suite (baseline:
|
|
464
|
+
# 5. Run full test suite (baseline: 1525 passed, 0 skipped, 0 failed)
|
|
424
465
|
pytest tests/ -q
|
|
425
466
|
|
|
426
467
|
# 6. Run pre-commit checks across all files
|
|
427
468
|
pre-commit run --all-files
|
|
428
469
|
```
|
|
429
470
|
|
|
471
|
+
**Full-suite prerequisites:** PostgreSQL-backed suites require a reachable server (`DMINT_TEST_DATABASE_URL`; default `postgresql://postgres:postgres@localhost:5432/dmint_test`) and fail loudly — never skip — when it is unreachable. RFC 8785 cross-checks and node-parity fuzzing require Node.js plus `npm ci` inside `tests/fixtures/`.
|
|
472
|
+
|
|
430
473
|
For detailed checklists per subsystem, see [`FLOW.md`](FLOW.md).
|
|
431
474
|
|
|
432
475
|
### 3. Local Editable Installation for Development (`pip install -e`)
|
|
@@ -463,10 +506,10 @@ python3 -m venv /tmp/dmint-test-env
|
|
|
463
506
|
source /tmp/dmint-test-env/bin/activate
|
|
464
507
|
|
|
465
508
|
# Install the wheel with all extras
|
|
466
|
-
pip install "dist/dmint-2.0.
|
|
509
|
+
pip install "dist/dmint-2.0.2-py3-none-any.whl[all]"
|
|
467
510
|
|
|
468
511
|
# 4. Verify all installed CLI entrypoints
|
|
469
|
-
dmint --version # Expected: dmint 2.0.
|
|
512
|
+
dmint --version # Expected: dmint 2.0.2
|
|
470
513
|
dmint --help # Policy wizards and verification commands
|
|
471
514
|
dmint-mcp --help # MCP multi-server gateway
|
|
472
515
|
dmint-dashboard --help # Approval web review console
|
|
@@ -498,7 +541,7 @@ npm run dev
|
|
|
498
541
|
```
|
|
499
542
|
|
|
500
543
|
- Open **[http://localhost:3334](http://localhost:3334)** in your web browser.
|
|
501
|
-
- All
|
|
544
|
+
- All 28 pages (Quickstart, Core Concepts, Guides, Architecture, and API Reference) are fully browsable with live search and code highlighting.
|
|
502
545
|
- Changes to any `.mdx` file or `docs.json` update instantly via Vite HMR.
|
|
503
546
|
|
|
504
547
|
### Production Preview (Build & Serve)
|
|
@@ -528,14 +571,21 @@ npm start
|
|
|
528
571
|
|
|
529
572
|
---
|
|
530
573
|
|
|
531
|
-
## Versioning &
|
|
574
|
+
## Versioning & Push-Time Release Gate
|
|
575
|
+
|
|
576
|
+
Dmint adheres strictly to **[Semantic Versioning 2.0.0](https://semver.org/)** and uses a push-time release gate:
|
|
577
|
+
|
|
578
|
+
| Change severity | SemVer bump | Typical changes |
|
|
579
|
+
|---|---|---|
|
|
580
|
+
| **High / Major** | `2.0.2` → `3.0.0` | Incompatible API changes, breaking policy schema modifications, removed public methods. |
|
|
581
|
+
| **Medium / Minor** | `2.0.2` → `2.1.0` | Backwards-compatible features, new CLI flags, new integrations. |
|
|
582
|
+
| **Low / Patch** | `2.0.2` → `2.0.3` | Bug fixes, security hardening, documentation updates, test additions, non-breaking refactors. |
|
|
583
|
+
|
|
584
|
+
Every push must include the appropriate version decision and bump. A push carrying any Major change is Major; otherwise any Minor change makes it Minor; otherwise it is Patch. When severity is ambiguous, choose the higher severity and ask before a Major bump.
|
|
532
585
|
|
|
533
|
-
|
|
534
|
-
- **Patch (`2.0.0` → `2.0.1`)**: Bug fixes, documentation updates, test additions, non-breaking refactors.
|
|
535
|
-
- **Minor (`2.0.0` → `2.1.0`)**: Backwards-compatible features, new CLI flags, new integrations.
|
|
536
|
-
- **Major (`2.0.0` → `3.0.0`)**: Incompatible API changes, breaking policy schema modifications.
|
|
586
|
+
The bump and its required updates are made in the same push: `pyproject.toml`, `src/dmint/version.py`, `CHANGELOG.md`, `PLAIN.md`, current-version documentation, and any version-pinned tests. The full verification flow in [`FLOW.md`](FLOW.md) must pass before pushing.
|
|
537
587
|
|
|
538
|
-
|
|
588
|
+
After CI succeeds for a push to `main`, the **Publish to PyPI** workflow publishes the new version automatically. Manual dispatch and GitHub release publication remain fallback paths. The workflow rejects a version that already exists on PyPI; bump the version instead of retrying the same one.
|
|
539
589
|
|
|
540
590
|
---
|
|
541
591
|
|
|
@@ -76,13 +76,13 @@ Modern AI agents (Claude Code, Cursor, Antigravity, AutoGPT, custom LangChain/Ll
|
|
|
76
76
|
|
|
77
77
|
## Subsystems
|
|
78
78
|
|
|
79
|
-
`dmint` v2.0.
|
|
79
|
+
`dmint` v2.0.2 is organized as a unified monorepo providing modular packages under a single distribution:
|
|
80
80
|
|
|
81
81
|
| Module | Description | Primary Exports / Entrypoint |
|
|
82
82
|
| :--- | :--- | :--- |
|
|
83
83
|
| **`dmint.core`** | Deterministic policy engine, RFC 8785 canonicalizer, SQLite approval store | `from dmint import Dmint, Policy, Rule` |
|
|
84
84
|
| **`dmint.cli`** | Developer CLI for authoring, compiling, validating, and managing policies | `dmint` command |
|
|
85
|
-
| **`dmint.mcp`** | Transparent security proxy for Model Context Protocol (stdio &
|
|
85
|
+
| **`dmint.mcp`** | Transparent security proxy for Model Context Protocol (stdio & Streamable HTTP) | `dmint-mcp` command |
|
|
86
86
|
| **`dmint.dashboard`** | Local web dashboard for human review and Ed25519 approval signing | `dmint dashboard` or `dmint-dashboard` |
|
|
87
87
|
| **`dmint.skills`** | Packaged AI agent skills (`dmint-policy-manager`) for self-authoring policies | `dmint install-skill` |
|
|
88
88
|
|
|
@@ -119,6 +119,14 @@ pip install "dmint[all]"
|
|
|
119
119
|
|
|
120
120
|
## Quickstart: Python SDK
|
|
121
121
|
|
|
122
|
+
Dmint's approval store is tamper-evident: pending records are HMAC-signed with a local integrity key, and approvals are signed with an Ed25519 key. Generate both once before running the example:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
dmint init-keys
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This writes `~/.config/dmint/signing.key` and `~/.config/dmint/integrity.key` (mode `0600`). In CI or containers, provide the integrity key with `DMINT_INTEGRITY_KEY` (64 hex characters) or `DMINT_INTEGRITY_KEY_FILE` (path to a `0600` key file) instead.
|
|
129
|
+
|
|
122
130
|
Protecting local Python functions and agent tools with Dmint:
|
|
123
131
|
|
|
124
132
|
```python
|
|
@@ -196,6 +204,11 @@ except ApprovalRequiredError as exc:
|
|
|
196
204
|
print(f" Request Fingerprint: {exc.request_fingerprint}")
|
|
197
205
|
```
|
|
198
206
|
|
|
207
|
+
> [!NOTE]
|
|
208
|
+
> **Supported callable types**: `@engine.protect` supports synchronous functions (`def`), asynchronous functions (`async def`), instance methods, class methods (`@classmethod`), and static methods (`@staticmethod`). Generator and async-generator functions are not supported.
|
|
209
|
+
>
|
|
210
|
+
> **Measured Performance**: In-memory policy evaluation runs in ~3 µs; persistent storage operations (SQLite/PostgreSQL approval lifecycle) take ~2-5 ms.
|
|
211
|
+
|
|
199
212
|
### Pluggable Storage: SQLite & Production PostgreSQL
|
|
200
213
|
|
|
201
214
|
Dmint provides a pluggable approval persistence interface (`ApprovalStore`) driven by SQLAlchemy Core.
|
|
@@ -285,13 +298,17 @@ Add Dmint MCP as a stdio server in your client configuration (e.g. `.cursor/mcp.
|
|
|
285
298
|
| :--- | :--- | :--- |
|
|
286
299
|
| `dmint create-policy` | `dmint create-policy -f access.md -o policy.json` | Interactive LLM wizard that converts markdown access requirements into validated policies. |
|
|
287
300
|
| `dmint create-mcp-policy` | `dmint create-mcp-policy --url https://api.example.com/mcp` | Discovers live MCP server tools and generates `policy.json` and `mcp_protection.json`. |
|
|
288
|
-
| `dmint
|
|
289
|
-
| `dmint
|
|
301
|
+
| `dmint protect-mcp` | `dmint protect-mcp --url https://api.example.com/mcp` | Compatibility alias for `dmint create-mcp-policy` (identical options). |
|
|
302
|
+
| `dmint verify-policy` | `dmint verify-policy policy.json` | 100% offline schema and capability validation. Zero network, zero LLM. |
|
|
303
|
+
| `dmint policy-digest` | `dmint policy-digest policy.json` | Computes the SHA-256 digest of the exact policy file bytes (for `DMINT_EXPECTED_POLICY_DIGEST`). |
|
|
304
|
+
| `dmint compile-policy` | `dmint compile-policy -f access.md -o policy.json` | [Compatibility] Legacy LLM wizard delegating to `create-policy` non-interactive mode. |
|
|
290
305
|
| `dmint pending` | `dmint pending` | Lists all approval requests currently in `PENDING` state across SQLite or PostgreSQL. |
|
|
291
306
|
| `dmint approve` | `dmint approve <id> [--reason "..."]` | Signs and approves a pending request via Core Ed25519 primitives after policy re-verification. |
|
|
292
307
|
| `dmint reject` | `dmint reject <id> [--reason "..."]` | Marks a pending request as `REJECTED` with an optional audit reason. |
|
|
293
308
|
| `dmint dashboard` | `dmint dashboard --db-path ./approvals.sqlite3` | Launches the local human approval web dashboard (FastAPI). |
|
|
294
309
|
| `dmint install-skill` | `dmint install-skill -y` | Installs the `dmint-policy-manager` skill into `.agents/skills/` for AI coding assistants. |
|
|
310
|
+
| `dmint init-keys` | `dmint init-keys` | Generates and persists Ed25519 signing and HMAC integrity keys (`0600`, atomic). |
|
|
311
|
+
| `dmint export-public-key` | `dmint export-public-key --format json` | Prints the public key (hex + PEM) and issuer ID for gateway `trusted_issuers`. |
|
|
295
312
|
|
|
296
313
|
---
|
|
297
314
|
|
|
@@ -309,6 +326,10 @@ export DMINT_TEAMS_WEBHOOK_URL="https://example.webhook.office.com/webhookb2/...
|
|
|
309
326
|
- **Fail-Safe & Isolated**: Webhook errors or timeouts never block, weaken, or compromise runtime authorization decisions.
|
|
310
327
|
- **Zero-Config Default**: Webhook dispatch is a pure no-op when URLs are unset.
|
|
311
328
|
|
|
329
|
+
> [!NOTE]
|
|
330
|
+
> **TODO (Approver Environment)**: Because `--database-url` credentials are strictly stripped from outgoing webhook notifications to prevent credential leakage in chat channels, approvers executing `dmint approve <id>` must ensure the `DMINT_DATABASE_URL` environment variable is configured in their execution environment if using a remote PostgreSQL store.
|
|
331
|
+
|
|
332
|
+
|
|
312
333
|
---
|
|
313
334
|
|
|
314
335
|
## Security Invariants
|
|
@@ -319,12 +340,30 @@ Dmint enforces five fundamental invariants across all modules:
|
|
|
319
340
|
2. **Fail-Closed Default**: Any request not explicitly allowed by a matching rule evaluates to `DENY`.
|
|
320
341
|
3. **Exact Request Binding**: Requests are canonicalized using RFC 8785 and fingerprinted with SHA-256 domain separation. Mismatched arguments invalidate approval tokens.
|
|
321
342
|
4. **Single-Use Approvals**: Approvals transition atomically in SQLite (`PENDING` $\to$ `APPROVED` $\to$ `CONSUMED`) to prevent race conditions and replay attacks.
|
|
322
|
-
5. **SSRF & Network Hardening**: Remote MCP transports reject loopback, link-local, private RFC 1918 addresses,
|
|
343
|
+
5. **SSRF & Network Hardening**: Remote MCP transports reject loopback, link-local, private RFC 1918 addresses, cloud instance metadata endpoints (`169.254.169.254`), and DNS-rebinding attempts via connection-level IP pinning.
|
|
323
344
|
|
|
324
345
|
For complete vulnerability reporting guidelines and threat boundaries, see [SECURITY.md](SECURITY.md).
|
|
325
346
|
|
|
326
347
|
---
|
|
327
348
|
|
|
349
|
+
## What Dmint Does NOT Protect Against
|
|
350
|
+
|
|
351
|
+
> [!CAUTION]
|
|
352
|
+
> **CRITICAL OS USER & PROCESS ISOLATION REQUIREMENT**
|
|
353
|
+
>
|
|
354
|
+
> Dmint is an application- and protocol-level authorization gate. It **does NOT protect against an agent executing under the same OS user account**:
|
|
355
|
+
>
|
|
356
|
+
> In adversarial attack matrix testing, a same-OS-user agent succeeded in all five host attack vectors:
|
|
357
|
+
> 1. **Signing Key Theft**: Reading the private Ed25519 signing key (`signing.key`) from disk to self-sign approvals.
|
|
358
|
+
> 2. **Policy File Tampering**: Directly editing `policy.json` to insert unrestricted `ALLOW` rules.
|
|
359
|
+
> 3. **Database Modification**: Directly rewriting rows or checksums in the SQLite approvals database.
|
|
360
|
+
> 4. **Dashboard Token Theft**: Reading the dashboard token from configuration files or `/proc/<pid>/environ`.
|
|
361
|
+
> 5. **Client Configuration Replacement**: Overwriting `.cursor/mcp.json` or client settings to bypass `dmint-mcp` entirely and talk to unprotected tools directly.
|
|
362
|
+
>
|
|
363
|
+
> **Protection Guarantee**: Dmint's cryptographic security boundary holds **strictly when the AI agent process runs under a different OS user or in an isolated container** with no filesystem access to Dmint keys, policies, or stores. See [docs/deployment-model.md](docs/deployment-model.md).
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
328
367
|
---
|
|
329
368
|
|
|
330
369
|
## Local Development & Testing
|
|
@@ -360,19 +399,21 @@ ruff format .
|
|
|
360
399
|
# 2. Lint and check for syntax / rule errors
|
|
361
400
|
ruff check .
|
|
362
401
|
|
|
363
|
-
# 3. Type check all
|
|
402
|
+
# 3. Type check all 79 source files
|
|
364
403
|
mypy src/
|
|
365
404
|
|
|
366
405
|
# 4. Run targeted tests for what you changed
|
|
367
406
|
pytest tests/<subsystem>/ -v # e.g., tests/core/, tests/cli/, tests/mcp/, tests/dashboard/
|
|
368
407
|
|
|
369
|
-
# 5. Run full test suite (baseline:
|
|
408
|
+
# 5. Run full test suite (baseline: 1525 passed, 0 skipped, 0 failed)
|
|
370
409
|
pytest tests/ -q
|
|
371
410
|
|
|
372
411
|
# 6. Run pre-commit checks across all files
|
|
373
412
|
pre-commit run --all-files
|
|
374
413
|
```
|
|
375
414
|
|
|
415
|
+
**Full-suite prerequisites:** PostgreSQL-backed suites require a reachable server (`DMINT_TEST_DATABASE_URL`; default `postgresql://postgres:postgres@localhost:5432/dmint_test`) and fail loudly — never skip — when it is unreachable. RFC 8785 cross-checks and node-parity fuzzing require Node.js plus `npm ci` inside `tests/fixtures/`.
|
|
416
|
+
|
|
376
417
|
For detailed checklists per subsystem, see [`FLOW.md`](FLOW.md).
|
|
377
418
|
|
|
378
419
|
### 3. Local Editable Installation for Development (`pip install -e`)
|
|
@@ -409,10 +450,10 @@ python3 -m venv /tmp/dmint-test-env
|
|
|
409
450
|
source /tmp/dmint-test-env/bin/activate
|
|
410
451
|
|
|
411
452
|
# Install the wheel with all extras
|
|
412
|
-
pip install "dist/dmint-2.0.
|
|
453
|
+
pip install "dist/dmint-2.0.2-py3-none-any.whl[all]"
|
|
413
454
|
|
|
414
455
|
# 4. Verify all installed CLI entrypoints
|
|
415
|
-
dmint --version # Expected: dmint 2.0.
|
|
456
|
+
dmint --version # Expected: dmint 2.0.2
|
|
416
457
|
dmint --help # Policy wizards and verification commands
|
|
417
458
|
dmint-mcp --help # MCP multi-server gateway
|
|
418
459
|
dmint-dashboard --help # Approval web review console
|
|
@@ -444,7 +485,7 @@ npm run dev
|
|
|
444
485
|
```
|
|
445
486
|
|
|
446
487
|
- Open **[http://localhost:3334](http://localhost:3334)** in your web browser.
|
|
447
|
-
- All
|
|
488
|
+
- All 28 pages (Quickstart, Core Concepts, Guides, Architecture, and API Reference) are fully browsable with live search and code highlighting.
|
|
448
489
|
- Changes to any `.mdx` file or `docs.json` update instantly via Vite HMR.
|
|
449
490
|
|
|
450
491
|
### Production Preview (Build & Serve)
|
|
@@ -474,14 +515,21 @@ npm start
|
|
|
474
515
|
|
|
475
516
|
---
|
|
476
517
|
|
|
477
|
-
## Versioning &
|
|
518
|
+
## Versioning & Push-Time Release Gate
|
|
519
|
+
|
|
520
|
+
Dmint adheres strictly to **[Semantic Versioning 2.0.0](https://semver.org/)** and uses a push-time release gate:
|
|
521
|
+
|
|
522
|
+
| Change severity | SemVer bump | Typical changes |
|
|
523
|
+
|---|---|---|
|
|
524
|
+
| **High / Major** | `2.0.2` → `3.0.0` | Incompatible API changes, breaking policy schema modifications, removed public methods. |
|
|
525
|
+
| **Medium / Minor** | `2.0.2` → `2.1.0` | Backwards-compatible features, new CLI flags, new integrations. |
|
|
526
|
+
| **Low / Patch** | `2.0.2` → `2.0.3` | Bug fixes, security hardening, documentation updates, test additions, non-breaking refactors. |
|
|
527
|
+
|
|
528
|
+
Every push must include the appropriate version decision and bump. A push carrying any Major change is Major; otherwise any Minor change makes it Minor; otherwise it is Patch. When severity is ambiguous, choose the higher severity and ask before a Major bump.
|
|
478
529
|
|
|
479
|
-
|
|
480
|
-
- **Patch (`2.0.0` → `2.0.1`)**: Bug fixes, documentation updates, test additions, non-breaking refactors.
|
|
481
|
-
- **Minor (`2.0.0` → `2.1.0`)**: Backwards-compatible features, new CLI flags, new integrations.
|
|
482
|
-
- **Major (`2.0.0` → `3.0.0`)**: Incompatible API changes, breaking policy schema modifications.
|
|
530
|
+
The bump and its required updates are made in the same push: `pyproject.toml`, `src/dmint/version.py`, `CHANGELOG.md`, `PLAIN.md`, current-version documentation, and any version-pinned tests. The full verification flow in [`FLOW.md`](FLOW.md) must pass before pushing.
|
|
483
531
|
|
|
484
|
-
|
|
532
|
+
After CI succeeds for a push to `main`, the **Publish to PyPI** workflow publishes the new version automatically. Manual dispatch and GitHub release publication remain fallback paths. The workflow rejects a version that already exists on PyPI; bump the version instead of retrying the same one.
|
|
485
533
|
|
|
486
534
|
---
|
|
487
535
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dmint"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.2"
|
|
8
8
|
description = "Deterministic authorization and security enforcement for AI-agent tool execution"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -21,26 +21,28 @@ classifiers = [
|
|
|
21
21
|
"Programming Language :: Python :: 3.10",
|
|
22
22
|
"Programming Language :: Python :: 3.11",
|
|
23
23
|
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
24
25
|
"Topic :: Security",
|
|
25
26
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
27
|
]
|
|
27
28
|
dependencies = [
|
|
28
29
|
"cryptography>=42,<51",
|
|
29
30
|
"rfc8785>=0.1.2,<0.2",
|
|
30
|
-
"questionary>=2.0.0",
|
|
31
|
-
"sqlalchemy>=2.0.0",
|
|
31
|
+
"questionary>=2.0.0,<3.0.0",
|
|
32
|
+
"sqlalchemy>=2.0.0,<3.0.0",
|
|
32
33
|
]
|
|
33
34
|
|
|
34
35
|
[project.optional-dependencies]
|
|
35
36
|
postgres = [
|
|
36
37
|
"psycopg2-binary>=2.9.0",
|
|
38
|
+
"psycopg[binary]>=3.1.0",
|
|
37
39
|
]
|
|
38
40
|
mcp = [
|
|
39
41
|
"mcp>=2.2.0,<3.0.0",
|
|
40
42
|
"anyio>=4.9",
|
|
41
43
|
"starlette>=0.27",
|
|
42
44
|
"uvicorn>=0.31",
|
|
43
|
-
"httpx2>=2.5",
|
|
45
|
+
"httpx2>=2.5,<3.0.0",
|
|
44
46
|
]
|
|
45
47
|
dashboard = [
|
|
46
48
|
"fastapi>=0.110,<1.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Dmint: Deterministic authorization and security enforcement for AI-agent tool execution."""
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
|
+
from typing import Any
|
|
4
5
|
|
|
5
6
|
from .version import __version__
|
|
6
7
|
from .core import (
|
|
@@ -8,6 +9,8 @@ from .core import (
|
|
|
8
9
|
APPROVAL_RECORD_SCHEMA_VERSION,
|
|
9
10
|
APPROVAL_SIGNATURE_ALGORITHM,
|
|
10
11
|
CANONICALIZATION_PROFILE,
|
|
12
|
+
MAX_CANONICAL_BYTES,
|
|
13
|
+
MAX_CANONICAL_DEPTH,
|
|
11
14
|
MAX_SAFE_INTEGER,
|
|
12
15
|
NO_RESOURCE,
|
|
13
16
|
REQUEST_BINDING_VERSION,
|
|
@@ -53,13 +56,19 @@ from .core import (
|
|
|
53
56
|
ExecutionError,
|
|
54
57
|
IllegalApprovalTransitionError,
|
|
55
58
|
InvocationSnapshot,
|
|
56
|
-
LocalApprovalAuthority,
|
|
57
59
|
MalformedApprovalError,
|
|
58
60
|
NoResource,
|
|
59
61
|
Policy,
|
|
60
62
|
PolicyError,
|
|
61
63
|
PolicyProvenance,
|
|
64
|
+
compute_tool_schema_hash,
|
|
62
65
|
RequestValidationError,
|
|
66
|
+
ResourceKind,
|
|
67
|
+
ResourceMatchingError,
|
|
68
|
+
compile_path_pattern,
|
|
69
|
+
match_resource,
|
|
70
|
+
normalize_path,
|
|
71
|
+
normalize_url,
|
|
63
72
|
Rule,
|
|
64
73
|
ApprovalStore,
|
|
65
74
|
SQLAlchemyApprovalStore,
|
|
@@ -79,7 +88,9 @@ from .core import (
|
|
|
79
88
|
build_denial_payload,
|
|
80
89
|
canonical_request_binding,
|
|
81
90
|
canonicalize,
|
|
91
|
+
canonicalize_bytes,
|
|
82
92
|
canonicalize_request,
|
|
93
|
+
redact_database_url,
|
|
83
94
|
dispatch_approval_webhook,
|
|
84
95
|
dispatch_denial_webhook,
|
|
85
96
|
new_approval_id,
|
|
@@ -89,6 +100,8 @@ from .core import (
|
|
|
89
100
|
request_binding_envelope,
|
|
90
101
|
request_binding_fingerprint,
|
|
91
102
|
request_fingerprint,
|
|
103
|
+
evaluate_constraints,
|
|
104
|
+
validate_constraints_schema,
|
|
92
105
|
)
|
|
93
106
|
import importlib
|
|
94
107
|
from typing import TYPE_CHECKING
|
|
@@ -101,12 +114,16 @@ if TYPE_CHECKING:
|
|
|
101
114
|
from . import skills as skills
|
|
102
115
|
|
|
103
116
|
|
|
104
|
-
def __getattr__(name: str):
|
|
117
|
+
def __getattr__(name: str) -> Any:
|
|
105
118
|
if name in ("cli", "mcp", "dashboard", "skills"):
|
|
106
119
|
mod = importlib.import_module(f".{name}", __name__)
|
|
107
120
|
globals()[name] = mod
|
|
108
121
|
sys.modules.setdefault(f"dmint_{name}", mod)
|
|
109
122
|
return mod
|
|
123
|
+
if name == "LocalApprovalAuthority":
|
|
124
|
+
from .core.authority import LocalApprovalAuthority
|
|
125
|
+
|
|
126
|
+
return LocalApprovalAuthority
|
|
110
127
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
111
128
|
|
|
112
129
|
|
|
@@ -157,6 +174,8 @@ __all__ = [
|
|
|
157
174
|
"IllegalApprovalTransitionError",
|
|
158
175
|
"InvocationSnapshot",
|
|
159
176
|
"LocalApprovalAuthority",
|
|
177
|
+
"MAX_CANONICAL_BYTES",
|
|
178
|
+
"MAX_CANONICAL_DEPTH",
|
|
160
179
|
"MAX_SAFE_INTEGER",
|
|
161
180
|
"MalformedApprovalError",
|
|
162
181
|
"NO_RESOURCE",
|
|
@@ -167,6 +186,12 @@ __all__ = [
|
|
|
167
186
|
"PolicyProvenance",
|
|
168
187
|
"REQUEST_BINDING_VERSION",
|
|
169
188
|
"RequestValidationError",
|
|
189
|
+
"ResourceKind",
|
|
190
|
+
"ResourceMatchingError",
|
|
191
|
+
"compile_path_pattern",
|
|
192
|
+
"match_resource",
|
|
193
|
+
"normalize_path",
|
|
194
|
+
"normalize_url",
|
|
170
195
|
"Rule",
|
|
171
196
|
"ApprovalStore",
|
|
172
197
|
"ApprovalStoreConfigurationError",
|
|
@@ -181,7 +206,9 @@ __all__ = [
|
|
|
181
206
|
"VerifiedApproval",
|
|
182
207
|
"canonical_request_binding",
|
|
183
208
|
"canonicalize",
|
|
209
|
+
"canonicalize_bytes",
|
|
184
210
|
"canonicalize_request",
|
|
211
|
+
"redact_database_url",
|
|
185
212
|
"new_approval_id",
|
|
186
213
|
"new_request_id",
|
|
187
214
|
"parse_approval_state",
|
|
@@ -202,4 +229,6 @@ __all__ = [
|
|
|
202
229
|
"mcp",
|
|
203
230
|
"dashboard",
|
|
204
231
|
"skills",
|
|
232
|
+
"evaluate_constraints",
|
|
233
|
+
"validate_constraints_schema",
|
|
205
234
|
]
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
"""Compatibility shim for dmint.canonicalize -> dmint.core.canonicalize."""
|
|
1
|
+
"""Compatibility shim for dmint.canonicalize -> dmint.core.canonicalize (deprecated)."""
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
from types import ModuleType
|
|
5
|
+
import warnings
|
|
5
6
|
from .core.canonicalize import * # noqa: F403
|
|
6
7
|
import dmint.core
|
|
7
8
|
|
|
9
|
+
warnings.warn(
|
|
10
|
+
"dmint.canonicalize is deprecated and will be removed in v3.0.0; use dmint.core.canonicalize instead.",
|
|
11
|
+
DeprecationWarning,
|
|
12
|
+
stacklevel=2,
|
|
13
|
+
)
|
|
14
|
+
|
|
8
15
|
|
|
9
16
|
class _CanonicalizeModule(ModuleType):
|
|
10
17
|
def __call__(self, *args, **kwargs):
|
|
@@ -10,6 +10,8 @@ from dmint.cli.compile_policy import main_compile
|
|
|
10
10
|
from dmint.cli.create_policy import main_create
|
|
11
11
|
from dmint.cli.dashboard import main_dashboard
|
|
12
12
|
from dmint.cli.install_skill import main_install_skill
|
|
13
|
+
from dmint.cli.keys import main_export_public_key, main_init_keys
|
|
14
|
+
from dmint.cli.policy_digest import main_policy_digest
|
|
13
15
|
from dmint.cli.verify_policy import main_verify
|
|
14
16
|
from dmint.cli.version import __version__
|
|
15
17
|
|
|
@@ -89,6 +91,10 @@ Recommended Workflow:
|
|
|
89
91
|
install-skill Install Dmint AI coding agent skill into workspace (.agents/skills/) or global config
|
|
90
92
|
dashboard Launch the local human approval dashboard (connects to Core SQLite)
|
|
91
93
|
|
|
94
|
+
Key Management Commands:
|
|
95
|
+
init-keys Generate and persist a new Ed25519 signing key (0600, atomic)
|
|
96
|
+
export-public-key Print the public key (hex + PEM) and issuer ID for the gateway trusted_issuers
|
|
97
|
+
|
|
92
98
|
Approval Commands (Terminal Management):
|
|
93
99
|
pending List all approvals currently in PENDING state
|
|
94
100
|
approve Approve a pending tool execution request with optional audit note
|
|
@@ -123,6 +129,11 @@ Compatibility Commands:
|
|
|
123
129
|
help="Deterministic offline validation of policy.json against Dmint schema and invariants (LLM-free)",
|
|
124
130
|
add_help=False,
|
|
125
131
|
)
|
|
132
|
+
subparsers.add_parser(
|
|
133
|
+
"policy-digest",
|
|
134
|
+
help="Compute the SHA-256 digest of exact policy file bytes",
|
|
135
|
+
add_help=False,
|
|
136
|
+
)
|
|
126
137
|
subparsers.add_parser(
|
|
127
138
|
"install-skill",
|
|
128
139
|
help="Install Dmint AI coding agent skill into workspace (.agents/skills/) or global config",
|
|
@@ -133,6 +144,16 @@ Compatibility Commands:
|
|
|
133
144
|
help="Launch the local human approval dashboard (connects to Core SQLite)",
|
|
134
145
|
add_help=False,
|
|
135
146
|
)
|
|
147
|
+
subparsers.add_parser(
|
|
148
|
+
"init-keys",
|
|
149
|
+
help="Generate and persist a new Ed25519 signing key (0600, atomic)",
|
|
150
|
+
add_help=False,
|
|
151
|
+
)
|
|
152
|
+
subparsers.add_parser(
|
|
153
|
+
"export-public-key",
|
|
154
|
+
help="Print the public key (hex + PEM) and issuer ID for the gateway trusted_issuers",
|
|
155
|
+
add_help=False,
|
|
156
|
+
)
|
|
136
157
|
subparsers.add_parser(
|
|
137
158
|
"pending",
|
|
138
159
|
help="List all approvals currently in PENDING state",
|
|
@@ -176,12 +197,18 @@ Compatibility Commands:
|
|
|
176
197
|
return _run_create_mcp(cmd_args)
|
|
177
198
|
elif cmd == "verify-policy":
|
|
178
199
|
return main_verify(cmd_args)
|
|
200
|
+
elif cmd == "policy-digest":
|
|
201
|
+
return main_policy_digest(cmd_args)
|
|
179
202
|
elif cmd == "compile-policy":
|
|
180
203
|
return main_compile(cmd_args)
|
|
181
204
|
elif cmd == "install-skill":
|
|
182
205
|
return main_install_skill(cmd_args)
|
|
183
206
|
elif cmd == "dashboard":
|
|
184
207
|
return main_dashboard(cmd_args)
|
|
208
|
+
elif cmd == "init-keys":
|
|
209
|
+
return main_init_keys(cmd_args)
|
|
210
|
+
elif cmd == "export-public-key":
|
|
211
|
+
return main_export_public_key(cmd_args)
|
|
185
212
|
elif cmd == "pending":
|
|
186
213
|
return main_pending(cmd_args)
|
|
187
214
|
elif cmd == "approve":
|