protect-mcp 0.4.5 → 0.4.6

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.
package/README.md CHANGED
@@ -222,8 +222,20 @@ Ship with protect-mcp — each prevents a real attack:
222
222
  | `data-exfiltration.json` | Agent data theft via outbound tool abuse | A02, A04 |
223
223
  | `financial-safe.json` | Unauthorized financial transaction | A05, A06 |
224
224
 
225
+ Cedar-native policies are also available in `policies/cedar/`:
226
+
227
+ | Policy | Purpose |
228
+ |--------|---------|
229
+ | `clinejection.cedar` | Cedar equivalent of the clinejection JSON policy |
230
+ | `terraform-destroy.cedar` | Cedar equivalent of the terraform-destroy JSON policy |
231
+ | `spending-authority.cedar` | Spending authority controls — caps per-tool transaction amounts and requires elevated tiers for high-value operations |
232
+
225
233
  ```bash
234
+ # JSON policy
226
235
  npx protect-mcp --policy node_modules/protect-mcp/policies/clinejection.json -- node server.js
236
+
237
+ # Cedar policy (requires @cedar-policy/cedar-wasm)
238
+ npx protect-mcp --policy node_modules/protect-mcp/policies/cedar/spending-authority.cedar --enforce -- node server.js
227
239
  ```
228
240
 
229
241
  Full OWASP Agentic Top 10 mapping: [scopeblind.com/docs/owasp](https://scopeblind.com/docs/owasp)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protect-mcp",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "mcpName": "io.github.tomjwxf/protect-mcp",
5
5
  "description": "Security gateway for MCP servers. Shadow-mode logs, per-tool policies, optional local Ed25519-signed receipts. Programmatic hooks for trust tiers, credential config, and external policy engines.",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,134 @@
1
+ // ============================================================
2
+ // Spending Authority — Cedar Edition
3
+ //
4
+ // AI agents spending money on behalf of humans is the highest-
5
+ // stakes MCP action class. Without cryptographic proof of
6
+ // authorization, merchants cannot distinguish legitimate agent
7
+ // purchases from unauthorized ones, and organizations cannot
8
+ // enforce budget controls across autonomous agent fleets.
9
+ //
10
+ // The receipt proves authorization; it never touches money.
11
+ // The merchant settles through their existing payment rail.
12
+ //
13
+ // Controls: SOC2-CC6.1, SOC2-CC6.3, SOC2-CC6.6, SOC2-CC8.1
14
+ // EU-AI-Art.9, EU-AI-Art.14, EU-AI-Art.52
15
+ // OWASP-A01, OWASP-A04
16
+ // MCP-01, MCP-05, MCP-06
17
+ // NIST-GOVERN-1.1, NIST-GOVERN-1.2, NIST-MAP-3.1
18
+ // NIST-MEASURE-2.1, NIST-MANAGE-2.3
19
+ // ============================================================
20
+
21
+ // ─── Auto-approve: low-value transactions under threshold ────
22
+ // Threshold is configurable per scope (default: $25.00 / 2500 cents)
23
+ @id("sb-spending-001")
24
+ permit (
25
+ principal,
26
+ action == Action::"MCP::Spend::authorize",
27
+ resource
28
+ )
29
+ when {
30
+ resource.amount_cents < context.auto_approve_threshold_cents &&
31
+ context.budget_utilization != "exceeded" &&
32
+ context.category_allowed == true
33
+ };
34
+
35
+ // ─── Require human approval: high-value transactions ─────────
36
+ // Amounts at or above the auto-approve threshold require explicit
37
+ // human confirmation before a receipt is issued.
38
+ @id("sb-spending-002")
39
+ forbid (
40
+ principal,
41
+ action == Action::"MCP::Spend::authorize",
42
+ resource
43
+ )
44
+ when {
45
+ resource.amount_cents >= context.auto_approve_threshold_cents &&
46
+ context.approval_method != "human_confirmed"
47
+ };
48
+
49
+ // ─── Block: budget exhausted ─────────────────────────────────
50
+ // When cumulative spend reaches or exceeds the ceiling, all
51
+ // spending is blocked regardless of amount or approval method.
52
+ @id("sb-spending-003")
53
+ forbid (
54
+ principal,
55
+ action == Action::"MCP::Spend::authorize",
56
+ resource
57
+ )
58
+ when {
59
+ context.budget_utilization == "exceeded"
60
+ };
61
+
62
+ // ─── Block: disallowed merchant category ─────────────────────
63
+ // Organizations configure allowed merchant category codes.
64
+ // Any transaction to a disallowed category is rejected.
65
+ @id("sb-spending-004")
66
+ forbid (
67
+ principal,
68
+ action == Action::"MCP::Spend::authorize",
69
+ resource
70
+ )
71
+ when {
72
+ context.category_allowed == false
73
+ };
74
+
75
+ // ─── Per-agent-tier spending limits ──────────────────────────
76
+ // Unknown agents: $5 max per transaction (500 cents)
77
+ @id("sb-spending-005")
78
+ forbid (
79
+ principal == Agent::"unknown",
80
+ action == Action::"MCP::Spend::authorize",
81
+ resource
82
+ )
83
+ when {
84
+ resource.amount_cents > 500
85
+ };
86
+
87
+ // Signed-known agents: $50 max per transaction (5000 cents)
88
+ @id("sb-spending-006")
89
+ forbid (
90
+ principal == Agent::"signed-known",
91
+ action == Action::"MCP::Spend::authorize",
92
+ resource
93
+ )
94
+ when {
95
+ resource.amount_cents > 5000
96
+ };
97
+
98
+ // Evidenced agents: $500 max per transaction (50000 cents)
99
+ @id("sb-spending-007")
100
+ forbid (
101
+ principal == Agent::"evidenced",
102
+ action == Action::"MCP::Spend::authorize",
103
+ resource
104
+ )
105
+ when {
106
+ resource.amount_cents > 50000
107
+ };
108
+
109
+ // Privileged agents: $5000 max per transaction (500000 cents)
110
+ // Even the highest trust tier has a ceiling — no unlimited spend.
111
+ @id("sb-spending-008")
112
+ forbid (
113
+ principal == Agent::"privileged",
114
+ action == Action::"MCP::Spend::authorize",
115
+ resource
116
+ )
117
+ when {
118
+ resource.amount_cents > 500000
119
+ };
120
+
121
+ // ─── Block: high utilization + large transaction ─────────────
122
+ // When budget is 75%+ consumed, block any single transaction
123
+ // that exceeds 10% of the original ceiling. Prevents a single
124
+ // large purchase from blowing through the remaining budget.
125
+ @id("sb-spending-009")
126
+ forbid (
127
+ principal,
128
+ action == Action::"MCP::Spend::authorize",
129
+ resource
130
+ )
131
+ when {
132
+ context.budget_utilization == "high" &&
133
+ resource.amount_cents > context.ceiling_tenth_cents
134
+ };