@highflame/policy 2.1.13 → 2.1.15

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.
@@ -0,0 +1,668 @@
1
+ // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
+ // Source: schemas/mcp_gateway/templates/templates.json
3
+ //
4
+ // McpGateway default policies and templates.
5
+ // Cedar text is embedded at build time. PolicyRule[] can be parsed at runtime
6
+ // using parseCedarToRules().
7
+ // =============================================================================
8
+ // EMBEDDED CEDAR POLICY TEXT
9
+ // =============================================================================
10
+ const MCP_GATEWAY_BASELINE_DEFAULT_CEDAR = `// =============================================================================
11
+ // Baseline Permit Policy (Default)
12
+ // =============================================================================
13
+ // Permits all actions by default. Threat-specific forbid policies override
14
+ // this to block when detection engines identify issues.
15
+ //
16
+ // Cedar is default-deny: without at least one permit rule, every request
17
+ // is denied regardless of forbid rules.
18
+ //
19
+ // Category: organization
20
+ // Namespace: MCPGateway
21
+ // =============================================================================
22
+
23
+ @id("baseline-permit-all")
24
+ @name("Permit all actions by default")
25
+ @description("Baseline permit for all actions -- threat-specific forbid policies override this when threats are detected")
26
+ @severity("low")
27
+ @tags("baseline,permit-default,organization")
28
+ permit (
29
+ principal,
30
+ action,
31
+ resource
32
+ );
33
+ `;
34
+ const MCP_GATEWAY_SEMANTIC_DEFAULT_CEDAR = `// =============================================================================
35
+ // Semantic Threat Detection Policy (Default)
36
+ // =============================================================================
37
+ // Detects and blocks prompt injection, jailbreak attempts, and high-severity
38
+ // threats in MCP tool calls and server connections.
39
+ //
40
+ // Category: semantic
41
+ // Namespace: MCPGateway
42
+ // =============================================================================
43
+
44
+ // Block content with prompt injection patterns detected by rules
45
+ @id("semantic-block-injection")
46
+ @name("Block prompt injection")
47
+ @description("Block tool calls when detection engine rules identify prompt injection patterns in tool arguments or content")
48
+ @severity("critical")
49
+ @tags("injection,security,owasp-llm01,baseline")
50
+ @reject_message("Tool call was blocked because prompt injection patterns were detected in the content (OWASP LLM01).")
51
+ forbid (
52
+ principal,
53
+ action == MCPGateway::Action::"call_tool",
54
+ resource
55
+ )
56
+ when {
57
+ context has detected_threats && context.detected_threats.contains("prompt_injection")
58
+ };
59
+
60
+ // Block content with high ML injection confidence
61
+ @id("semantic-block-injection-score")
62
+ @name("Block high-confidence injection")
63
+ @description("Block tool calls when the ML injection classifier confidence exceeds 75/100")
64
+ @severity("critical")
65
+ @tags("injection,ml-classifier,security,owasp-llm01")
66
+ @reject_message("Tool call was blocked because the ML classifier detected prompt injection with high confidence.")
67
+ forbid (
68
+ principal,
69
+ action == MCPGateway::Action::"call_tool",
70
+ resource
71
+ )
72
+ when {
73
+ context has injection_confidence && context.injection_confidence >= 75
74
+ };
75
+
76
+ // Block content with jailbreak patterns
77
+ @id("semantic-block-jailbreak")
78
+ @name("Block jailbreak attempts")
79
+ @description("Block tool calls when jailbreak patterns are detected in content")
80
+ @severity("critical")
81
+ @tags("jailbreak,security,owasp-llm02,baseline")
82
+ @reject_message("Tool call was blocked because jailbreak patterns were detected.")
83
+ forbid (
84
+ principal,
85
+ action == MCPGateway::Action::"call_tool",
86
+ resource
87
+ )
88
+ when {
89
+ context has detected_threats && context.detected_threats.contains("jailbreak")
90
+ };
91
+
92
+ // Block content with high ML jailbreak confidence
93
+ @id("semantic-block-jailbreak-score")
94
+ @name("Block high-confidence jailbreak")
95
+ @description("Block tool calls when the ML jailbreak classifier confidence exceeds 75/100")
96
+ @severity("critical")
97
+ @tags("jailbreak,ml-classifier,security,owasp-llm02")
98
+ @reject_message("Tool call was blocked because the ML classifier detected a jailbreak attempt with high confidence.")
99
+ forbid (
100
+ principal,
101
+ action == MCPGateway::Action::"call_tool",
102
+ resource
103
+ )
104
+ when {
105
+ context has jailbreak_confidence && context.jailbreak_confidence >= 75
106
+ };
107
+
108
+ // Block any content with critical severity threats
109
+ @id("semantic-block-critical")
110
+ @name("Block critical threats")
111
+ @description("Block all MCP operations when any detection engine reports critical severity")
112
+ @severity("critical")
113
+ @tags("critical,baseline,security,catch-all")
114
+ @reject_message("MCP operation was blocked because security scanners detected a critical-severity threat.")
115
+ forbid (
116
+ principal,
117
+ action,
118
+ resource
119
+ )
120
+ when {
121
+ context has highest_severity && context.highest_severity == "critical"
122
+ };
123
+
124
+ // Block tool calls with multiple concurrent threats
125
+ @id("semantic-block-multi-threat-tools")
126
+ @name("Block multi-threat tool calls")
127
+ @description("Block tool execution when 3+ distinct threats are detected simultaneously")
128
+ @severity("high")
129
+ @tags("multi-threat,tools,security,defense-in-depth")
130
+ @reject_message("Tool execution was blocked because multiple security threats were detected simultaneously.")
131
+ forbid (
132
+ principal,
133
+ action == MCPGateway::Action::"call_tool",
134
+ resource
135
+ )
136
+ when {
137
+ context has threat_count && context.threat_count >= 3
138
+ };
139
+ `;
140
+ const MCP_GATEWAY_TOOLS_DEFAULT_CEDAR = `// =============================================================================
141
+ // Tool Permissioning Policy (Default)
142
+ // =============================================================================
143
+ // Controls access to MCP tools based on risk scoring, threat detection,
144
+ // and tool classification.
145
+ //
146
+ // Category: tools
147
+ // Namespace: MCPGateway
148
+ // =============================================================================
149
+
150
+ // Block tools with very high computed risk
151
+ @id("tools-block-high-risk-score")
152
+ @name("Block high-risk tool operations")
153
+ @description("Block tool operations when the computed risk score exceeds 90/100")
154
+ @severity("critical")
155
+ @tags("tool-risk,security,owasp-llm06,owasp-asi02")
156
+ @reject_message("Tool execution blocked: this operation scored 90+ on the risk assessment.")
157
+ forbid (
158
+ principal,
159
+ action == MCPGateway::Action::"call_tool",
160
+ resource
161
+ )
162
+ when {
163
+ context has tool_risk_score && context.tool_risk_score >= 90
164
+ };
165
+
166
+ // Block tools classified as dangerous
167
+ @id("tools-block-dangerous-category")
168
+ @name("Block dangerous tool category")
169
+ @description("Block all tools classified as dangerous by the detection engine")
170
+ @severity("critical")
171
+ @tags("tool-category,dangerous,security,owasp-llm06")
172
+ @reject_message("Tool execution blocked: this tool is classified as dangerous.")
173
+ forbid (
174
+ principal,
175
+ action == MCPGateway::Action::"call_tool",
176
+ resource
177
+ )
178
+ when {
179
+ context has tool_category && context.tool_category == "dangerous"
180
+ };
181
+
182
+ // Block sensitive tools when threats are detected
183
+ @id("tools-block-sensitive-with-threats")
184
+ @name("Block sensitive tools with threats")
185
+ @description("Block sensitive tools when any threats are detected concurrently")
186
+ @severity("high")
187
+ @tags("tool-category,sensitive,security,defense-in-depth")
188
+ @reject_message("Sensitive tool execution blocked: threats were detected alongside a sensitive tool operation.")
189
+ forbid (
190
+ principal,
191
+ action == MCPGateway::Action::"call_tool",
192
+ resource
193
+ )
194
+ when {
195
+ context has tool_is_sensitive && context.tool_is_sensitive &&
196
+ context has threat_count && context.threat_count > 0
197
+ };
198
+
199
+ // Block tool calls with high severity threats
200
+ @id("tools-block-high-severity-threats")
201
+ @name("Block tool calls with high severity threats")
202
+ @description("Prevent tool execution when high or critical severity threats are detected")
203
+ @severity("high")
204
+ @tags("tools,threats,severity,security")
205
+ @reject_message("Tool execution was blocked because high or critical severity threats were detected.")
206
+ forbid (
207
+ principal,
208
+ action == MCPGateway::Action::"call_tool",
209
+ resource
210
+ )
211
+ when {
212
+ context has threat_count && context has max_threat_severity &&
213
+ context.threat_count > 0 && context.max_threat_severity >= 3
214
+ };
215
+
216
+ // Block detected command injection patterns
217
+ @id("tools-block-command-injection")
218
+ @name("Block command injection in tool calls")
219
+ @description("Block tool calls when command injection patterns are detected in arguments")
220
+ @severity("critical")
221
+ @tags("command-injection,security,mitre-t1059,owasp-asi02")
222
+ @reject_message("Tool execution blocked: command injection pattern detected in tool arguments.")
223
+ forbid (
224
+ principal,
225
+ action == MCPGateway::Action::"call_tool",
226
+ resource
227
+ )
228
+ when {
229
+ context has detected_threats &&
230
+ context.detected_threats.contains("command_injection")
231
+ };
232
+ `;
233
+ const MCP_GATEWAY_AGENT_SECURITY_DEFAULT_CEDAR = `// =============================================================================
234
+ // Agent Security Policy (Default)
235
+ // =============================================================================
236
+ // Detects and blocks tool poisoning, rug pull attacks, indirect prompt injection,
237
+ // and MCP supply chain threats.
238
+ //
239
+ // Category: agent_security
240
+ // Namespace: MCPGateway
241
+ // =============================================================================
242
+
243
+ // Block tool calls with tool poisoning risk
244
+ @id("as-block-tool-poisoning")
245
+ @name("Block tool poisoning")
246
+ @description("Block tool execution when hidden instructions are detected in tool descriptions or arguments (score >= 70)")
247
+ @severity("critical")
248
+ @tags("tool-poisoning,agent-security,owasp-asi01")
249
+ @reject_message("Tool execution blocked: hidden manipulation instructions detected in tool description or arguments (OWASP ASI01).")
250
+ forbid (
251
+ principal,
252
+ action == MCPGateway::Action::"call_tool",
253
+ resource
254
+ )
255
+ when {
256
+ context has tool_poisoning_score && context.tool_poisoning_score >= 70
257
+ };
258
+
259
+ // Block MCP server connections with poisoning risk
260
+ @id("as-block-server-poisoning")
261
+ @name("Block poisoned MCP servers")
262
+ @description("Block connections to MCP servers when tool poisoning patterns are detected (score >= 60)")
263
+ @severity("critical")
264
+ @tags("tool-poisoning,mcp-security,owasp-asi04,owasp-mcp02")
265
+ @reject_message("MCP server connection blocked: tool poisoning patterns detected in server tool descriptions.")
266
+ forbid (
267
+ principal,
268
+ action == MCPGateway::Action::"connect_server",
269
+ resource
270
+ )
271
+ when {
272
+ context has tool_poisoning_score && context.tool_poisoning_score >= 60
273
+ };
274
+
275
+ // Block tool calls with behavioral drift (rug pull)
276
+ @id("as-block-rug-pull")
277
+ @name("Block rug pull attacks")
278
+ @description("Block tool execution when behavioral drift is detected (score >= 70)")
279
+ @severity("critical")
280
+ @tags("rug-pull,agent-security,owasp-asi04")
281
+ @reject_message("Tool execution blocked: tool behavior has changed significantly from its established pattern.")
282
+ forbid (
283
+ principal,
284
+ action in [MCPGateway::Action::"call_tool", MCPGateway::Action::"connect_server"],
285
+ resource
286
+ )
287
+ when {
288
+ context has rug_pull_score && context.rug_pull_score >= 70
289
+ };
290
+
291
+ // Block with indirect injection from tool outputs
292
+ @id("as-block-indirect-injection")
293
+ @name("Block indirect prompt injection")
294
+ @description("Block when indirect prompt injection is detected in tool outputs (score >= 70)")
295
+ @severity("critical")
296
+ @tags("indirect-injection,owasp-llm01,owasp-asi01")
297
+ @reject_message("Content blocked: indirect prompt injection detected in tool output or retrieved content.")
298
+ forbid (
299
+ principal,
300
+ action in [MCPGateway::Action::"call_tool", MCPGateway::Action::"connect_server"],
301
+ resource
302
+ )
303
+ when {
304
+ context has indirect_injection_score && context.indirect_injection_score >= 70
305
+ };
306
+
307
+ // Strict indirect injection for sensitive tool calls
308
+ @id("as-block-indirect-injection-sensitive-tools")
309
+ @name("Block indirect injection on sensitive tools")
310
+ @description("Lower threshold (>= 50) for indirect injection when the tool is classified as sensitive")
311
+ @severity("critical")
312
+ @tags("indirect-injection,sensitive-tools,owasp-asi02")
313
+ @reject_message("Sensitive tool execution blocked: moderate indirect injection risk detected.")
314
+ forbid (
315
+ principal,
316
+ action == MCPGateway::Action::"call_tool",
317
+ resource
318
+ )
319
+ when {
320
+ context has indirect_injection_score && context.indirect_injection_score >= 50 &&
321
+ context has tool_is_sensitive && context.tool_is_sensitive
322
+ };
323
+
324
+ // Block unverified MCP server tool calls with detected threats
325
+ @id("as-block-unverified-threats")
326
+ @name("Block unverified server threats")
327
+ @description("Block tool calls from unverified MCP servers when any threat is detected")
328
+ @severity("high")
329
+ @tags("mcp-trust,owasp-asi04,supply-chain")
330
+ @reject_message("Tool execution blocked: the MCP server is unverified and security threats were detected.")
331
+ forbid (
332
+ principal,
333
+ action == MCPGateway::Action::"call_tool",
334
+ resource
335
+ )
336
+ when {
337
+ context has mcp_server_verified && context.mcp_server_verified == false &&
338
+ context has threat_count && context.threat_count > 0
339
+ };
340
+
341
+ // Block connections to MCP servers with risky configurations
342
+ @id("as-block-mcp-config-risk")
343
+ @name("Block risky MCP server configs")
344
+ @description("Block MCP server connections when risky configuration patterns are detected (score >= 70)")
345
+ @severity("high")
346
+ @tags("mcp-config,owasp-mcp03,supply-chain")
347
+ @reject_message("MCP server connection blocked: risky server configuration detected.")
348
+ forbid (
349
+ principal,
350
+ action == MCPGateway::Action::"connect_server",
351
+ resource
352
+ )
353
+ when {
354
+ context has mcp_config_risk && context.mcp_config_risk &&
355
+ context has mcp_risk_score && context.mcp_risk_score >= 70
356
+ };
357
+
358
+ // Block connections to unverified MCP servers
359
+ @id("as-block-unverified-server-connect")
360
+ @name("Block unverified MCP server connections")
361
+ @description("Block connections to MCP servers that are not from a verified registry")
362
+ @severity("high")
363
+ @tags("mcp-trust,owasp-asi04,owasp-mcp05,supply-chain")
364
+ @reject_message("MCP server connection blocked: server is not from a verified registry.")
365
+ forbid (
366
+ principal,
367
+ action == MCPGateway::Action::"connect_server",
368
+ resource
369
+ )
370
+ when {
371
+ context has mcp_server_verified && context.mcp_server_verified == false
372
+ };
373
+ `;
374
+ const MCP_GATEWAY_TOOLS_MCP_ALLOWLIST_CEDAR = `// MCP Server Allowlist Template
375
+ // Only allow specific MCP servers to be used
376
+ // Category: tools
377
+ //
378
+ // NOTE: Users should customize the mcp_server values in the permit rule
379
+ // to match their allowed servers before deploying this template.
380
+
381
+ @id("mcp-allowlist-permit")
382
+ @name("Allow specific MCP servers")
383
+ @description("Only allow connections to pre-approved MCP servers (customize the list)")
384
+ @severity("medium")
385
+ @tags("mcp,allowlist,server,governance")
386
+ permit (
387
+ principal,
388
+ action == MCPGateway::Action::"connect_server",
389
+ resource
390
+ )
391
+ when {
392
+ context has mcp_server &&
393
+ (context.mcp_server == "filesystem" ||
394
+ context.mcp_server == "playwright")
395
+ };
396
+
397
+ @id("mcp-allowlist-deny")
398
+ @name("Deny unallowed MCP servers")
399
+ @description("Block all MCP server connections not in the allowlist")
400
+ @severity("medium")
401
+ @tags("mcp,deny-default,server")
402
+ forbid (
403
+ principal,
404
+ action == MCPGateway::Action::"connect_server",
405
+ resource
406
+ );
407
+ `;
408
+ const MCP_GATEWAY_TOOLS_MCP_TOOL_PERMISSIONS_CEDAR = `// =============================================================================
409
+ // MCP Tool Permissions Template (MCPGateway)
410
+ // =============================================================================
411
+ // Per-tool access control for MCP servers.
412
+ // Complements the MCP Server Allowlist (connect_server action)
413
+ // with fine-grained per-tool control on call_tool action.
414
+ //
415
+ // Category: tools
416
+ // Namespace: MCPGateway
417
+ // =============================================================================
418
+
419
+ // -- GitHub MCP: Read-only access -------------------------------------------
420
+
421
+ @id("mcp-tool-allow-read-github")
422
+ @name("Allow read-only GitHub tools")
423
+ @description("Permit read operations from GitHub MCP server")
424
+ @severity("medium")
425
+ @tags("mcp,github,read-only,least-privilege")
426
+ permit (
427
+ principal,
428
+ action == MCPGateway::Action::"call_tool",
429
+ resource
430
+ ) when {
431
+ context has mcp_server && context.mcp_server == "github" &&
432
+ context has tool_name &&
433
+ (context.tool_name == "read_issues" ||
434
+ context.tool_name == "get_issue" ||
435
+ context.tool_name == "list_repos" ||
436
+ context.tool_name == "get_pull_request" ||
437
+ context.tool_name == "search_code" ||
438
+ context.tool_name == "get_file_contents")
439
+ };
440
+
441
+ @id("mcp-tool-deny-write-github")
442
+ @name("Deny write GitHub tools")
443
+ @description("Block create/update/delete operations on GitHub MCP server")
444
+ @severity("high")
445
+ @tags("mcp,github,write-block,least-privilege")
446
+ forbid (
447
+ principal,
448
+ action == MCPGateway::Action::"call_tool",
449
+ resource
450
+ ) when {
451
+ context has mcp_server && context.mcp_server == "github"
452
+ };
453
+
454
+ // -- Organization-wide MCP server exclusions --------------------------------
455
+
456
+ @id("mcp-tool-exclude-server")
457
+ @name("Exclude specific MCP servers")
458
+ @description("Block all tool calls from excluded MCP servers (org-wide exclusion list)")
459
+ @severity("critical")
460
+ @tags("mcp,exclusion,org-wide,block")
461
+ forbid (
462
+ principal,
463
+ action == MCPGateway::Action::"call_tool",
464
+ resource
465
+ ) when {
466
+ context has mcp_server &&
467
+ (context.mcp_server == "untrusted-server" ||
468
+ context.mcp_server == "deprecated-server")
469
+ };
470
+
471
+ // -- Block unverified MCP servers -------------------------------------------
472
+
473
+ @id("mcp-tool-block-unverified")
474
+ @name("Block tools from unverified MCP servers")
475
+ @description("Deny tool calls from MCP servers not in the verified registry")
476
+ @severity("high")
477
+ @tags("mcp,trust,verification")
478
+ forbid (
479
+ principal,
480
+ action == MCPGateway::Action::"call_tool",
481
+ resource
482
+ ) when {
483
+ context has mcp_server_verified && context.mcp_server_verified == false
484
+ };
485
+ `;
486
+ // =============================================================================
487
+ // CATEGORIES
488
+ // =============================================================================
489
+ export const MCP_GATEWAY_CATEGORIES = [
490
+ { id: 'semantic', name: 'Semantic Threat Detection', description: 'Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats in MCP operations' },
491
+ { id: 'tools', name: 'Tool Permissioning', description: 'Control access to MCP tools, enforce risk scoring, and manage per-tool permissions' },
492
+ { id: 'organization', name: 'Organization Rules', description: 'Apply organization-wide policy baselines for MCP gateway operations' },
493
+ { id: 'agent_security', name: 'Agent Security', description: 'Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats' },
494
+ ];
495
+ // =============================================================================
496
+ // DEFAULT POLICIES
497
+ // =============================================================================
498
+ export const MCP_GATEWAY_DEFAULTS = [
499
+ {
500
+ id: 'baseline-default',
501
+ name: 'Baseline Permit',
502
+ description: 'Permits all actions by default -- threat-specific forbid policies override this when threats are detected',
503
+ category: 'organization',
504
+ cedarText: MCP_GATEWAY_BASELINE_DEFAULT_CEDAR,
505
+ severity: 'low',
506
+ tags: ['baseline', 'permit-default', 'organization'],
507
+ isActive: true,
508
+ },
509
+ {
510
+ id: 'semantic-default',
511
+ name: 'Semantic Threat Detection',
512
+ description: 'Detect and block prompt injection, jailbreak attempts, and high-severity threats in MCP tool calls',
513
+ category: 'semantic',
514
+ cedarText: MCP_GATEWAY_SEMANTIC_DEFAULT_CEDAR,
515
+ severity: 'critical',
516
+ tags: ['prompt-injection', 'jailbreak', 'owasp-llm01', 'owasp-llm02', 'security', 'baseline'],
517
+ isActive: true,
518
+ },
519
+ {
520
+ id: 'tools-default',
521
+ name: 'Tool Permissioning',
522
+ description: 'Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments',
523
+ category: 'tools',
524
+ cedarText: MCP_GATEWAY_TOOLS_DEFAULT_CEDAR,
525
+ severity: 'critical',
526
+ tags: ['tool-risk', 'command-injection', 'owasp-llm06', 'owasp-asi02', 'baseline'],
527
+ isActive: true,
528
+ },
529
+ {
530
+ id: 'agent-security-default',
531
+ name: 'Agent Security',
532
+ description: 'Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats',
533
+ category: 'agent_security',
534
+ cedarText: MCP_GATEWAY_AGENT_SECURITY_DEFAULT_CEDAR,
535
+ severity: 'critical',
536
+ tags: ['tool-poisoning', 'rug-pull', 'indirect-injection', 'mcp-security', 'owasp-asi01', 'owasp-asi04', 'baseline'],
537
+ isActive: true,
538
+ },
539
+ ];
540
+ // =============================================================================
541
+ // ALL TEMPLATES
542
+ // =============================================================================
543
+ export const MCP_GATEWAY_TEMPLATES = [
544
+ {
545
+ id: 'tools-mcp-allowlist',
546
+ name: 'MCP Server Allowlist',
547
+ description: 'Only allow specific MCP servers to be used',
548
+ category: 'tools',
549
+ cedarText: MCP_GATEWAY_TOOLS_MCP_ALLOWLIST_CEDAR,
550
+ severity: 'medium',
551
+ tags: ['mcp', 'allowlist', 'whitelist'],
552
+ },
553
+ {
554
+ id: 'tools-mcp-tool-permissions',
555
+ name: 'MCP Tool Permissions',
556
+ description: 'Per-tool access control for MCP servers -- allow specific tools while denying others, exclude servers org-wide, block unverified sources',
557
+ category: 'tools',
558
+ cedarText: MCP_GATEWAY_TOOLS_MCP_TOOL_PERMISSIONS_CEDAR,
559
+ severity: 'high',
560
+ tags: ['mcp', 'tools', 'least-privilege', 'per-server', 'exclusion'],
561
+ },
562
+ ];
563
+ // =============================================================================
564
+ // TEMPLATES METADATA
565
+ // =============================================================================
566
+ /** Raw templates.json metadata for the McpGateway service. */
567
+ export const MCP_GATEWAY_TEMPLATES_JSON = `{
568
+ "service": "mcp_gateway",
569
+ "version": "1.0.0",
570
+ "description": "MCPGateway policy templates for MCP proxy security",
571
+ "categories": [
572
+ {
573
+ "id": "semantic",
574
+ "name": "Semantic Threat Detection",
575
+ "description": "Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats in MCP operations"
576
+ },
577
+ {
578
+ "id": "tools",
579
+ "name": "Tool Permissioning",
580
+ "description": "Control access to MCP tools, enforce risk scoring, and manage per-tool permissions"
581
+ },
582
+ {
583
+ "id": "organization",
584
+ "name": "Organization Rules",
585
+ "description": "Apply organization-wide policy baselines for MCP gateway operations"
586
+ },
587
+ {
588
+ "id": "agent_security",
589
+ "name": "Agent Security",
590
+ "description": "Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats"
591
+ }
592
+ ],
593
+ "defaults": [
594
+ {
595
+ "id": "baseline-default",
596
+ "name": "Baseline Permit",
597
+ "description": "Permits all actions by default -- threat-specific forbid policies override this when threats are detected",
598
+ "category": "organization",
599
+ "file": "defaults/baseline.cedar",
600
+ "severity": "low",
601
+ "tags": ["baseline", "permit-default", "organization"],
602
+ "is_active": true
603
+ },
604
+ {
605
+ "id": "semantic-default",
606
+ "name": "Semantic Threat Detection",
607
+ "description": "Detect and block prompt injection, jailbreak attempts, and high-severity threats in MCP tool calls",
608
+ "category": "semantic",
609
+ "file": "defaults/semantic.cedar",
610
+ "severity": "critical",
611
+ "tags": ["prompt-injection", "jailbreak", "owasp-llm01", "owasp-llm02", "security", "baseline"],
612
+ "is_active": true
613
+ },
614
+ {
615
+ "id": "tools-default",
616
+ "name": "Tool Permissioning",
617
+ "description": "Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments",
618
+ "category": "tools",
619
+ "file": "defaults/tools.cedar",
620
+ "severity": "critical",
621
+ "tags": ["tool-risk", "command-injection", "owasp-llm06", "owasp-asi02", "baseline"],
622
+ "is_active": true
623
+ },
624
+ {
625
+ "id": "agent-security-default",
626
+ "name": "Agent Security",
627
+ "description": "Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats",
628
+ "category": "agent_security",
629
+ "file": "defaults/agent_security.cedar",
630
+ "severity": "critical",
631
+ "tags": ["tool-poisoning", "rug-pull", "indirect-injection", "mcp-security", "owasp-asi01", "owasp-asi04", "baseline"],
632
+ "is_active": true
633
+ }
634
+ ],
635
+ "templates": [
636
+ {
637
+ "id": "tools-mcp-allowlist",
638
+ "name": "MCP Server Allowlist",
639
+ "description": "Only allow specific MCP servers to be used",
640
+ "category": "tools",
641
+ "file": "mcp_server_allowlist.cedar",
642
+ "severity": "medium",
643
+ "tags": ["mcp", "allowlist", "whitelist"]
644
+ },
645
+ {
646
+ "id": "tools-mcp-tool-permissions",
647
+ "name": "MCP Tool Permissions",
648
+ "description": "Per-tool access control for MCP servers -- allow specific tools while denying others, exclude servers org-wide, block unverified sources",
649
+ "category": "tools",
650
+ "file": "mcp_tool_permissions.cedar",
651
+ "severity": "high",
652
+ "tags": ["mcp", "tools", "least-privilege", "per-server", "exclusion"]
653
+ }
654
+ ]
655
+ }
656
+ `;
657
+ // =============================================================================
658
+ // HELPER FUNCTIONS
659
+ // =============================================================================
660
+ export function getMcpGatewayDefaultsByCategory(category) {
661
+ return MCP_GATEWAY_DEFAULTS.filter(d => d.category === category);
662
+ }
663
+ export function getMcpGatewayTemplatesByCategory(category) {
664
+ return MCP_GATEWAY_TEMPLATES.filter(t => t.category === category);
665
+ }
666
+ export function getMcpGatewayTemplateById(id) {
667
+ return MCP_GATEWAY_TEMPLATES.find(t => t.id === id);
668
+ }
@@ -0,0 +1,11 @@
1
+ import type { ServiceEntityMetadata, ActionEntityMetadata } from './entity-metadata-types.gen.js';
2
+ /**
3
+ * McpGateway entity metadata for UI components.
4
+ * Extracted from Cedar schema appliesTo blocks.
5
+ */
6
+ export declare const MCP_GATEWAY_ENTITIES: ServiceEntityMetadata;
7
+ /**
8
+ * Per-action entity mapping for McpGateway.
9
+ * Maps action names to their valid principals and resources.
10
+ */
11
+ export declare const MCP_GATEWAY_ACTION_ENTITIES: Record<string, ActionEntityMetadata>;