@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.
- package/_schemas/ai_gateway/context.json +431 -11
- package/_schemas/ai_gateway/schema.cedarschema +91 -11
- package/_schemas/ai_gateway/templates/defaults/agent_security.cedar +66 -43
- package/_schemas/ai_gateway/templates/defaults/baseline.cedar +9 -11
- package/_schemas/ai_gateway/templates/defaults/semantic.cedar +63 -40
- package/_schemas/ai_gateway/templates/defaults/tools.cedar +48 -36
- package/_schemas/ai_gateway/templates/llm_default_allow.cedar +9 -10
- package/_schemas/ai_gateway/templates/mcp_server_allowlist.cedar +22 -14
- package/_schemas/ai_gateway/templates/mcp_tool_permissions.cedar +29 -27
- package/_schemas/ai_gateway/templates/pii_redaction.cedar +38 -33
- package/_schemas/ai_gateway/templates/templates.json +52 -50
- package/_schemas/guardrails/context.json +12 -12
- package/_schemas/guardrails/schema.cedarschema +12 -12
- package/_schemas/guardrails/templates/defaults/agent_identity.cedar +60 -56
- package/_schemas/guardrails/templates/defaults/agentic_safety.cedar +83 -58
- package/_schemas/guardrails/templates/defaults/baseline.cedar +9 -12
- package/_schemas/guardrails/templates/defaults/injection.cedar +48 -36
- package/_schemas/guardrails/templates/defaults/pii.cedar +27 -20
- package/_schemas/guardrails/templates/defaults/secrets.cedar +39 -22
- package/_schemas/guardrails/templates/defaults/security_patterns.cedar +38 -25
- package/_schemas/guardrails/templates/defaults/semantic.cedar +47 -31
- package/_schemas/guardrails/templates/defaults/tool_risk.cedar +34 -26
- package/_schemas/guardrails/templates/defaults/toxicity.cedar +57 -47
- package/_schemas/guardrails/templates/mcp_tool_permissions.cedar +60 -43
- package/_schemas/guardrails/templates/profiles/a2a_security/cross_origin.cedar +29 -42
- package/_schemas/guardrails/templates/profiles/a2a_security/escalation_detection.cedar +43 -57
- package/_schemas/guardrails/templates/profiles/a2a_security/identity_enforcement.cedar +40 -57
- package/_schemas/guardrails/templates/profiles/a2a_security/inter_agent_injection.cedar +48 -62
- package/_schemas/guardrails/templates/profiles/a2a_security/supply_chain.cedar +40 -56
- package/_schemas/guardrails/templates/profiles/advanced_detection/pii.cedar +24 -34
- package/_schemas/guardrails/templates/profiles/advanced_detection/secrets.cedar +45 -37
- package/_schemas/guardrails/templates/profiles/advanced_detection/threat_severity.cedar +11 -16
- package/_schemas/guardrails/templates/profiles/chat_assistant/privacy.cedar +22 -9
- package/_schemas/guardrails/templates/profiles/chat_assistant/security.cedar +27 -15
- package/_schemas/guardrails/templates/profiles/chat_assistant/trust_safety.cedar +37 -22
- package/_schemas/guardrails/templates/profiles/code_agent/agentic_security.cedar +68 -47
- package/_schemas/guardrails/templates/profiles/code_agent/encoding.cedar +17 -21
- package/_schemas/guardrails/templates/profiles/code_agent/path_security.cedar +74 -73
- package/_schemas/guardrails/templates/profiles/code_agent/security.cedar +13 -9
- package/_schemas/guardrails/templates/profiles/code_agent/supply_chain.cedar +36 -58
- package/_schemas/guardrails/templates/profiles/data_pipeline/agentic_security.cedar +22 -15
- package/_schemas/guardrails/templates/profiles/data_pipeline/data_protection.cedar +52 -0
- package/_schemas/guardrails/templates/profiles/data_pipeline/privacy.cedar +41 -18
- package/_schemas/guardrails/templates/profiles/data_pipeline/security.cedar +18 -36
- package/_schemas/guardrails/templates/profiles/multi_agent/agent_safety.cedar +86 -79
- package/_schemas/guardrails/templates/profiles/multi_agent/agent_trust.cedar +73 -70
- package/_schemas/guardrails/templates/templates.json +198 -217
- package/_schemas/overwatch/context.json +14 -14
- package/_schemas/overwatch/schema.cedarschema +12 -12
- package/_schemas/sentry/context.json +11 -11
- package/_schemas/sentry/schema.cedarschema +11 -11
- package/_schemas/sentry/templates/defaults/baseline.cedar +8 -12
- package/_schemas/sentry/templates/defaults/clipboard.cedar +43 -42
- package/_schemas/sentry/templates/defaults/content_safety.cedar +38 -68
- package/_schemas/sentry/templates/defaults/file_safety.cedar +18 -26
- package/_schemas/sentry/templates/defaults/organization.cedar +10 -17
- package/_schemas/sentry/templates/defaults/pii.cedar +52 -73
- package/_schemas/sentry/templates/defaults/secrets.cedar +65 -58
- package/_schemas/sentry/templates/defaults/semantic.cedar +40 -59
- package/_schemas/sentry/templates/templates.json +53 -43
- package/dist/ai_gateway-context.gen.d.ts +18 -4
- package/dist/ai_gateway-context.gen.js +18 -4
- package/dist/ai_gateway-defaults.gen.d.ts +4 -1
- package/dist/ai_gateway-defaults.gen.js +398 -320
- package/dist/builder.d.ts +2 -1
- package/dist/builder.js +5 -2
- package/dist/guardrails-context.gen.d.ts +5 -5
- package/dist/guardrails-context.gen.js +5 -5
- package/dist/guardrails-defaults.gen.d.ts +4 -1
- package/dist/guardrails-defaults.gen.js +2130 -1903
- package/dist/overwatch-context.gen.d.ts +5 -5
- package/dist/overwatch-context.gen.js +5 -5
- package/dist/overwatch-defaults.gen.d.ts +4 -1
- package/dist/overwatch-defaults.gen.js +560 -566
- package/dist/sentry-context.gen.d.ts +3 -3
- package/dist/sentry-context.gen.js +3 -3
- package/dist/sentry-defaults.gen.d.ts +4 -1
- package/dist/sentry-defaults.gen.js +392 -453
- package/dist/service-schemas.gen.d.ts +4 -4
- package/dist/service-schemas.gen.js +249 -99
- package/package.json +1 -1
|
@@ -7,47 +7,65 @@
|
|
|
7
7
|
// =============================================================================
|
|
8
8
|
// EMBEDDED CEDAR POLICY TEXT
|
|
9
9
|
// =============================================================================
|
|
10
|
-
const
|
|
11
|
-
// Baseline Permit
|
|
10
|
+
const AI_GATEWAY_ORGANIZATION_PERMIT_BASELINE_CEDAR = `// =============================================================================
|
|
11
|
+
// Baseline Permit (Default)
|
|
12
12
|
// =============================================================================
|
|
13
|
-
// Permits all actions by default. Threat-specific forbid policies
|
|
14
|
-
// this
|
|
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
|
-
//
|
|
17
|
-
// is denied regardless of forbid rules.
|
|
18
|
-
//
|
|
19
|
-
// Category: organization
|
|
17
|
+
// Category: organization
|
|
20
18
|
// Namespace: AIGateway
|
|
21
19
|
// =============================================================================
|
|
22
20
|
|
|
23
|
-
@id("
|
|
24
|
-
@name("Permit
|
|
25
|
-
@description("
|
|
21
|
+
@id("organization.permit-baseline")
|
|
22
|
+
@name("Permit baseline")
|
|
23
|
+
@description("Permits all AI Gateway actions.")
|
|
26
24
|
@severity("low")
|
|
27
|
-
@tags("
|
|
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
|
|
35
|
-
// Semantic Threat Detection
|
|
32
|
+
const AI_GATEWAY_SEMANTIC_DEFAULTS_CEDAR = `// =============================================================================
|
|
33
|
+
// Semantic Threat Detection (Default)
|
|
36
34
|
// =============================================================================
|
|
37
|
-
//
|
|
38
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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,
|
|
50
|
-
@reject_message("Tool
|
|
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
|
-
|
|
61
|
-
@
|
|
62
|
-
@
|
|
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-
|
|
66
|
-
@reject_message("Tool
|
|
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
|
|
90
|
+
context has injection_score && context.injection_score >= 75
|
|
74
91
|
};
|
|
75
92
|
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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,
|
|
82
|
-
@reject_message("Tool
|
|
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
|
-
|
|
93
|
-
@
|
|
94
|
-
@
|
|
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-
|
|
98
|
-
@reject_message("Tool
|
|
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
|
|
124
|
+
context has jailbreak_score && context.jailbreak_score >= 75
|
|
106
125
|
};
|
|
107
126
|
|
|
108
|
-
//
|
|
109
|
-
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
// Section 3: Severity aggregation
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
@id("semantic.block-critical")
|
|
110
132
|
@name("Block critical threats")
|
|
111
|
-
@description("
|
|
133
|
+
@description("Blocks all MCP operations when highest_severity equals \\"critical\\".")
|
|
112
134
|
@severity("critical")
|
|
113
|
-
@tags("
|
|
114
|
-
@reject_message("MCP operation
|
|
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
|
-
|
|
125
|
-
@id("semantic-block-multi-threat-tools")
|
|
146
|
+
@id("semantic.block-multi-threat")
|
|
126
147
|
@name("Block multi-threat tool calls")
|
|
127
|
-
@description("
|
|
148
|
+
@description("Blocks call_tool when threat_count >= 3.")
|
|
128
149
|
@severity("high")
|
|
129
|
-
@tags("
|
|
130
|
-
@reject_message("Tool execution
|
|
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
|
|
141
|
-
// Tool Permissioning
|
|
161
|
+
const AI_GATEWAY_TOOLS_DEFAULTS_CEDAR = `// =============================================================================
|
|
162
|
+
// Tool Permissioning (Default)
|
|
142
163
|
// =============================================================================
|
|
143
|
-
//
|
|
144
|
-
//
|
|
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
|
-
//
|
|
181
|
+
// Compliance:
|
|
182
|
+
// - OWASP LLM06, OWASP ASI02
|
|
183
|
+
// - MITRE T1059
|
|
184
|
+
//
|
|
185
|
+
// Category: tools
|
|
147
186
|
// Namespace: AIGateway
|
|
148
187
|
// =============================================================================
|
|
149
188
|
|
|
150
|
-
|
|
151
|
-
@
|
|
152
|
-
@
|
|
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
|
|
156
|
-
@reject_message("Tool execution blocked:
|
|
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
|
-
|
|
167
|
-
@id("tools-block-dangerous-category")
|
|
204
|
+
@id("tools.block-dangerous-category")
|
|
168
205
|
@name("Block dangerous tool category")
|
|
169
|
-
@description("
|
|
206
|
+
@description("Blocks call_tool when tool_category equals \\"dangerous\\".")
|
|
170
207
|
@severity("critical")
|
|
171
|
-
@tags("
|
|
172
|
-
@reject_message("Tool execution blocked:
|
|
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
|
-
|
|
183
|
-
@id("tools-block-sensitive-with-threats")
|
|
219
|
+
@id("tools.block-sensitive-with-threats")
|
|
184
220
|
@name("Block sensitive tools with threats")
|
|
185
|
-
@description("
|
|
221
|
+
@description("Blocks call_tool when tool_is_sensitive is true and threat_count >= 1.")
|
|
186
222
|
@severity("high")
|
|
187
|
-
@tags("
|
|
188
|
-
@reject_message("
|
|
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
|
|
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
|
-
|
|
200
|
-
@
|
|
201
|
-
@
|
|
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,
|
|
205
|
-
@reject_message("Tool execution
|
|
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
|
|
248
|
+
context.threat_count >= 1 && context.max_threat_severity >= 3
|
|
214
249
|
};
|
|
215
250
|
|
|
216
|
-
|
|
217
|
-
@
|
|
218
|
-
@
|
|
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,
|
|
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
|
|
234
|
-
// Agent Security
|
|
266
|
+
const AI_GATEWAY_AGENT_SECURITY_DEFAULTS_CEDAR = `// =============================================================================
|
|
267
|
+
// Agent Security (Default)
|
|
235
268
|
// =============================================================================
|
|
236
|
-
//
|
|
237
|
-
// and MCP supply
|
|
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:
|
|
287
|
+
// Category: agent-security
|
|
240
288
|
// Namespace: AIGateway
|
|
241
289
|
// =============================================================================
|
|
242
290
|
|
|
243
|
-
//
|
|
244
|
-
|
|
291
|
+
// ---------------------------------------------------------------------------
|
|
292
|
+
// Section 1: Tool poisoning
|
|
293
|
+
// ---------------------------------------------------------------------------
|
|
294
|
+
|
|
295
|
+
@id("agent-security.block-tool-poisoning")
|
|
245
296
|
@name("Block tool poisoning")
|
|
246
|
-
@description("
|
|
297
|
+
@description("Blocks call_tool when tool_poisoning_score >= 70.")
|
|
247
298
|
@severity("critical")
|
|
248
|
-
@tags("tool-poisoning,
|
|
249
|
-
@reject_message("Tool execution blocked: hidden manipulation instructions detected
|
|
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
|
-
|
|
260
|
-
@id("as-block-server-poisoning")
|
|
310
|
+
@id("agent-security.block-server-poisoning")
|
|
261
311
|
@name("Block poisoned MCP servers")
|
|
262
|
-
@description("
|
|
312
|
+
@description("Blocks connect_server when tool_poisoning_score >= 60.")
|
|
263
313
|
@severity("critical")
|
|
264
|
-
@tags("tool-poisoning,
|
|
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
|
-
//
|
|
276
|
-
|
|
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("
|
|
331
|
+
@description("Blocks call_tool and connect_server when rug_pull_score >= 70.")
|
|
279
332
|
@severity("critical")
|
|
280
|
-
@tags("rug-pull,
|
|
281
|
-
@reject_message("Tool execution blocked: tool behavior has
|
|
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
|
-
//
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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
|
|
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
|
-
|
|
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("
|
|
365
|
+
@description("Blocks call_tool when tool_is_sensitive is true and indirect_injection_score >= 50.")
|
|
311
366
|
@severity("critical")
|
|
312
|
-
@tags("indirect-injection,
|
|
313
|
-
@reject_message("
|
|
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
|
-
//
|
|
325
|
-
|
|
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("
|
|
385
|
+
@description("Blocks call_tool when mcp_server_verified is false and threat_count >= 1.")
|
|
328
386
|
@severity("high")
|
|
329
|
-
@tags("
|
|
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
|
|
396
|
+
context has threat_count && context.threat_count >= 1
|
|
339
397
|
};
|
|
340
398
|
|
|
341
|
-
|
|
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("
|
|
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
|
|
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
|
-
|
|
359
|
-
@id("as-block-unverified-server-connect")
|
|
415
|
+
@id("agent-security.block-unverified-server")
|
|
360
416
|
@name("Block unverified MCP server connections")
|
|
361
|
-
@description("
|
|
417
|
+
@description("Blocks connect_server when mcp_server_verified is false.")
|
|
362
418
|
@severity("high")
|
|
363
|
-
@tags("
|
|
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
|
|
375
|
-
//
|
|
376
|
-
//
|
|
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
|
-
//
|
|
379
|
-
//
|
|
440
|
+
// Category: tools
|
|
441
|
+
// Namespace: AIGateway
|
|
442
|
+
// =============================================================================
|
|
380
443
|
|
|
381
|
-
@id("mcp-allowlist
|
|
382
|
-
@name("Allow
|
|
383
|
-
@description("
|
|
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("
|
|
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
|
-
|
|
457
|
+
context.mcp_server == "playwright")
|
|
395
458
|
};
|
|
396
459
|
|
|
397
|
-
@id("
|
|
398
|
-
@name("
|
|
399
|
-
@description("
|
|
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("
|
|
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
|
|
473
|
+
// MCP Tool Permissions
|
|
410
474
|
// =============================================================================
|
|
411
|
-
// Per-tool access control for MCP servers.
|
|
412
|
-
//
|
|
413
|
-
//
|
|
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
|
-
//
|
|
416
|
-
//
|
|
482
|
+
// Context keys consumed:
|
|
483
|
+
// - mcp_server: String
|
|
484
|
+
// - mcp_server_verified: Bool
|
|
417
485
|
//
|
|
418
|
-
// Category:
|
|
486
|
+
// Category: tools
|
|
419
487
|
// Namespace: AIGateway
|
|
420
488
|
// =============================================================================
|
|
421
489
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
@
|
|
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("
|
|
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
|
-
|
|
436
|
-
|
|
437
|
-
@
|
|
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("
|
|
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
|
-
)
|
|
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
|
-
|
|
453
|
-
|
|
454
|
-
@
|
|
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("
|
|
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
|
-
)
|
|
528
|
+
)
|
|
529
|
+
when {
|
|
464
530
|
context has mcp_server_verified && context.mcp_server_verified == false
|
|
465
531
|
};
|
|
466
532
|
`;
|
|
467
|
-
const
|
|
468
|
-
// PII Redaction
|
|
533
|
+
const AI_GATEWAY_DATA_PROTECTION_PII_REDACTION_CEDAR = `// =============================================================================
|
|
534
|
+
// PII & Secrets Redaction
|
|
469
535
|
// =============================================================================
|
|
470
|
-
//
|
|
471
|
-
//
|
|
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:
|
|
549
|
+
// Category: data-protection
|
|
474
550
|
// Namespace: AIGateway
|
|
475
551
|
// =============================================================================
|
|
476
552
|
|
|
477
|
-
|
|
478
|
-
@
|
|
479
|
-
@
|
|
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("
|
|
483
|
-
@reject_message("
|
|
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
|
-
|
|
494
|
-
@
|
|
495
|
-
@
|
|
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("
|
|
499
|
-
@reject_message("
|
|
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
|
|
580
|
+
context has secrets_detected && context.secrets_detected == true
|
|
507
581
|
};
|
|
508
582
|
|
|
509
|
-
|
|
510
|
-
@id("data-block-pii-tools")
|
|
583
|
+
@id("data-protection.block-pii-tools")
|
|
511
584
|
@name("Block PII in tool calls")
|
|
512
|
-
@description("
|
|
585
|
+
@description("Blocks call_tool when pii_detected is true.")
|
|
513
586
|
@severity("high")
|
|
514
|
-
@tags("pii,
|
|
515
|
-
@reject_message("Tool
|
|
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
|
-
|
|
526
|
-
@id("data-block-secrets-tools")
|
|
598
|
+
@id("data-protection.block-secrets-tools")
|
|
527
599
|
@name("Block secrets in tool calls")
|
|
528
|
-
@description("
|
|
600
|
+
@description("Blocks call_tool when secrets_detected is true.")
|
|
529
601
|
@severity("critical")
|
|
530
|
-
@tags("secrets,
|
|
531
|
-
@reject_message("Tool
|
|
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
|
|
610
|
+
context has secrets_detected && context.secrets_detected == true
|
|
539
611
|
};
|
|
540
612
|
|
|
541
|
-
|
|
542
|
-
@id("data-block-bulk-pii")
|
|
613
|
+
@id("data-protection.block-pii-bulk")
|
|
543
614
|
@name("Block bulk PII exposure")
|
|
544
|
-
@description("
|
|
615
|
+
@description("Blocks any action when pii_count >= 3.")
|
|
545
616
|
@severity("critical")
|
|
546
|
-
@tags("
|
|
547
|
-
@reject_message("Request
|
|
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
|
|
558
|
-
// Default Allow
|
|
628
|
+
const AI_GATEWAY_ORGANIZATION_PERMIT_LLM_DEFAULT_CEDAR = `// =============================================================================
|
|
629
|
+
// LLM Default Allow
|
|
559
630
|
// =============================================================================
|
|
560
|
-
// Permits all LLM prompt processing by default. Deploy
|
|
561
|
-
//
|
|
562
|
-
//
|
|
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:
|
|
635
|
+
// Category: organization
|
|
565
636
|
// Namespace: AIGateway
|
|
566
637
|
// =============================================================================
|
|
567
638
|
|
|
568
|
-
|
|
569
|
-
@
|
|
570
|
-
@
|
|
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("
|
|
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: '
|
|
587
|
-
{ id: '
|
|
588
|
-
{ id: '
|
|
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
|
|
665
|
+
id: 'organization.permit-baseline',
|
|
597
666
|
name: 'Baseline Permit',
|
|
598
|
-
description: 'Permits all actions by default
|
|
667
|
+
description: 'Permits all actions by default; threat-specific forbid policies override this when detectors fire.',
|
|
599
668
|
category: 'organization',
|
|
600
|
-
cedarText:
|
|
669
|
+
cedarText: AI_GATEWAY_ORGANIZATION_PERMIT_BASELINE_CEDAR,
|
|
601
670
|
severity: 'low',
|
|
602
|
-
tags: ['
|
|
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: '
|
|
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: '
|
|
692
|
+
description: 'Block prompt injection, jailbreak attempts, and high-severity threats in MCP tool calls and LLM prompts.',
|
|
609
693
|
category: 'semantic',
|
|
610
|
-
cedarText:
|
|
694
|
+
cedarText: AI_GATEWAY_SEMANTIC_DEFAULTS_CEDAR,
|
|
611
695
|
severity: 'critical',
|
|
612
|
-
tags: ['
|
|
613
|
-
isActive: true,
|
|
696
|
+
tags: ['category:semantic', 'threat:injection', 'threat:jailbreak', 'owasp:llm01', 'owasp:llm02'],
|
|
614
697
|
},
|
|
615
698
|
{
|
|
616
|
-
id: 'tools
|
|
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:
|
|
703
|
+
cedarText: AI_GATEWAY_TOOLS_DEFAULTS_CEDAR,
|
|
621
704
|
severity: 'critical',
|
|
622
|
-
tags: ['
|
|
623
|
-
isActive: true,
|
|
705
|
+
tags: ['category:tools', 'threat:command-injection', 'owasp:llm06', 'owasp:asi02'],
|
|
624
706
|
},
|
|
625
707
|
{
|
|
626
|
-
id: 'agent-security
|
|
708
|
+
id: 'agent-security.defaults',
|
|
627
709
|
name: 'Agent Security',
|
|
628
|
-
description: '
|
|
629
|
-
category: '
|
|
630
|
-
cedarText:
|
|
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', '
|
|
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
|
|
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:
|
|
721
|
+
cedarText: AI_GATEWAY_TOOLS_MCP_SERVER_ALLOWLIST_CEDAR,
|
|
646
722
|
severity: 'medium',
|
|
647
|
-
tags: ['
|
|
723
|
+
tags: ['category:tools', 'scope:org-wide', 'posture:deny-default'],
|
|
648
724
|
},
|
|
649
725
|
{
|
|
650
|
-
id: 'tools
|
|
726
|
+
id: 'tools.mcp-tool-permissions',
|
|
651
727
|
name: 'MCP Tool Permissions',
|
|
652
|
-
description: 'Permit
|
|
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: '
|
|
656
|
-
tags: ['
|
|
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
|
|
662
|
-
category: '
|
|
663
|
-
cedarText:
|
|
664
|
-
severity: '
|
|
665
|
-
tags: ['
|
|
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
|
|
669
|
-
name: '
|
|
670
|
-
description: 'Permit all LLM chat completion requests by default
|
|
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:
|
|
748
|
+
cedarText: AI_GATEWAY_ORGANIZATION_PERMIT_LLM_DEFAULT_CEDAR,
|
|
673
749
|
severity: 'low',
|
|
674
|
-
tags: ['
|
|
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.
|
|
684
|
-
"description": "
|
|
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": "
|
|
773
|
+
"id": "agent-security",
|
|
698
774
|
"name": "Agent Security",
|
|
699
|
-
"description": "Detect
|
|
775
|
+
"description": "Detect tool poisoning, rug pull attacks, indirect prompt injection, and MCP supply chain threats."
|
|
700
776
|
},
|
|
701
777
|
{
|
|
702
|
-
"id": "
|
|
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
|
|
714
|
-
"description": "
|
|
784
|
+
"name": "Organization",
|
|
785
|
+
"description": "Organization-wide baselines and default permit policies."
|
|
715
786
|
}
|
|
716
787
|
],
|
|
717
788
|
"defaults": [
|
|
718
789
|
{
|
|
719
|
-
"id": "baseline
|
|
790
|
+
"id": "organization.permit-baseline",
|
|
720
791
|
"name": "Baseline Permit",
|
|
721
|
-
"description": "Permits all actions by default
|
|
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": ["
|
|
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
|
|
812
|
+
"id": "semantic.defaults",
|
|
730
813
|
"name": "Semantic Threat Detection",
|
|
731
|
-
"description": "
|
|
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": ["
|
|
736
|
-
"is_active": true
|
|
818
|
+
"tags": ["category:semantic", "threat:injection", "threat:jailbreak", "owasp:llm01", "owasp:llm02"]
|
|
737
819
|
},
|
|
738
820
|
{
|
|
739
|
-
"id": "tools
|
|
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": ["
|
|
746
|
-
"is_active": true
|
|
827
|
+
"tags": ["category:tools", "threat:command-injection", "owasp:llm06", "owasp:asi02"]
|
|
747
828
|
},
|
|
748
829
|
{
|
|
749
|
-
"id": "agent-security
|
|
830
|
+
"id": "agent-security.defaults",
|
|
750
831
|
"name": "Agent Security",
|
|
751
|
-
"description": "
|
|
752
|
-
"category": "
|
|
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", "
|
|
756
|
-
|
|
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
|
|
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": ["
|
|
845
|
+
"tags": ["category:tools", "scope:org-wide", "posture:deny-default"]
|
|
768
846
|
},
|
|
769
847
|
{
|
|
770
|
-
"id": "tools
|
|
848
|
+
"id": "tools.mcp-tool-permissions",
|
|
771
849
|
"name": "MCP Tool Permissions",
|
|
772
|
-
"description": "Permit
|
|
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": "
|
|
776
|
-
"tags": ["
|
|
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
|
|
782
|
-
"category": "
|
|
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": "
|
|
785
|
-
"tags": ["
|
|
862
|
+
"severity": "critical",
|
|
863
|
+
"tags": ["category:data-protection", "threat:pii", "threat:secrets", "threat:exfiltration", "owasp:llm06"]
|
|
786
864
|
},
|
|
787
865
|
{
|
|
788
|
-
"id": "llm-default
|
|
789
|
-
"name": "
|
|
790
|
-
"description": "Permit all LLM chat completion requests by default
|
|
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": ["
|
|
872
|
+
"tags": ["category:organization", "surface:process-prompt", "posture:permit-default"]
|
|
795
873
|
}
|
|
796
874
|
]
|
|
797
875
|
}
|