@highflame/policy 2.1.35 → 2.1.37

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.
Files changed (81) hide show
  1. package/_schemas/ai_gateway/context.json +431 -11
  2. package/_schemas/ai_gateway/schema.cedarschema +91 -11
  3. package/_schemas/ai_gateway/templates/defaults/agent_security.cedar +66 -43
  4. package/_schemas/ai_gateway/templates/defaults/baseline.cedar +9 -11
  5. package/_schemas/ai_gateway/templates/defaults/semantic.cedar +63 -40
  6. package/_schemas/ai_gateway/templates/defaults/tools.cedar +48 -36
  7. package/_schemas/ai_gateway/templates/llm_default_allow.cedar +9 -10
  8. package/_schemas/ai_gateway/templates/mcp_server_allowlist.cedar +22 -14
  9. package/_schemas/ai_gateway/templates/mcp_tool_permissions.cedar +29 -27
  10. package/_schemas/ai_gateway/templates/pii_redaction.cedar +38 -33
  11. package/_schemas/ai_gateway/templates/templates.json +52 -50
  12. package/_schemas/guardrails/context.json +12 -12
  13. package/_schemas/guardrails/schema.cedarschema +12 -12
  14. package/_schemas/guardrails/templates/defaults/agent_identity.cedar +60 -56
  15. package/_schemas/guardrails/templates/defaults/agentic_safety.cedar +83 -58
  16. package/_schemas/guardrails/templates/defaults/baseline.cedar +9 -12
  17. package/_schemas/guardrails/templates/defaults/injection.cedar +48 -36
  18. package/_schemas/guardrails/templates/defaults/pii.cedar +27 -20
  19. package/_schemas/guardrails/templates/defaults/secrets.cedar +39 -22
  20. package/_schemas/guardrails/templates/defaults/security_patterns.cedar +38 -25
  21. package/_schemas/guardrails/templates/defaults/semantic.cedar +47 -31
  22. package/_schemas/guardrails/templates/defaults/tool_risk.cedar +34 -26
  23. package/_schemas/guardrails/templates/defaults/toxicity.cedar +57 -47
  24. package/_schemas/guardrails/templates/mcp_tool_permissions.cedar +60 -43
  25. package/_schemas/guardrails/templates/profiles/a2a_security/cross_origin.cedar +29 -42
  26. package/_schemas/guardrails/templates/profiles/a2a_security/escalation_detection.cedar +43 -57
  27. package/_schemas/guardrails/templates/profiles/a2a_security/identity_enforcement.cedar +40 -57
  28. package/_schemas/guardrails/templates/profiles/a2a_security/inter_agent_injection.cedar +48 -62
  29. package/_schemas/guardrails/templates/profiles/a2a_security/supply_chain.cedar +40 -56
  30. package/_schemas/guardrails/templates/profiles/advanced_detection/pii.cedar +24 -34
  31. package/_schemas/guardrails/templates/profiles/advanced_detection/secrets.cedar +45 -37
  32. package/_schemas/guardrails/templates/profiles/advanced_detection/threat_severity.cedar +11 -16
  33. package/_schemas/guardrails/templates/profiles/chat_assistant/privacy.cedar +22 -9
  34. package/_schemas/guardrails/templates/profiles/chat_assistant/security.cedar +27 -15
  35. package/_schemas/guardrails/templates/profiles/chat_assistant/trust_safety.cedar +37 -22
  36. package/_schemas/guardrails/templates/profiles/code_agent/agentic_security.cedar +68 -47
  37. package/_schemas/guardrails/templates/profiles/code_agent/encoding.cedar +17 -21
  38. package/_schemas/guardrails/templates/profiles/code_agent/path_security.cedar +74 -73
  39. package/_schemas/guardrails/templates/profiles/code_agent/security.cedar +13 -9
  40. package/_schemas/guardrails/templates/profiles/code_agent/supply_chain.cedar +36 -58
  41. package/_schemas/guardrails/templates/profiles/data_pipeline/agentic_security.cedar +22 -15
  42. package/_schemas/guardrails/templates/profiles/data_pipeline/data_protection.cedar +52 -0
  43. package/_schemas/guardrails/templates/profiles/data_pipeline/privacy.cedar +41 -18
  44. package/_schemas/guardrails/templates/profiles/data_pipeline/security.cedar +18 -36
  45. package/_schemas/guardrails/templates/profiles/multi_agent/agent_safety.cedar +86 -79
  46. package/_schemas/guardrails/templates/profiles/multi_agent/agent_trust.cedar +73 -70
  47. package/_schemas/guardrails/templates/templates.json +198 -217
  48. package/_schemas/overwatch/context.json +14 -14
  49. package/_schemas/overwatch/schema.cedarschema +12 -12
  50. package/_schemas/sentry/context.json +11 -11
  51. package/_schemas/sentry/schema.cedarschema +11 -11
  52. package/_schemas/sentry/templates/defaults/baseline.cedar +8 -12
  53. package/_schemas/sentry/templates/defaults/clipboard.cedar +43 -42
  54. package/_schemas/sentry/templates/defaults/content_safety.cedar +38 -68
  55. package/_schemas/sentry/templates/defaults/file_safety.cedar +18 -26
  56. package/_schemas/sentry/templates/defaults/organization.cedar +10 -17
  57. package/_schemas/sentry/templates/defaults/pii.cedar +52 -73
  58. package/_schemas/sentry/templates/defaults/secrets.cedar +65 -58
  59. package/_schemas/sentry/templates/defaults/semantic.cedar +40 -59
  60. package/_schemas/sentry/templates/templates.json +53 -43
  61. package/dist/ai_gateway-context.gen.d.ts +18 -4
  62. package/dist/ai_gateway-context.gen.js +18 -4
  63. package/dist/ai_gateway-defaults.gen.d.ts +4 -1
  64. package/dist/ai_gateway-defaults.gen.js +398 -320
  65. package/dist/builder.d.ts +2 -1
  66. package/dist/builder.js +5 -2
  67. package/dist/guardrails-context.gen.d.ts +5 -5
  68. package/dist/guardrails-context.gen.js +5 -5
  69. package/dist/guardrails-defaults.gen.d.ts +4 -1
  70. package/dist/guardrails-defaults.gen.js +2130 -1903
  71. package/dist/overwatch-context.gen.d.ts +5 -5
  72. package/dist/overwatch-context.gen.js +5 -5
  73. package/dist/overwatch-defaults.gen.d.ts +4 -1
  74. package/dist/overwatch-defaults.gen.js +560 -566
  75. package/dist/sentry-context.gen.d.ts +3 -3
  76. package/dist/sentry-context.gen.js +3 -3
  77. package/dist/sentry-defaults.gen.d.ts +4 -1
  78. package/dist/sentry-defaults.gen.js +392 -453
  79. package/dist/service-schemas.gen.d.ts +4 -4
  80. package/dist/service-schemas.gen.js +249 -99
  81. package/package.json +1 -1
@@ -7,47 +7,65 @@
7
7
  // =============================================================================
8
8
  // EMBEDDED CEDAR POLICY TEXT
9
9
  // =============================================================================
10
- const AI_GATEWAY_BASELINE_DEFAULT_CEDAR = `// =============================================================================
11
- // Baseline Permit Policy (Default)
10
+ const AI_GATEWAY_ORGANIZATION_PERMIT_BASELINE_CEDAR = `// =============================================================================
11
+ // Baseline Permit (Default)
12
12
  // =============================================================================
13
- // Permits all actions by default. Threat-specific forbid policies override
14
- // this to block when detection engines identify issues.
13
+ // Permits all AI Gateway actions by default. Threat-specific forbid policies
14
+ // override this when detectors fire. Cedar is default-deny: without at least
15
+ // one permit rule, every request is denied regardless of forbid rules.
15
16
  //
16
- // Cedar is default-deny: without at least one permit rule, every request
17
- // is denied regardless of forbid rules.
18
- //
19
- // Category: organization
17
+ // Category: organization
20
18
  // Namespace: AIGateway
21
19
  // =============================================================================
22
20
 
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")
21
+ @id("organization.permit-baseline")
22
+ @name("Permit baseline")
23
+ @description("Permits all AI Gateway actions.")
26
24
  @severity("low")
27
- @tags("baseline,permit-default,organization")
25
+ @tags("category:organization,posture:permit-default")
28
26
  permit (
29
27
  principal,
30
28
  action,
31
29
  resource
32
30
  );
33
31
  `;
34
- const AI_GATEWAY_SEMANTIC_DEFAULT_CEDAR = `// =============================================================================
35
- // Semantic Threat Detection Policy (Default)
32
+ const AI_GATEWAY_SEMANTIC_DEFAULTS_CEDAR = `// =============================================================================
33
+ // Semantic Threat Detection (Default)
36
34
  // =============================================================================
37
- // Detects and blocks prompt injection, jailbreak attempts, and high-severity
38
- // threats in MCP tool calls and server connections.
35
+ // Blocks prompt injection, jailbreak attempts, and high-severity threats in
36
+ // MCP tool calls and LLM prompts. Uses both detection-engine rule triggers and
37
+ // ML classifier confidence scores.
38
+ //
39
+ // Detection layers:
40
+ // - Rule triggers (detected_threats), always available
41
+ // - ML classifier scores (injection_score, jailbreak_score), require API token
42
+ // - Severity aggregation (highest_severity, threat_count), catch-all rules
43
+ //
44
+ // Context keys consumed:
45
+ // - detected_threats: Set<String>
46
+ // - injection_score: Long (0-100)
47
+ // - jailbreak_score: Long (0-100)
48
+ // - highest_severity: String
49
+ // - threat_count: Long
39
50
  //
40
- // Category: semantic
51
+ // Compliance:
52
+ // - OWASP LLM01, OWASP LLM02
53
+ // - MITRE ATLAS AML.T0051, AML.T0054
54
+ //
55
+ // Category: semantic
41
56
  // Namespace: AIGateway
42
57
  // =============================================================================
43
58
 
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")
59
+ // ---------------------------------------------------------------------------
60
+ // Section 1: Prompt injection
61
+ // ---------------------------------------------------------------------------
62
+
63
+ @id("semantic.block-injection-rule")
64
+ @name("Block injection (rule)")
65
+ @description("Blocks call_tool when detected_threats contains \\"prompt_injection\\".")
48
66
  @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).")
67
+ @tags("category:semantic,threat:injection,detection:rule,surface:call-tool,owasp:llm01,mitre:atlas-t0051,posture:baseline")
68
+ @reject_message("Tool execution blocked: prompt injection patterns detected (OWASP LLM01).")
51
69
  forbid (
52
70
  principal,
53
71
  action == AIGateway::Action::"call_tool",
@@ -57,29 +75,31 @@ when {
57
75
  context has detected_threats && context.detected_threats.contains("prompt_injection")
58
76
  };
59
77
 
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")
78
+ @id("semantic.block-injection-ml")
79
+ @name("Block injection (ML)")
80
+ @description("Blocks call_tool when injection_score >= 75.")
64
81
  @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.")
82
+ @tags("category:semantic,threat:injection,detection:ml,surface:call-tool,owasp:llm01,mitre:atlas-t0051")
83
+ @reject_message("Tool execution blocked: the ML classifier detected prompt injection with high confidence.")
67
84
  forbid (
68
85
  principal,
69
86
  action == AIGateway::Action::"call_tool",
70
87
  resource
71
88
  )
72
89
  when {
73
- context has injection_confidence && context.injection_confidence >= 75
90
+ context has injection_score && context.injection_score >= 75
74
91
  };
75
92
 
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")
93
+ // ---------------------------------------------------------------------------
94
+ // Section 2: Jailbreak
95
+ // ---------------------------------------------------------------------------
96
+
97
+ @id("semantic.block-jailbreak-rule")
98
+ @name("Block jailbreak (rule)")
99
+ @description("Blocks call_tool when detected_threats contains \\"jailbreak\\".")
80
100
  @severity("critical")
81
- @tags("jailbreak,security,owasp-llm02,baseline")
82
- @reject_message("Tool call was blocked because jailbreak patterns were detected.")
101
+ @tags("category:semantic,threat:jailbreak,detection:rule,surface:call-tool,owasp:llm02,mitre:atlas-t0054,posture:baseline")
102
+ @reject_message("Tool execution blocked: jailbreak patterns detected (OWASP LLM02).")
83
103
  forbid (
84
104
  principal,
85
105
  action == AIGateway::Action::"call_tool",
@@ -89,29 +109,31 @@ when {
89
109
  context has detected_threats && context.detected_threats.contains("jailbreak")
90
110
  };
91
111
 
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")
112
+ @id("semantic.block-jailbreak-ml")
113
+ @name("Block jailbreak (ML)")
114
+ @description("Blocks call_tool when jailbreak_score >= 75.")
96
115
  @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.")
116
+ @tags("category:semantic,threat:jailbreak,detection:ml,surface:call-tool,owasp:llm02,mitre:atlas-t0054")
117
+ @reject_message("Tool execution blocked: the ML classifier detected a jailbreak attempt with high confidence.")
99
118
  forbid (
100
119
  principal,
101
120
  action == AIGateway::Action::"call_tool",
102
121
  resource
103
122
  )
104
123
  when {
105
- context has jailbreak_confidence && context.jailbreak_confidence >= 75
124
+ context has jailbreak_score && context.jailbreak_score >= 75
106
125
  };
107
126
 
108
- // Block any content with critical severity threats
109
- @id("semantic-block-critical")
127
+ // ---------------------------------------------------------------------------
128
+ // Section 3: Severity aggregation
129
+ // ---------------------------------------------------------------------------
130
+
131
+ @id("semantic.block-critical")
110
132
  @name("Block critical threats")
111
- @description("Block all MCP operations when any detection engine reports critical severity")
133
+ @description("Blocks all MCP operations when highest_severity equals \\"critical\\".")
112
134
  @severity("critical")
113
- @tags("critical,baseline,security,catch-all")
114
- @reject_message("MCP operation was blocked because security scanners detected a critical-severity threat.")
135
+ @tags("category:semantic,detection:aggregate,posture:catch-all")
136
+ @reject_message("MCP operation blocked: a critical-severity threat was detected.")
115
137
  forbid (
116
138
  principal,
117
139
  action,
@@ -121,13 +143,12 @@ when {
121
143
  context has highest_severity && context.highest_severity == "critical"
122
144
  };
123
145
 
124
- // Block tool calls with multiple concurrent threats
125
- @id("semantic-block-multi-threat-tools")
146
+ @id("semantic.block-multi-threat")
126
147
  @name("Block multi-threat tool calls")
127
- @description("Block tool execution when 3+ distinct threats are detected simultaneously")
148
+ @description("Blocks call_tool when threat_count >= 3.")
128
149
  @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.")
150
+ @tags("category:semantic,detection:aggregate,surface:call-tool,posture:catch-all")
151
+ @reject_message("Tool execution blocked: multiple concurrent security threats were detected.")
131
152
  forbid (
132
153
  principal,
133
154
  action == AIGateway::Action::"call_tool",
@@ -137,23 +158,40 @@ when {
137
158
  context has threat_count && context.threat_count >= 3
138
159
  };
139
160
  `;
140
- const AI_GATEWAY_TOOLS_DEFAULT_CEDAR = `// =============================================================================
141
- // Tool Permissioning Policy (Default)
161
+ const AI_GATEWAY_TOOLS_DEFAULTS_CEDAR = `// =============================================================================
162
+ // Tool Permissioning (Default)
142
163
  // =============================================================================
143
- // Controls access to MCP tools based on risk scoring, threat detection,
144
- // and tool classification.
164
+ // Blocks MCP tool calls based on risk scoring, threat detection, and tool
165
+ // classification.
166
+ //
167
+ // Detection layers:
168
+ // - Computed risk score (tool_risk_score)
169
+ // - Detector category labels (tool_category, tool_is_sensitive)
170
+ // - Threat aggregation (threat_count, max_threat_severity)
171
+ // - Detection rule triggers (detected_threats)
172
+ //
173
+ // Context keys consumed:
174
+ // - tool_risk_score: Long (0-100)
175
+ // - tool_category: String
176
+ // - tool_is_sensitive: Bool
177
+ // - threat_count: Long
178
+ // - max_threat_severity: Long (0-4)
179
+ // - detected_threats: Set<String>
145
180
  //
146
- // Category: tools
181
+ // Compliance:
182
+ // - OWASP LLM06, OWASP ASI02
183
+ // - MITRE T1059
184
+ //
185
+ // Category: tools
147
186
  // Namespace: AIGateway
148
187
  // =============================================================================
149
188
 
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")
189
+ @id("tools.block-high-risk-score")
190
+ @name("Block high-risk tools")
191
+ @description("Blocks call_tool when tool_risk_score >= 90.")
154
192
  @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.")
193
+ @tags("category:tools,detection:aggregate,surface:call-tool,owasp:llm06,owasp:asi02")
194
+ @reject_message("Tool execution blocked: tool risk score is at or above 90/100.")
157
195
  forbid (
158
196
  principal,
159
197
  action == AIGateway::Action::"call_tool",
@@ -163,13 +201,12 @@ when {
163
201
  context has tool_risk_score && context.tool_risk_score >= 90
164
202
  };
165
203
 
166
- // Block tools classified as dangerous
167
- @id("tools-block-dangerous-category")
204
+ @id("tools.block-dangerous-category")
168
205
  @name("Block dangerous tool category")
169
- @description("Block all tools classified as dangerous by the detection engine")
206
+ @description("Blocks call_tool when tool_category equals \\"dangerous\\".")
170
207
  @severity("critical")
171
- @tags("tool-category,dangerous,security,owasp-llm06")
172
- @reject_message("Tool execution blocked: this tool is classified as dangerous.")
208
+ @tags("category:tools,detection:rule,surface:call-tool,owasp:llm06")
209
+ @reject_message("Tool execution blocked: tool is classified as dangerous.")
173
210
  forbid (
174
211
  principal,
175
212
  action == AIGateway::Action::"call_tool",
@@ -179,30 +216,28 @@ when {
179
216
  context has tool_category && context.tool_category == "dangerous"
180
217
  };
181
218
 
182
- // Block sensitive tools when threats are detected
183
- @id("tools-block-sensitive-with-threats")
219
+ @id("tools.block-sensitive-with-threats")
184
220
  @name("Block sensitive tools with threats")
185
- @description("Block sensitive tools when any threats are detected concurrently")
221
+ @description("Blocks call_tool when tool_is_sensitive is true and threat_count >= 1.")
186
222
  @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.")
223
+ @tags("category:tools,detection:aggregate,surface:call-tool,owasp:llm06")
224
+ @reject_message("Tool execution blocked: a sensitive tool was called while threats were detected.")
189
225
  forbid (
190
226
  principal,
191
227
  action == AIGateway::Action::"call_tool",
192
228
  resource
193
229
  )
194
230
  when {
195
- context has tool_is_sensitive && context.tool_is_sensitive &&
196
- context has threat_count && context.threat_count > 0
231
+ context has tool_is_sensitive && context.tool_is_sensitive == true &&
232
+ context has threat_count && context.threat_count >= 1
197
233
  };
198
234
 
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")
235
+ @id("tools.block-high-severity")
236
+ @name("Block high-severity tool calls")
237
+ @description("Blocks call_tool when threat_count >= 1 and max_threat_severity >= 3.")
203
238
  @severity("high")
204
- @tags("tools,threats,severity,security")
205
- @reject_message("Tool execution was blocked because high or critical severity threats were detected.")
239
+ @tags("category:tools,detection:aggregate,surface:call-tool")
240
+ @reject_message("Tool execution blocked: high or critical severity threats were detected.")
206
241
  forbid (
207
242
  principal,
208
243
  action == AIGateway::Action::"call_tool",
@@ -210,15 +245,14 @@ forbid (
210
245
  )
211
246
  when {
212
247
  context has threat_count && context has max_threat_severity &&
213
- context.threat_count > 0 && context.max_threat_severity >= 3
248
+ context.threat_count >= 1 && context.max_threat_severity >= 3
214
249
  };
215
250
 
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")
251
+ @id("tools.block-command-injection")
252
+ @name("Block command injection")
253
+ @description("Blocks call_tool when detected_threats contains \\"command_injection\\".")
220
254
  @severity("critical")
221
- @tags("command-injection,security,mitre-t1059,owasp-asi02")
255
+ @tags("category:tools,threat:command-injection,detection:rule,surface:call-tool,mitre:t1059,owasp:asi02")
222
256
  @reject_message("Tool execution blocked: command injection pattern detected in tool arguments.")
223
257
  forbid (
224
258
  principal,
@@ -226,27 +260,44 @@ forbid (
226
260
  resource
227
261
  )
228
262
  when {
229
- context has detected_threats &&
230
- context.detected_threats.contains("command_injection")
263
+ context has detected_threats && context.detected_threats.contains("command_injection")
231
264
  };
232
265
  `;
233
- const AI_GATEWAY_AGENT_SECURITY_DEFAULT_CEDAR = `// =============================================================================
234
- // Agent Security Policy (Default)
266
+ const AI_GATEWAY_AGENT_SECURITY_DEFAULTS_CEDAR = `// =============================================================================
267
+ // Agent Security (Default)
235
268
  // =============================================================================
236
- // Detects and blocks tool poisoning, rug pull attacks, indirect prompt injection,
237
- // and MCP supply chain threats.
269
+ // Blocks tool poisoning, rug pull behavioral drift, indirect prompt injection
270
+ // from tool outputs, and MCP supply-chain risks (unverified servers, risky
271
+ // configurations).
272
+ //
273
+ // Context keys consumed:
274
+ // - tool_poisoning_score: Long (0-100)
275
+ // - rug_pull_score: Long (0-100)
276
+ // - indirect_injection_score: Long (0-100)
277
+ // - tool_is_sensitive: Bool
278
+ // - mcp_server_verified: Bool
279
+ // - mcp_config_risk: Bool
280
+ // - mcp_risk_score: Long (0-100)
281
+ // - threat_count: Long
282
+ //
283
+ // Compliance:
284
+ // - OWASP LLM01, OWASP ASI01, OWASP ASI02, OWASP ASI04
285
+ // - OWASP MCP02, MCP03, MCP05
238
286
  //
239
- // Category: agent_security
287
+ // Category: agent-security
240
288
  // Namespace: AIGateway
241
289
  // =============================================================================
242
290
 
243
- // Block tool calls with tool poisoning risk
244
- @id("as-block-tool-poisoning")
291
+ // ---------------------------------------------------------------------------
292
+ // Section 1: Tool poisoning
293
+ // ---------------------------------------------------------------------------
294
+
295
+ @id("agent-security.block-tool-poisoning")
245
296
  @name("Block tool poisoning")
246
- @description("Block tool execution when hidden instructions are detected in tool descriptions or arguments (score >= 70)")
297
+ @description("Blocks call_tool when tool_poisoning_score >= 70.")
247
298
  @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).")
299
+ @tags("category:agent-security,threat:tool-poisoning,detection:ml,surface:call-tool,owasp:asi01")
300
+ @reject_message("Tool execution blocked: hidden manipulation instructions detected (OWASP ASI01).")
250
301
  forbid (
251
302
  principal,
252
303
  action == AIGateway::Action::"call_tool",
@@ -256,12 +307,11 @@ when {
256
307
  context has tool_poisoning_score && context.tool_poisoning_score >= 70
257
308
  };
258
309
 
259
- // Block MCP server connections with poisoning risk
260
- @id("as-block-server-poisoning")
310
+ @id("agent-security.block-server-poisoning")
261
311
  @name("Block poisoned MCP servers")
262
- @description("Block connections to MCP servers when tool poisoning patterns are detected (score >= 60)")
312
+ @description("Blocks connect_server when tool_poisoning_score >= 60.")
263
313
  @severity("critical")
264
- @tags("tool-poisoning,mcp-security,owasp-asi04,owasp-mcp02")
314
+ @tags("category:agent-security,threat:tool-poisoning,detection:ml,surface:connect-server,owasp:asi04,owasp:mcp02")
265
315
  @reject_message("MCP server connection blocked: tool poisoning patterns detected in server tool descriptions.")
266
316
  forbid (
267
317
  principal,
@@ -272,13 +322,16 @@ when {
272
322
  context has tool_poisoning_score && context.tool_poisoning_score >= 60
273
323
  };
274
324
 
275
- // Block tool calls with behavioral drift (rug pull)
276
- @id("as-block-rug-pull")
325
+ // ---------------------------------------------------------------------------
326
+ // Section 2: Rug pull (behavioral drift)
327
+ // ---------------------------------------------------------------------------
328
+
329
+ @id("agent-security.block-rug-pull")
277
330
  @name("Block rug pull attacks")
278
- @description("Block tool execution when behavioral drift is detected (score >= 70)")
331
+ @description("Blocks call_tool and connect_server when rug_pull_score >= 70.")
279
332
  @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.")
333
+ @tags("category:agent-security,threat:rug-pull,detection:ml,owasp:asi04")
334
+ @reject_message("Tool execution blocked: tool behavior has drifted significantly from its established pattern.")
282
335
  forbid (
283
336
  principal,
284
337
  action in [AIGateway::Action::"call_tool", AIGateway::Action::"connect_server"],
@@ -288,12 +341,15 @@ when {
288
341
  context has rug_pull_score && context.rug_pull_score >= 70
289
342
  };
290
343
 
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)")
344
+ // ---------------------------------------------------------------------------
345
+ // Section 3: Indirect prompt injection
346
+ // ---------------------------------------------------------------------------
347
+
348
+ @id("agent-security.block-indirect-injection")
349
+ @name("Block indirect injection")
350
+ @description("Blocks call_tool and connect_server when indirect_injection_score >= 70.")
295
351
  @severity("critical")
296
- @tags("indirect-injection,owasp-llm01,owasp-asi01")
352
+ @tags("category:agent-security,threat:indirect-injection,detection:ml,owasp:llm01,owasp:asi01")
297
353
  @reject_message("Content blocked: indirect prompt injection detected in tool output or retrieved content.")
298
354
  forbid (
299
355
  principal,
@@ -304,13 +360,12 @@ when {
304
360
  context has indirect_injection_score && context.indirect_injection_score >= 70
305
361
  };
306
362
 
307
- // Strict indirect injection for sensitive tool calls
308
- @id("as-block-indirect-injection-sensitive-tools")
363
+ @id("agent-security.block-indirect-injection-sensitive")
309
364
  @name("Block indirect injection on sensitive tools")
310
- @description("Lower threshold (>= 50) for indirect injection when the tool is classified as sensitive")
365
+ @description("Blocks call_tool when tool_is_sensitive is true and indirect_injection_score >= 50.")
311
366
  @severity("critical")
312
- @tags("indirect-injection,sensitive-tools,owasp-asi02")
313
- @reject_message("Sensitive tool execution blocked: moderate indirect injection risk detected.")
367
+ @tags("category:agent-security,threat:indirect-injection,detection:ml,surface:call-tool,owasp:asi02")
368
+ @reject_message("Tool execution blocked: a sensitive tool was called with moderate indirect-injection risk.")
314
369
  forbid (
315
370
  principal,
316
371
  action == AIGateway::Action::"call_tool",
@@ -318,15 +373,18 @@ forbid (
318
373
  )
319
374
  when {
320
375
  context has indirect_injection_score && context.indirect_injection_score >= 50 &&
321
- context has tool_is_sensitive && context.tool_is_sensitive
376
+ context has tool_is_sensitive && context.tool_is_sensitive == true
322
377
  };
323
378
 
324
- // Block unverified MCP server tool calls with detected threats
325
- @id("as-block-unverified-threats")
379
+ // ---------------------------------------------------------------------------
380
+ // Section 4: MCP supply chain & trust
381
+ // ---------------------------------------------------------------------------
382
+
383
+ @id("agent-security.block-unverified-threats")
326
384
  @name("Block unverified server threats")
327
- @description("Block tool calls from unverified MCP servers when any threat is detected")
385
+ @description("Blocks call_tool when mcp_server_verified is false and threat_count >= 1.")
328
386
  @severity("high")
329
- @tags("mcp-trust,owasp-asi04,supply-chain")
387
+ @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:call-tool,owasp:asi04")
330
388
  @reject_message("Tool execution blocked: the MCP server is unverified and security threats were detected.")
331
389
  forbid (
332
390
  principal,
@@ -335,15 +393,14 @@ forbid (
335
393
  )
336
394
  when {
337
395
  context has mcp_server_verified && context.mcp_server_verified == false &&
338
- context has threat_count && context.threat_count > 0
396
+ context has threat_count && context.threat_count >= 1
339
397
  };
340
398
 
341
- // Block connections to MCP servers with risky configurations
342
- @id("as-block-mcp-config-risk")
399
+ @id("agent-security.block-mcp-config-risk")
343
400
  @name("Block risky MCP server configs")
344
- @description("Block MCP server connections when risky configuration patterns are detected (score >= 70)")
401
+ @description("Blocks connect_server when mcp_config_risk is true and mcp_risk_score >= 70.")
345
402
  @severity("high")
346
- @tags("mcp-config,owasp-mcp03,supply-chain")
403
+ @tags("category:agent-security,threat:mcp-config-risk,detection:ml,surface:connect-server,owasp:mcp03")
347
404
  @reject_message("MCP server connection blocked: risky server configuration detected.")
348
405
  forbid (
349
406
  principal,
@@ -351,16 +408,15 @@ forbid (
351
408
  resource
352
409
  )
353
410
  when {
354
- context has mcp_config_risk && context.mcp_config_risk &&
411
+ context has mcp_config_risk && context.mcp_config_risk == true &&
355
412
  context has mcp_risk_score && context.mcp_risk_score >= 70
356
413
  };
357
414
 
358
- // Block connections to unverified MCP servers
359
- @id("as-block-unverified-server-connect")
415
+ @id("agent-security.block-unverified-server")
360
416
  @name("Block unverified MCP server connections")
361
- @description("Block connections to MCP servers that are not from a verified registry")
417
+ @description("Blocks connect_server when mcp_server_verified is false.")
362
418
  @severity("high")
363
- @tags("mcp-trust,owasp-asi04,owasp-mcp05,supply-chain")
419
+ @tags("category:agent-security,threat:supply-chain,detection:rule,surface:connect-server,owasp:asi04,owasp:mcp05")
364
420
  @reject_message("MCP server connection blocked: server is not from a verified registry.")
365
421
  forbid (
366
422
  principal,
@@ -371,18 +427,25 @@ when {
371
427
  context has mcp_server_verified && context.mcp_server_verified == false
372
428
  };
373
429
  `;
374
- const AI_GATEWAY_TOOLS_MCP_ALLOWLIST_CEDAR = `// MCP Server Allowlist Template
375
- // Only allow specific MCP servers to be used
376
- // Category: tools
430
+ const AI_GATEWAY_TOOLS_MCP_SERVER_ALLOWLIST_CEDAR = `// =============================================================================
431
+ // MCP Server Allowlist
432
+ // =============================================================================
433
+ // Restricts MCP server connections to a pre-approved list. Customize the
434
+ // \`context.mcp_server\` values in the permit rule to match the allowed
435
+ // servers for your environment.
436
+ //
437
+ // Context keys consumed:
438
+ // - mcp_server: String
377
439
  //
378
- // NOTE: Users should customize the mcp_server values in the permit rule
379
- // to match their allowed servers before deploying this template.
440
+ // Category: tools
441
+ // Namespace: AIGateway
442
+ // =============================================================================
380
443
 
381
- @id("mcp-allowlist-permit")
382
- @name("Allow specific MCP servers")
383
- @description("Only allow connections to pre-approved MCP servers (customize the list)")
444
+ @id("tools.allow-mcp-allowlist")
445
+ @name("Allow allowlisted MCP servers")
446
+ @description("Permits connect_server when mcp_server is in the allowlist.")
384
447
  @severity("medium")
385
- @tags("mcp,allowlist,server,governance")
448
+ @tags("category:tools,surface:connect-server,scope:org-wide,posture:deny-default")
386
449
  permit (
387
450
  principal,
388
451
  action == AIGateway::Action::"connect_server",
@@ -391,14 +454,15 @@ permit (
391
454
  when {
392
455
  context has mcp_server &&
393
456
  (context.mcp_server == "filesystem" ||
394
- context.mcp_server == "playwright")
457
+ context.mcp_server == "playwright")
395
458
  };
396
459
 
397
- @id("mcp-allowlist-deny")
398
- @name("Deny unallowed MCP servers")
399
- @description("Block all MCP server connections not in the allowlist")
460
+ @id("tools.deny-non-allowlisted-mcp")
461
+ @name("Block non-allowlisted MCP servers")
462
+ @description("Blocks connect_server unconditionally so only the allowlist permit applies.")
400
463
  @severity("medium")
401
- @tags("mcp,deny-default,server")
464
+ @tags("category:tools,surface:connect-server,scope:org-wide,posture:deny-default")
465
+ @reject_message("MCP server connection blocked: server is not on the allowlist.")
402
466
  forbid (
403
467
  principal,
404
468
  action == AIGateway::Action::"connect_server",
@@ -406,81 +470,92 @@ forbid (
406
470
  );
407
471
  `;
408
472
  const AI_GATEWAY_TOOLS_MCP_TOOL_PERMISSIONS_CEDAR = `// =============================================================================
409
- // MCP Tool Permissions Template (AIGateway)
473
+ // MCP Tool Permissions
410
474
  // =============================================================================
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.
475
+ // Per-tool access control for MCP servers. Complements MCP Server Allowlist
476
+ // (which gates connect_server) with fine-grained control on call_tool.
477
+ //
478
+ // Ships permit-all by default plus two opt-in safety rails (exclude
479
+ // untrusted/deprecated servers, block unverified servers). Add additional
480
+ // forbid rules to gate specific servers or tools.
414
481
  //
415
- // Defaults to permit-all. Customize per-tool gating by adding forbid rules
416
- // scoped to specific mcp_server / tool_name combinations.
482
+ // Context keys consumed:
483
+ // - mcp_server: String
484
+ // - mcp_server_verified: Bool
417
485
  //
418
- // Category: tools
486
+ // Category: tools
419
487
  // Namespace: AIGateway
420
488
  // =============================================================================
421
489
 
422
- // -- Permit all MCP tool calls (opt-in default) -----------------------------
423
-
424
- @id("mcp-tool-allow-all")
425
- @name("Allow all MCP tool calls")
426
- @description("Permit every call_tool action. Add forbid rules below for per-tool gating.")
490
+ @id("tools.allow-mcp-tools-baseline")
491
+ @name("Permit MCP tool calls")
492
+ @description("Permits all call_tool actions; combine with forbid rules for gating.")
427
493
  @severity("low")
428
- @tags("mcp,permit-default")
494
+ @tags("category:tools,surface:call-tool,posture:permit-default")
429
495
  permit (
430
496
  principal,
431
497
  action == AIGateway::Action::"call_tool",
432
498
  resource
433
499
  );
434
500
 
435
- // -- Organization-wide MCP server exclusions --------------------------------
436
-
437
- @id("mcp-tool-exclude-server")
438
- @name("Exclude specific MCP servers")
439
- @description("Block all tool calls from excluded MCP servers (org-wide exclusion list)")
501
+ @id("tools.exclude-mcp-servers")
502
+ @name("Block excluded MCP servers")
503
+ @description("Blocks call_tool when mcp_server is in the org-wide exclusion list.")
440
504
  @severity("critical")
441
- @tags("mcp,exclusion,org-wide,block")
505
+ @tags("category:tools,surface:call-tool,scope:org-wide,posture:deny-default")
506
+ @reject_message("Tool execution blocked: MCP server is on the org-wide exclusion list.")
442
507
  forbid (
443
508
  principal,
444
509
  action == AIGateway::Action::"call_tool",
445
510
  resource
446
- ) when {
511
+ )
512
+ when {
447
513
  context has mcp_server &&
448
514
  (context.mcp_server == "untrusted-server" ||
449
515
  context.mcp_server == "deprecated-server")
450
516
  };
451
517
 
452
- // -- Block unverified MCP servers -------------------------------------------
453
-
454
- @id("mcp-tool-block-unverified")
455
- @name("Block tools from unverified MCP servers")
456
- @description("Deny tool calls from MCP servers not in the verified registry")
518
+ @id("tools.block-unverified-mcp-tools")
519
+ @name("Block unverified MCP server tools")
520
+ @description("Blocks call_tool when mcp_server_verified is false.")
457
521
  @severity("high")
458
- @tags("mcp,trust,verification")
522
+ @tags("category:tools,threat:supply-chain,detection:rule,surface:call-tool")
523
+ @reject_message("Tool execution blocked: MCP server is not from a verified registry.")
459
524
  forbid (
460
525
  principal,
461
526
  action == AIGateway::Action::"call_tool",
462
527
  resource
463
- ) when {
528
+ )
529
+ when {
464
530
  context has mcp_server_verified && context.mcp_server_verified == false
465
531
  };
466
532
  `;
467
- const AI_GATEWAY_DATA_PII_REDACTION_CEDAR = `// =============================================================================
468
- // PII Redaction Policy
533
+ const AI_GATEWAY_DATA_PROTECTION_PII_REDACTION_CEDAR = `// =============================================================================
534
+ // PII & Secrets Redaction
469
535
  // =============================================================================
470
- // Block or redact requests containing personally identifiable information.
471
- // Covers all AI Gateway actions (MCP tool calls, LLM prompts, file ops).
536
+ // Blocks AI Gateway operations when personally identifiable information or
537
+ // secrets are detected in the content. Covers both LLM prompt processing
538
+ // and MCP tool calls, plus a bulk-exposure catch-all.
539
+ //
540
+ // Context keys consumed:
541
+ // - pii_detected: Bool
542
+ // - secrets_detected: Bool
543
+ // - pii_count: Long
544
+ //
545
+ // Compliance:
546
+ // - OWASP LLM06
547
+ // - GDPR, HIPAA (depending on data classification)
472
548
  //
473
- // Category: data_protection
549
+ // Category: data-protection
474
550
  // Namespace: AIGateway
475
551
  // =============================================================================
476
552
 
477
- // Block requests with PII detected
478
- @id("data-block-pii")
479
- @name("Block PII in requests")
480
- @description("Block any AI Gateway operation when PII is detected in the content")
553
+ @id("data-protection.block-pii")
554
+ @name("Block PII in prompts")
555
+ @description("Blocks process_prompt when pii_detected is true.")
481
556
  @severity("high")
482
- @tags("pii,data-protection,owasp-llm06,dlp")
483
- @reject_message("Request was blocked because personally identifiable information (PII) was detected. Remove sensitive data before retrying.")
557
+ @tags("category:data-protection,threat:pii,detection:rule,surface:process-prompt,owasp:llm06")
558
+ @reject_message("Prompt blocked: personally identifiable information was detected remove sensitive data and retry.")
484
559
  forbid (
485
560
  principal,
486
561
  action == AIGateway::Action::"process_prompt",
@@ -490,29 +565,27 @@ when {
490
565
  context has pii_detected && context.pii_detected == true
491
566
  };
492
567
 
493
- // Block requests with secrets/credentials
494
- @id("data-block-secrets")
495
- @name("Block secrets in requests")
496
- @description("Block any AI Gateway operation when secrets or credentials are detected")
568
+ @id("data-protection.block-secrets")
569
+ @name("Block secrets in prompts")
570
+ @description("Blocks process_prompt when secrets_detected is true.")
497
571
  @severity("critical")
498
- @tags("secrets,data-protection,credentials,dlp")
499
- @reject_message("Request was blocked because secrets or credentials were detected in the content. Remove sensitive credentials before retrying.")
572
+ @tags("category:data-protection,threat:secrets,detection:rule,surface:process-prompt")
573
+ @reject_message("Prompt blocked: secrets or credentials were detected remove sensitive data and retry.")
500
574
  forbid (
501
575
  principal,
502
576
  action == AIGateway::Action::"process_prompt",
503
577
  resource
504
578
  )
505
579
  when {
506
- context has contains_secrets && context.contains_secrets == true
580
+ context has secrets_detected && context.secrets_detected == true
507
581
  };
508
582
 
509
- // Block MCP tool calls with PII
510
- @id("data-block-pii-tools")
583
+ @id("data-protection.block-pii-tools")
511
584
  @name("Block PII in tool calls")
512
- @description("Block MCP tool execution when PII is detected in tool arguments")
585
+ @description("Blocks call_tool when pii_detected is true.")
513
586
  @severity("high")
514
- @tags("pii,tools,data-protection,dlp")
515
- @reject_message("Tool call was blocked because PII was detected in the arguments.")
587
+ @tags("category:data-protection,threat:pii,detection:rule,surface:call-tool,owasp:llm06")
588
+ @reject_message("Tool execution blocked: personally identifiable information was detected in tool arguments.")
516
589
  forbid (
517
590
  principal,
518
591
  action == AIGateway::Action::"call_tool",
@@ -522,29 +595,27 @@ when {
522
595
  context has pii_detected && context.pii_detected == true
523
596
  };
524
597
 
525
- // Block MCP tool calls with secrets
526
- @id("data-block-secrets-tools")
598
+ @id("data-protection.block-secrets-tools")
527
599
  @name("Block secrets in tool calls")
528
- @description("Block MCP tool execution when secrets or credentials are detected")
600
+ @description("Blocks call_tool when secrets_detected is true.")
529
601
  @severity("critical")
530
- @tags("secrets,tools,data-protection,dlp")
531
- @reject_message("Tool call was blocked because secrets were detected in the arguments.")
602
+ @tags("category:data-protection,threat:secrets,detection:rule,surface:call-tool")
603
+ @reject_message("Tool execution blocked: secrets or credentials were detected in tool arguments.")
532
604
  forbid (
533
605
  principal,
534
606
  action == AIGateway::Action::"call_tool",
535
607
  resource
536
608
  )
537
609
  when {
538
- context has contains_secrets && context.contains_secrets == true
610
+ context has secrets_detected && context.secrets_detected == true
539
611
  };
540
612
 
541
- // Block bulk PII exposure (3+ PII matches)
542
- @id("data-block-bulk-pii")
613
+ @id("data-protection.block-pii-bulk")
543
614
  @name("Block bulk PII exposure")
544
- @description("Block operations with 3 or more PII matches -- indicates data dump or exfiltration attempt")
615
+ @description("Blocks any action when pii_count >= 3.")
545
616
  @severity("critical")
546
- @tags("pii,bulk,data-protection,exfiltration")
547
- @reject_message("Request was blocked because multiple PII matches were detected, indicating potential data exfiltration.")
617
+ @tags("category:data-protection,threat:exfiltration,detection:aggregate,posture:catch-all")
618
+ @reject_message("Request blocked: multiple PII matches were detected possible data exfiltration.")
548
619
  forbid (
549
620
  principal,
550
621
  action,
@@ -554,23 +625,22 @@ when {
554
625
  context has pii_count && context.pii_count >= 3
555
626
  };
556
627
  `;
557
- const AI_GATEWAY_LLM_DEFAULT_ALLOW_CEDAR = `// =============================================================================
558
- // Default Allow LLM Proxy Calls
628
+ const AI_GATEWAY_ORGANIZATION_PERMIT_LLM_DEFAULT_CEDAR = `// =============================================================================
629
+ // LLM Default Allow
559
630
  // =============================================================================
560
- // Permits all LLM prompt processing by default. Deploy this alongside
561
- // threat-specific forbid policies to create a "default allow, block on threat"
562
- // posture for LLM chat completions.
631
+ // Permits all LLM prompt processing by default. Deploy alongside threat-specific
632
+ // forbid policies to create a "default allow, block on threat" posture for LLM
633
+ // chat completions.
563
634
  //
564
- // Category: organization
635
+ // Category: organization
565
636
  // Namespace: AIGateway
566
637
  // =============================================================================
567
638
 
568
- // Allow all LLM prompt processing by default
569
- @id("llm-permit-all-prompts")
570
- @name("Allow all LLM proxy calls")
571
- @description("Permits all LLM chat completion requests by default -- threat-specific forbid policies override this when threats are detected")
639
+ @id("organization.permit-llm-default")
640
+ @name("Permit LLM proxy calls")
641
+ @description("Permits all process_prompt actions for the LLM proxy.")
572
642
  @severity("low")
573
- @tags("llm,permit-default,organization,proxy")
643
+ @tags("category:organization,surface:process-prompt,posture:permit-default")
574
644
  permit (
575
645
  principal,
576
646
  action == AIGateway::Action::"process_prompt",
@@ -581,97 +651,103 @@ permit (
581
651
  // CATEGORIES
582
652
  // =============================================================================
583
653
  export const AI_GATEWAY_CATEGORIES = [
584
- { id: 'semantic', name: 'Semantic Threat Detection', description: 'Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats' },
585
- { id: 'tools', name: 'Tool Permissioning', description: 'Control access to MCP tools, enforce risk scoring, and manage per-tool permissions' },
586
- { id: 'agent_security', name: 'Agent Security', description: 'Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats' },
587
- { id: 'data_protection', name: 'Data Protection', description: 'Prevent secrets and PII leakage in LLM chat completions and MCP operations' },
588
- { id: 'content_safety', name: 'Content Safety', description: 'Enforce content moderation score thresholds on LLM prompts and MCP content' },
589
- { id: 'organization', name: 'Organization Rules', description: 'Apply organization-wide policy baselines for AI gateway operations' },
654
+ { id: 'semantic', name: 'Semantic Threat Detection', description: 'Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats.' },
655
+ { id: 'tools', name: 'Tool Permissioning', description: 'Control access to MCP tools, enforce risk scoring, and manage per-tool permissions.' },
656
+ { id: 'agent-security', name: 'Agent Security', description: 'Detect tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats.' },
657
+ { id: 'data-protection', name: 'Data Protection', description: 'Prevent secrets and PII leakage in LLM chat completions and MCP operations.' },
658
+ { id: 'organization', name: 'Organization', description: 'Organization-wide baselines and default permit policies.' },
590
659
  ];
591
660
  // =============================================================================
592
661
  // DEFAULT POLICIES
593
662
  // =============================================================================
594
663
  export const AI_GATEWAY_DEFAULTS = [
595
664
  {
596
- id: 'baseline-default',
665
+ id: 'organization.permit-baseline',
597
666
  name: 'Baseline Permit',
598
- description: 'Permits all actions by default -- threat-specific forbid policies override this when threats are detected',
667
+ description: 'Permits all actions by default; threat-specific forbid policies override this when detectors fire.',
599
668
  category: 'organization',
600
- cedarText: AI_GATEWAY_BASELINE_DEFAULT_CEDAR,
669
+ cedarText: AI_GATEWAY_ORGANIZATION_PERMIT_BASELINE_CEDAR,
601
670
  severity: 'low',
602
- tags: ['baseline', 'permit-default', 'organization'],
671
+ tags: ['category:organization', 'posture:permit-default'],
603
672
  isActive: true,
604
673
  },
674
+ ];
675
+ // =============================================================================
676
+ // ALL TEMPLATES
677
+ // =============================================================================
678
+ export const AI_GATEWAY_TEMPLATES = [
605
679
  {
606
- id: 'semantic-default',
680
+ id: 'organization.permit-baseline',
681
+ name: 'Baseline Permit',
682
+ description: 'Permits all actions by default; threat-specific forbid policies override this when detectors fire.',
683
+ category: 'organization',
684
+ cedarText: AI_GATEWAY_ORGANIZATION_PERMIT_BASELINE_CEDAR,
685
+ severity: 'low',
686
+ tags: ['category:organization', 'posture:permit-default'],
687
+ autoDeploy: true,
688
+ },
689
+ {
690
+ id: 'semantic.defaults',
607
691
  name: 'Semantic Threat Detection',
608
- description: 'Detect and block prompt injection, jailbreak attempts, and high-severity threats in MCP tool calls and LLM prompts',
692
+ description: 'Block prompt injection, jailbreak attempts, and high-severity threats in MCP tool calls and LLM prompts.',
609
693
  category: 'semantic',
610
- cedarText: AI_GATEWAY_SEMANTIC_DEFAULT_CEDAR,
694
+ cedarText: AI_GATEWAY_SEMANTIC_DEFAULTS_CEDAR,
611
695
  severity: 'critical',
612
- tags: ['prompt-injection', 'jailbreak', 'owasp-llm01', 'owasp-llm02', 'security', 'baseline'],
613
- isActive: true,
696
+ tags: ['category:semantic', 'threat:injection', 'threat:jailbreak', 'owasp:llm01', 'owasp:llm02'],
614
697
  },
615
698
  {
616
- id: 'tools-default',
699
+ id: 'tools.defaults',
617
700
  name: 'Tool Permissioning',
618
- description: 'Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments',
701
+ description: 'Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments.',
619
702
  category: 'tools',
620
- cedarText: AI_GATEWAY_TOOLS_DEFAULT_CEDAR,
703
+ cedarText: AI_GATEWAY_TOOLS_DEFAULTS_CEDAR,
621
704
  severity: 'critical',
622
- tags: ['tool-risk', 'command-injection', 'owasp-llm06', 'owasp-asi02', 'baseline'],
623
- isActive: true,
705
+ tags: ['category:tools', 'threat:command-injection', 'owasp:llm06', 'owasp:asi02'],
624
706
  },
625
707
  {
626
- id: 'agent-security-default',
708
+ id: 'agent-security.defaults',
627
709
  name: 'Agent Security',
628
- description: 'Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats',
629
- category: 'agent_security',
630
- cedarText: AI_GATEWAY_AGENT_SECURITY_DEFAULT_CEDAR,
710
+ description: 'Block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats.',
711
+ category: 'agent-security',
712
+ cedarText: AI_GATEWAY_AGENT_SECURITY_DEFAULTS_CEDAR,
631
713
  severity: 'critical',
632
- tags: ['tool-poisoning', 'rug-pull', 'indirect-injection', 'mcp-security', 'owasp-asi01', 'owasp-asi04', 'baseline'],
633
- isActive: true,
714
+ tags: ['category:agent-security', 'threat:tool-poisoning', 'threat:rug-pull', 'threat:indirect-injection', 'threat:supply-chain', 'owasp:asi01', 'owasp:asi04'],
634
715
  },
635
- ];
636
- // =============================================================================
637
- // ALL TEMPLATES
638
- // =============================================================================
639
- export const AI_GATEWAY_TEMPLATES = [
640
716
  {
641
- id: 'tools-mcp-allowlist',
717
+ id: 'tools.mcp-server-allowlist',
642
718
  name: 'MCP Server Allowlist',
643
- description: 'Only allow specific MCP servers to be used',
719
+ description: 'Only allow specific MCP servers to be used; customize the allowlist in the permit rule.',
644
720
  category: 'tools',
645
- cedarText: AI_GATEWAY_TOOLS_MCP_ALLOWLIST_CEDAR,
721
+ cedarText: AI_GATEWAY_TOOLS_MCP_SERVER_ALLOWLIST_CEDAR,
646
722
  severity: 'medium',
647
- tags: ['mcp', 'allowlist', 'whitelist'],
723
+ tags: ['category:tools', 'scope:org-wide', 'posture:deny-default'],
648
724
  },
649
725
  {
650
- id: 'tools-mcp-tool-permissions',
726
+ id: 'tools.mcp-tool-permissions',
651
727
  name: 'MCP Tool Permissions',
652
- description: 'Permit every MCP call_tool by default. Ships two opt-in safety rails (block untrusted/deprecated servers, block unverified servers). Add forbid rules for per-tool or per-server gating.',
728
+ description: 'Permit MCP call_tool by default plus two safety rails (server exclusion list, block unverified servers); add forbid rules for per-tool gating.',
653
729
  category: 'tools',
654
730
  cedarText: AI_GATEWAY_TOOLS_MCP_TOOL_PERMISSIONS_CEDAR,
655
- severity: 'low',
656
- tags: ['mcp', 'tools', 'permit-default', 'exclusion'],
731
+ severity: 'critical',
732
+ tags: ['category:tools', 'threat:supply-chain', 'posture:permit-default'],
657
733
  },
658
734
  {
659
- id: 'data-pii-redaction',
735
+ id: 'data-protection.pii-redaction',
660
736
  name: 'PII & Secrets Redaction',
661
- description: 'Block requests containing PII or secrets across LLM prompts and MCP tool calls -- prevents data leakage and credential exposure',
662
- category: 'data_protection',
663
- cedarText: AI_GATEWAY_DATA_PII_REDACTION_CEDAR,
664
- severity: 'high',
665
- tags: ['pii', 'secrets', 'data-protection', 'dlp', 'owasp-llm06'],
737
+ description: 'Block requests containing PII or secrets across LLM prompts and MCP tool calls.',
738
+ category: 'data-protection',
739
+ cedarText: AI_GATEWAY_DATA_PROTECTION_PII_REDACTION_CEDAR,
740
+ severity: 'critical',
741
+ tags: ['category:data-protection', 'threat:pii', 'threat:secrets', 'threat:exfiltration', 'owasp:llm06'],
666
742
  },
667
743
  {
668
- id: 'llm-default-allow',
669
- name: 'Default Allow LLM Proxy',
670
- description: 'Permit all LLM chat completion requests by default -- deploy alongside threat-specific forbid policies for a default-allow posture',
744
+ id: 'organization.permit-llm-default',
745
+ name: 'Permit LLM proxy calls',
746
+ description: 'Permit all LLM chat completion requests by default; deploy alongside threat-specific forbids for a permit-default posture.',
671
747
  category: 'organization',
672
- cedarText: AI_GATEWAY_LLM_DEFAULT_ALLOW_CEDAR,
748
+ cedarText: AI_GATEWAY_ORGANIZATION_PERMIT_LLM_DEFAULT_CEDAR,
673
749
  severity: 'low',
674
- tags: ['llm', 'permit-default', 'proxy', 'organization'],
750
+ tags: ['category:organization', 'surface:process-prompt', 'posture:permit-default'],
675
751
  },
676
752
  ];
677
753
  // =============================================================================
@@ -680,118 +756,120 @@ export const AI_GATEWAY_TEMPLATES = [
680
756
  /** Raw templates.json metadata for the AiGateway service. */
681
757
  export const AI_GATEWAY_TEMPLATES_JSON = `{
682
758
  "service": "ai_gateway",
683
- "version": "2.0.0",
684
- "description": "AIGateway policy templates for MCP + LLM gateway security",
759
+ "version": "2.1.0",
760
+ "description": "AI Gateway policy templates for MCP + LLM gateway security",
685
761
  "categories": [
686
762
  {
687
763
  "id": "semantic",
688
764
  "name": "Semantic Threat Detection",
689
- "description": "Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats"
765
+ "description": "Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats."
690
766
  },
691
767
  {
692
768
  "id": "tools",
693
769
  "name": "Tool Permissioning",
694
- "description": "Control access to MCP tools, enforce risk scoring, and manage per-tool permissions"
770
+ "description": "Control access to MCP tools, enforce risk scoring, and manage per-tool permissions."
695
771
  },
696
772
  {
697
- "id": "agent_security",
773
+ "id": "agent-security",
698
774
  "name": "Agent Security",
699
- "description": "Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats"
775
+ "description": "Detect tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats."
700
776
  },
701
777
  {
702
- "id": "data_protection",
778
+ "id": "data-protection",
703
779
  "name": "Data Protection",
704
- "description": "Prevent secrets and PII leakage in LLM chat completions and MCP operations"
705
- },
706
- {
707
- "id": "content_safety",
708
- "name": "Content Safety",
709
- "description": "Enforce content moderation score thresholds on LLM prompts and MCP content"
780
+ "description": "Prevent secrets and PII leakage in LLM chat completions and MCP operations."
710
781
  },
711
782
  {
712
783
  "id": "organization",
713
- "name": "Organization Rules",
714
- "description": "Apply organization-wide policy baselines for AI gateway operations"
784
+ "name": "Organization",
785
+ "description": "Organization-wide baselines and default permit policies."
715
786
  }
716
787
  ],
717
788
  "defaults": [
718
789
  {
719
- "id": "baseline-default",
790
+ "id": "organization.permit-baseline",
720
791
  "name": "Baseline Permit",
721
- "description": "Permits all actions by default -- threat-specific forbid policies override this when threats are detected",
792
+ "description": "Permits all actions by default; threat-specific forbid policies override this when detectors fire.",
722
793
  "category": "organization",
723
794
  "file": "defaults/baseline.cedar",
724
795
  "severity": "low",
725
- "tags": ["baseline", "permit-default", "organization"],
796
+ "tags": ["category:organization", "posture:permit-default"],
726
797
  "is_active": true
798
+ }
799
+ ],
800
+ "templates": [
801
+ {
802
+ "id": "organization.permit-baseline",
803
+ "name": "Baseline Permit",
804
+ "description": "Permits all actions by default; threat-specific forbid policies override this when detectors fire.",
805
+ "category": "organization",
806
+ "file": "defaults/baseline.cedar",
807
+ "severity": "low",
808
+ "tags": ["category:organization", "posture:permit-default"],
809
+ "auto_deploy": true
727
810
  },
728
811
  {
729
- "id": "semantic-default",
812
+ "id": "semantic.defaults",
730
813
  "name": "Semantic Threat Detection",
731
- "description": "Detect and block prompt injection, jailbreak attempts, and high-severity threats in MCP tool calls and LLM prompts",
814
+ "description": "Block prompt injection, jailbreak attempts, and high-severity threats in MCP tool calls and LLM prompts.",
732
815
  "category": "semantic",
733
816
  "file": "defaults/semantic.cedar",
734
817
  "severity": "critical",
735
- "tags": ["prompt-injection", "jailbreak", "owasp-llm01", "owasp-llm02", "security", "baseline"],
736
- "is_active": true
818
+ "tags": ["category:semantic", "threat:injection", "threat:jailbreak", "owasp:llm01", "owasp:llm02"]
737
819
  },
738
820
  {
739
- "id": "tools-default",
821
+ "id": "tools.defaults",
740
822
  "name": "Tool Permissioning",
741
- "description": "Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments",
823
+ "description": "Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments.",
742
824
  "category": "tools",
743
825
  "file": "defaults/tools.cedar",
744
826
  "severity": "critical",
745
- "tags": ["tool-risk", "command-injection", "owasp-llm06", "owasp-asi02", "baseline"],
746
- "is_active": true
827
+ "tags": ["category:tools", "threat:command-injection", "owasp:llm06", "owasp:asi02"]
747
828
  },
748
829
  {
749
- "id": "agent-security-default",
830
+ "id": "agent-security.defaults",
750
831
  "name": "Agent Security",
751
- "description": "Detect and block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats",
752
- "category": "agent_security",
832
+ "description": "Block tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats.",
833
+ "category": "agent-security",
753
834
  "file": "defaults/agent_security.cedar",
754
835
  "severity": "critical",
755
- "tags": ["tool-poisoning", "rug-pull", "indirect-injection", "mcp-security", "owasp-asi01", "owasp-asi04", "baseline"],
756
- "is_active": true
757
- }
758
- ],
759
- "templates": [
836
+ "tags": ["category:agent-security", "threat:tool-poisoning", "threat:rug-pull", "threat:indirect-injection", "threat:supply-chain", "owasp:asi01", "owasp:asi04"]
837
+ },
760
838
  {
761
- "id": "tools-mcp-allowlist",
839
+ "id": "tools.mcp-server-allowlist",
762
840
  "name": "MCP Server Allowlist",
763
- "description": "Only allow specific MCP servers to be used",
841
+ "description": "Only allow specific MCP servers to be used; customize the allowlist in the permit rule.",
764
842
  "category": "tools",
765
843
  "file": "mcp_server_allowlist.cedar",
766
844
  "severity": "medium",
767
- "tags": ["mcp", "allowlist", "whitelist"]
845
+ "tags": ["category:tools", "scope:org-wide", "posture:deny-default"]
768
846
  },
769
847
  {
770
- "id": "tools-mcp-tool-permissions",
848
+ "id": "tools.mcp-tool-permissions",
771
849
  "name": "MCP Tool Permissions",
772
- "description": "Permit every MCP call_tool by default. Ships two opt-in safety rails (block untrusted/deprecated servers, block unverified servers). Add forbid rules for per-tool or per-server gating.",
850
+ "description": "Permit MCP call_tool by default plus two safety rails (server exclusion list, block unverified servers); add forbid rules for per-tool gating.",
773
851
  "category": "tools",
774
852
  "file": "mcp_tool_permissions.cedar",
775
- "severity": "low",
776
- "tags": ["mcp", "tools", "permit-default", "exclusion"]
853
+ "severity": "critical",
854
+ "tags": ["category:tools", "threat:supply-chain", "posture:permit-default"]
777
855
  },
778
856
  {
779
- "id": "data-pii-redaction",
857
+ "id": "data-protection.pii-redaction",
780
858
  "name": "PII & Secrets Redaction",
781
- "description": "Block requests containing PII or secrets across LLM prompts and MCP tool calls -- prevents data leakage and credential exposure",
782
- "category": "data_protection",
859
+ "description": "Block requests containing PII or secrets across LLM prompts and MCP tool calls.",
860
+ "category": "data-protection",
783
861
  "file": "pii_redaction.cedar",
784
- "severity": "high",
785
- "tags": ["pii", "secrets", "data-protection", "dlp", "owasp-llm06"]
862
+ "severity": "critical",
863
+ "tags": ["category:data-protection", "threat:pii", "threat:secrets", "threat:exfiltration", "owasp:llm06"]
786
864
  },
787
865
  {
788
- "id": "llm-default-allow",
789
- "name": "Default Allow LLM Proxy",
790
- "description": "Permit all LLM chat completion requests by default -- deploy alongside threat-specific forbid policies for a default-allow posture",
866
+ "id": "organization.permit-llm-default",
867
+ "name": "Permit LLM proxy calls",
868
+ "description": "Permit all LLM chat completion requests by default; deploy alongside threat-specific forbids for a permit-default posture.",
791
869
  "category": "organization",
792
870
  "file": "llm_default_allow.cedar",
793
871
  "severity": "low",
794
- "tags": ["llm", "permit-default", "proxy", "organization"]
872
+ "tags": ["category:organization", "surface:process-prompt", "posture:permit-default"]
795
873
  }
796
874
  ]
797
875
  }