@highflame/policy 2.2.36 → 2.2.38
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/agent_ops/context.json +792 -0
- package/_schemas/agent_ops/schema.cedarschema +127 -109
- package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_cross_origin.cedar +6 -4
- package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_escalation.cedar +5 -4
- package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_inter_agent_injection.cedar +9 -8
- package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_claude_block_injection.cedar +2 -2
- package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_defaults.cedar +3 -3
- package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_multi_agent_trust.cedar +6 -6
- package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_chat_assistant.cedar +5 -4
- package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_defaults.cedar +18 -12
- package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_semantic.cedar +6 -6
- package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_toxicity.cedar +4 -4
- package/_schemas/agent_ops/templates/ported/data-protection/data_protection_advanced_secrets.cedar +4 -2
- package/_schemas/agent_ops/templates/ported/data-protection/data_protection_data_pipeline.cedar +2 -1
- package/_schemas/agent_ops/templates/ported/data-protection/data_protection_defaults.cedar +4 -2
- package/_schemas/agent_ops/templates/ported/data-protection/privacy_advanced_pii.cedar +42 -21
- package/_schemas/agent_ops/templates/ported/data-protection/privacy_defaults.cedar +14 -7
- package/_schemas/agent_ops/templates/ported/data-protection/privacy_pii_model.cedar +10 -5
- package/_schemas/agent_ops/templates/ported/organization/organization_team_permissions.cedar +3 -2
- package/_schemas/agent_ops/templates/ported/threat-detection/security_advanced_block_critical_severity.cedar +3 -3
- package/_schemas/agent_ops/templates/ported/threat-detection/security_chat_assistant.cedar +5 -4
- package/_schemas/agent_ops/templates/ported/threat-detection/security_data_pipeline_block_injection.cedar +3 -2
- package/_schemas/agent_ops/templates/ported/threat-detection/security_injection.cedar +9 -8
- package/_schemas/agent_ops/templates/ported/threat-detection/security_patterns.cedar +5 -3
- package/_schemas/agent_ops/templates/ported/threat-detection/semantic_defaults.cedar +9 -7
- package/_schemas/ai_gateway/context.json +278 -0
- package/_schemas/ai_gateway/schema.cedarschema +37 -7
- package/_schemas/ai_gateway/templates/defaults/agent_security.cedar +5 -16
- package/_schemas/ai_gateway/templates/defaults/pii.cedar +14 -7
- package/_schemas/ai_gateway/templates/defaults/pii_advanced.cedar +42 -21
- package/_schemas/ai_gateway/templates/defaults/pii_model.cedar +10 -5
- package/_schemas/ai_gateway/templates/defaults/semantic.cedar +9 -74
- package/_schemas/ai_gateway/templates/defaults/tools.cedar +7 -38
- package/_schemas/ai_gateway/templates/secrets.cedar +3 -3
- package/_schemas/guardrails/context.json +671 -0
- package/_schemas/guardrails/schema.cedarschema +23 -2
- package/_schemas/guardrails/templates/defaults/agent_identity.cedar +3 -3
- package/_schemas/guardrails/templates/defaults/injection.cedar +9 -8
- package/_schemas/guardrails/templates/defaults/pii.cedar +14 -7
- package/_schemas/guardrails/templates/defaults/pii_model.cedar +10 -5
- package/_schemas/guardrails/templates/defaults/secrets.cedar +4 -2
- package/_schemas/guardrails/templates/defaults/security_patterns.cedar +5 -3
- package/_schemas/guardrails/templates/defaults/semantic.cedar +6 -6
- package/_schemas/guardrails/templates/defaults/toxicity.cedar +6 -6
- package/_schemas/guardrails/templates/profiles/a2a_security/cross_origin.cedar +6 -4
- package/_schemas/guardrails/templates/profiles/a2a_security/escalation_detection.cedar +5 -4
- package/_schemas/guardrails/templates/profiles/a2a_security/inter_agent_injection.cedar +9 -8
- package/_schemas/guardrails/templates/profiles/advanced_detection/pii.cedar +42 -21
- package/_schemas/guardrails/templates/profiles/advanced_detection/secrets.cedar +4 -2
- package/_schemas/guardrails/templates/profiles/chat_assistant/security.cedar +5 -4
- package/_schemas/guardrails/templates/profiles/chat_assistant/trust_safety.cedar +5 -4
- package/_schemas/guardrails/templates/profiles/data_pipeline/data_protection.cedar +2 -1
- package/_schemas/guardrails/templates/profiles/data_pipeline/security.cedar +3 -2
- package/_schemas/guardrails/templates/profiles/multi_agent/agent_trust.cedar +6 -6
- package/_schemas/guardrails/templates/templates.json +0 -9
- package/dist/agent_ops-defaults.gen.js +177 -120
- package/dist/agent_ops-entities.gen.js +5 -1
- package/dist/ai_gateway-defaults.gen.js +90 -164
- package/dist/ai_gateway-entities.gen.js +6 -2
- package/dist/engine.d.ts +10 -0
- package/dist/engine.js +25 -1
- package/dist/guardrails-defaults.gen.js +144 -145
- package/dist/guardrails-entities.gen.js +5 -1
- package/dist/service-schemas.gen.d.ts +3 -3
- package/dist/service-schemas.gen.js +480 -118
- package/package.json +1 -1
- package/_schemas/guardrails/templates/profiles/advanced_detection/threat_severity.cedar +0 -30
- package/_schemas/mcp_gateway/context.json +0 -655
- package/_schemas/mcp_gateway/schema.cedarschema +0 -342
- package/_schemas/mcp_gateway/templates/defaults/agent_security.cedar +0 -140
- package/_schemas/mcp_gateway/templates/defaults/baseline.cedar +0 -23
- package/_schemas/mcp_gateway/templates/defaults/semantic.cedar +0 -105
- package/_schemas/mcp_gateway/templates/defaults/tools.cedar +0 -92
- package/_schemas/mcp_gateway/templates/mcp_server_allowlist.cedar +0 -33
- package/_schemas/mcp_gateway/templates/mcp_tool_permissions.cedar +0 -77
- package/_schemas/mcp_gateway/templates/templates.json +0 -89
- package/dist/mcp_gateway-context.gen.d.ts +0 -51
- package/dist/mcp_gateway-context.gen.js +0 -52
- package/dist/mcp_gateway-defaults.gen.d.ts +0 -61
- package/dist/mcp_gateway-defaults.gen.js +0 -668
- package/dist/mcp_gateway-entities.gen.d.ts +0 -11
- package/dist/mcp_gateway-entities.gen.js +0 -37
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
// MCPGateway Cedar Schema
|
|
2
|
-
// ===================================
|
|
3
|
-
// MCP Gateway Security & Policy Enforcement
|
|
4
|
-
//
|
|
5
|
-
// MCPGateway protects MCP proxy operations (tool calls, server connections)
|
|
6
|
-
// by evaluating threats detected by the Shield detection engine pipeline
|
|
7
|
-
// against Cedar policies.
|
|
8
|
-
//
|
|
9
|
-
// Architecture:
|
|
10
|
-
// MCP Client -> Firehog Proxy -> Shield (detection + Cedar) -> Allow/Deny
|
|
11
|
-
//
|
|
12
|
-
// Threat Coverage:
|
|
13
|
-
// - OWASP Top 10 for LLM Applications 2025 (LLM01, LLM06)
|
|
14
|
-
// - OWASP Top 10 for Agentic Applications (ASI01, ASI02, ASI04)
|
|
15
|
-
// - OWASP MCP Top 10 (MCP01-MCP05)
|
|
16
|
-
|
|
17
|
-
namespace MCPGateway {
|
|
18
|
-
|
|
19
|
-
// =============================================================================
|
|
20
|
-
// ENTITIES - Tenant Hierarchy (ReBAC)
|
|
21
|
-
// =============================================================================
|
|
22
|
-
// MCPGateway does not use App/Session hierarchy.
|
|
23
|
-
//
|
|
24
|
-
// Entity hierarchy:
|
|
25
|
-
// Account (org root)
|
|
26
|
-
// -> Project in [Account]
|
|
27
|
-
// -> Tool/Server in [Project]
|
|
28
|
-
//
|
|
29
|
-
// Policy scoping examples:
|
|
30
|
-
// resource == MCPGateway::Tool::"get_me" -> specific tool
|
|
31
|
-
// resource in MCPGateway::Project::"<uuid>" -> project-wide
|
|
32
|
-
// resource in MCPGateway::Account::"<uuid>" -> org-wide
|
|
33
|
-
|
|
34
|
-
/// Account represents an organization (top-level tenant)
|
|
35
|
-
entity Account;
|
|
36
|
-
|
|
37
|
-
/// Project represents a project within an account
|
|
38
|
-
entity Project in [Account];
|
|
39
|
-
|
|
40
|
-
// =============================================================================
|
|
41
|
-
// ENTITIES - Principals
|
|
42
|
-
// =============================================================================
|
|
43
|
-
|
|
44
|
-
/// Human user authenticated via JWT or API key
|
|
45
|
-
entity User;
|
|
46
|
-
|
|
47
|
-
/// MCP client (default principal for unauthenticated requests)
|
|
48
|
-
entity MCP_Client;
|
|
49
|
-
|
|
50
|
-
// =============================================================================
|
|
51
|
-
// ENTITIES - Resources (scoped under Project)
|
|
52
|
-
// =============================================================================
|
|
53
|
-
|
|
54
|
-
/// MCP tool -- resource for call_tool action
|
|
55
|
-
entity Tool in [Project];
|
|
56
|
-
|
|
57
|
-
/// MCP server -- resource for connect_server action
|
|
58
|
-
entity Server in [Project];
|
|
59
|
-
|
|
60
|
-
/// MCP prompt -- resource for process_prompt action
|
|
61
|
-
entity LlmPrompt in [Project];
|
|
62
|
-
|
|
63
|
-
/// File/resource path -- resource for read_file/write_file actions
|
|
64
|
-
entity FilePath in [Project];
|
|
65
|
-
|
|
66
|
-
// =============================================================================
|
|
67
|
-
// ACTIONS
|
|
68
|
-
// =============================================================================
|
|
69
|
-
|
|
70
|
-
// Call an MCP tool
|
|
71
|
-
// Threat focus: command injection, tool poisoning, rug pull, secrets, PII
|
|
72
|
-
action call_tool appliesTo {
|
|
73
|
-
principal: [User, MCP_Client],
|
|
74
|
-
resource: [Tool],
|
|
75
|
-
context: {
|
|
76
|
-
// --- Content ---
|
|
77
|
-
content: String, // Raw content being scanned
|
|
78
|
-
|
|
79
|
-
// --- Tool & MCP ---
|
|
80
|
-
tool_name?: String, // Tool name
|
|
81
|
-
mcp_server?: String, // MCP server name
|
|
82
|
-
mcp_tool?: String, // MCP tool name
|
|
83
|
-
|
|
84
|
-
// --- Threat Detection (from Shield detection pipeline) ---
|
|
85
|
-
threat_count?: Long, // Total threats detected
|
|
86
|
-
highest_severity?: String, // "critical", "high", "medium", "low", "none"
|
|
87
|
-
threat_categories?: Set<String>, // Threat category names
|
|
88
|
-
detected_threats?: Set<String>, // Detection rule names that matched
|
|
89
|
-
max_threat_severity?: Long, // Numeric severity (0=none, 1=low, 2=medium, 3=high, 4=critical)
|
|
90
|
-
contains_secrets?: Bool, // Whether secrets/credentials detected
|
|
91
|
-
|
|
92
|
-
// --- Secrets (granular) ---
|
|
93
|
-
secret_types?: Set<String>,
|
|
94
|
-
secret_count?: Long,
|
|
95
|
-
|
|
96
|
-
// --- PII Detection ---
|
|
97
|
-
pii_detected?: Bool,
|
|
98
|
-
pii_types?: Set<String>,
|
|
99
|
-
pii_count?: Long,
|
|
100
|
-
|
|
101
|
-
// --- ML Detector Confidence Scores (0-100) ---
|
|
102
|
-
injection_confidence?: Long, // Prompt injection classifier confidence
|
|
103
|
-
jailbreak_confidence?: Long, // Jailbreak detection classifier confidence
|
|
104
|
-
|
|
105
|
-
// --- Agent Security (0-100) ---
|
|
106
|
-
tool_poisoning_score?: Long, // Hidden instructions in tool description/args
|
|
107
|
-
tool_poisoning_detected?: Bool,
|
|
108
|
-
rug_pull_score?: Long, // Tool behavior drift after trust establishment
|
|
109
|
-
rug_pull_detected?: Bool,
|
|
110
|
-
indirect_injection_score?: Long, // Indirect injection via tool output
|
|
111
|
-
|
|
112
|
-
// --- Tool Risk Assessment ---
|
|
113
|
-
tool_risk_score?: Long, // Computed tool risk (0-100)
|
|
114
|
-
tool_category?: String, // "safe", "sensitive", "dangerous"
|
|
115
|
-
tool_is_sensitive?: Bool,
|
|
116
|
-
tool_is_builtin?: Bool,
|
|
117
|
-
|
|
118
|
-
// --- MCP Trust ---
|
|
119
|
-
mcp_server_verified?: Bool, // Whether server is from verified registry
|
|
120
|
-
|
|
121
|
-
// --- Content Safety Scores (0-100) ---
|
|
122
|
-
violence_score?: Long,
|
|
123
|
-
weapons_score?: Long,
|
|
124
|
-
hate_speech_score?: Long,
|
|
125
|
-
crime_score?: Long,
|
|
126
|
-
sexual_score?: Long,
|
|
127
|
-
profanity_score?: Long,
|
|
128
|
-
|
|
129
|
-
// --- Encoding & Unicode Attacks ---
|
|
130
|
-
contains_invisible_chars?: Bool,
|
|
131
|
-
invisible_chars_score?: Long,
|
|
132
|
-
|
|
133
|
-
// --- Behavioral Analysis ---
|
|
134
|
-
loop_detected?: Bool,
|
|
135
|
-
loop_count?: Long,
|
|
136
|
-
loop_tool?: String,
|
|
137
|
-
suspicious_pattern?: Bool,
|
|
138
|
-
pattern_type?: String,
|
|
139
|
-
sequence_risk?: Long,
|
|
140
|
-
|
|
141
|
-
// --- Usage Budget (multi-window, multi-dimension) ---
|
|
142
|
-
budget_remaining_pct?: Long,
|
|
143
|
-
budget_exceeded?: Bool,
|
|
144
|
-
budget_cost_micros_this_turn?: Long,
|
|
145
|
-
budget_model?: String,
|
|
146
|
-
budget_tokens_pct_session?: Long,
|
|
147
|
-
budget_tokens_pct_daily?: Long,
|
|
148
|
-
budget_tokens_pct_monthly?: Long,
|
|
149
|
-
budget_cost_pct_daily?: Long,
|
|
150
|
-
budget_cost_pct_monthly?: Long,
|
|
151
|
-
budget_exceeded_session?: Bool,
|
|
152
|
-
budget_exceeded_daily?: Bool,
|
|
153
|
-
budget_exceeded_monthly?: Bool,
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// Connect to an MCP server
|
|
158
|
-
// Threat focus: supply chain, tool poisoning, rug pull, config risk
|
|
159
|
-
action connect_server appliesTo {
|
|
160
|
-
principal: [User, MCP_Client],
|
|
161
|
-
resource: [Server],
|
|
162
|
-
context: {
|
|
163
|
-
content?: String, // Server config content (if available)
|
|
164
|
-
mcp_server?: String,
|
|
165
|
-
|
|
166
|
-
// --- Threat Detection ---
|
|
167
|
-
threat_count?: Long,
|
|
168
|
-
highest_severity?: String,
|
|
169
|
-
threat_categories?: Set<String>,
|
|
170
|
-
max_threat_severity?: Long,
|
|
171
|
-
|
|
172
|
-
// --- Agent Security (0-100) ---
|
|
173
|
-
tool_poisoning_score?: Long,
|
|
174
|
-
tool_poisoning_detected?: Bool,
|
|
175
|
-
rug_pull_score?: Long,
|
|
176
|
-
rug_pull_detected?: Bool,
|
|
177
|
-
indirect_injection_score?: Long,
|
|
178
|
-
|
|
179
|
-
// --- MCP Trust & Config Risk ---
|
|
180
|
-
mcp_server_verified?: Bool,
|
|
181
|
-
mcp_config_risk?: Bool,
|
|
182
|
-
mcp_risk_score?: Long,
|
|
183
|
-
|
|
184
|
-
// --- Usage Budget (multi-window, multi-dimension) ---
|
|
185
|
-
budget_remaining_pct?: Long,
|
|
186
|
-
budget_exceeded?: Bool,
|
|
187
|
-
budget_cost_micros_this_turn?: Long,
|
|
188
|
-
budget_model?: String,
|
|
189
|
-
budget_tokens_pct_session?: Long,
|
|
190
|
-
budget_tokens_pct_daily?: Long,
|
|
191
|
-
budget_tokens_pct_monthly?: Long,
|
|
192
|
-
budget_cost_pct_daily?: Long,
|
|
193
|
-
budget_cost_pct_monthly?: Long,
|
|
194
|
-
budget_exceeded_session?: Bool,
|
|
195
|
-
budget_exceeded_daily?: Bool,
|
|
196
|
-
budget_exceeded_monthly?: Bool,
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// Process an MCP prompt (prompts/get, prompts/list)
|
|
201
|
-
// Threat focus: injection, jailbreak, secrets, PII, content safety
|
|
202
|
-
action process_prompt appliesTo {
|
|
203
|
-
principal: [User, MCP_Client],
|
|
204
|
-
resource: [LlmPrompt],
|
|
205
|
-
context: {
|
|
206
|
-
content: String,
|
|
207
|
-
mcp_server?: String,
|
|
208
|
-
|
|
209
|
-
// --- Threat Detection ---
|
|
210
|
-
threat_count?: Long,
|
|
211
|
-
highest_severity?: String,
|
|
212
|
-
threat_categories?: Set<String>,
|
|
213
|
-
detected_threats?: Set<String>,
|
|
214
|
-
max_threat_severity?: Long,
|
|
215
|
-
contains_secrets?: Bool,
|
|
216
|
-
|
|
217
|
-
// --- Secrets ---
|
|
218
|
-
secret_types?: Set<String>,
|
|
219
|
-
secret_count?: Long,
|
|
220
|
-
|
|
221
|
-
// --- PII Detection ---
|
|
222
|
-
pii_detected?: Bool,
|
|
223
|
-
pii_types?: Set<String>,
|
|
224
|
-
pii_count?: Long,
|
|
225
|
-
|
|
226
|
-
// --- ML Detector Confidence Scores (0-100) ---
|
|
227
|
-
injection_confidence?: Long,
|
|
228
|
-
jailbreak_confidence?: Long,
|
|
229
|
-
|
|
230
|
-
// --- Content Safety Scores (0-100) ---
|
|
231
|
-
violence_score?: Long,
|
|
232
|
-
weapons_score?: Long,
|
|
233
|
-
hate_speech_score?: Long,
|
|
234
|
-
crime_score?: Long,
|
|
235
|
-
sexual_score?: Long,
|
|
236
|
-
profanity_score?: Long,
|
|
237
|
-
|
|
238
|
-
// --- Encoding ---
|
|
239
|
-
contains_invisible_chars?: Bool,
|
|
240
|
-
invisible_chars_score?: Long,
|
|
241
|
-
|
|
242
|
-
// --- Usage Budget (multi-window, multi-dimension) ---
|
|
243
|
-
budget_remaining_pct?: Long,
|
|
244
|
-
budget_exceeded?: Bool,
|
|
245
|
-
budget_cost_micros_this_turn?: Long,
|
|
246
|
-
budget_model?: String,
|
|
247
|
-
budget_tokens_pct_session?: Long,
|
|
248
|
-
budget_tokens_pct_daily?: Long,
|
|
249
|
-
budget_tokens_pct_monthly?: Long,
|
|
250
|
-
budget_cost_pct_daily?: Long,
|
|
251
|
-
budget_cost_pct_monthly?: Long,
|
|
252
|
-
budget_exceeded_session?: Bool,
|
|
253
|
-
budget_exceeded_daily?: Bool,
|
|
254
|
-
budget_exceeded_monthly?: Bool,
|
|
255
|
-
},
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// Read an MCP resource (resources/read, resources/list)
|
|
259
|
-
// Threat focus: secrets exposure, PII exposure, sensitive paths
|
|
260
|
-
action read_file appliesTo {
|
|
261
|
-
principal: [User, MCP_Client],
|
|
262
|
-
resource: [FilePath],
|
|
263
|
-
context: {
|
|
264
|
-
content: String,
|
|
265
|
-
mcp_server?: String,
|
|
266
|
-
|
|
267
|
-
// --- Threat Detection ---
|
|
268
|
-
threat_count?: Long,
|
|
269
|
-
highest_severity?: String,
|
|
270
|
-
threat_categories?: Set<String>,
|
|
271
|
-
detected_threats?: Set<String>,
|
|
272
|
-
max_threat_severity?: Long,
|
|
273
|
-
contains_secrets?: Bool,
|
|
274
|
-
|
|
275
|
-
// --- Secrets ---
|
|
276
|
-
secret_types?: Set<String>,
|
|
277
|
-
secret_count?: Long,
|
|
278
|
-
|
|
279
|
-
// --- PII Detection ---
|
|
280
|
-
pii_detected?: Bool,
|
|
281
|
-
pii_types?: Set<String>,
|
|
282
|
-
pii_count?: Long,
|
|
283
|
-
|
|
284
|
-
// --- Usage Budget (multi-window, multi-dimension) ---
|
|
285
|
-
budget_remaining_pct?: Long,
|
|
286
|
-
budget_exceeded?: Bool,
|
|
287
|
-
budget_cost_micros_this_turn?: Long,
|
|
288
|
-
budget_model?: String,
|
|
289
|
-
budget_tokens_pct_session?: Long,
|
|
290
|
-
budget_tokens_pct_daily?: Long,
|
|
291
|
-
budget_tokens_pct_monthly?: Long,
|
|
292
|
-
budget_cost_pct_daily?: Long,
|
|
293
|
-
budget_cost_pct_monthly?: Long,
|
|
294
|
-
budget_exceeded_session?: Bool,
|
|
295
|
-
budget_exceeded_daily?: Bool,
|
|
296
|
-
budget_exceeded_monthly?: Bool,
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
// Write an MCP resource (resources/write)
|
|
301
|
-
// Threat focus: secrets in output, PII in output
|
|
302
|
-
action write_file appliesTo {
|
|
303
|
-
principal: [User, MCP_Client],
|
|
304
|
-
resource: [FilePath],
|
|
305
|
-
context: {
|
|
306
|
-
content: String,
|
|
307
|
-
mcp_server?: String,
|
|
308
|
-
|
|
309
|
-
// --- Threat Detection ---
|
|
310
|
-
threat_count?: Long,
|
|
311
|
-
highest_severity?: String,
|
|
312
|
-
threat_categories?: Set<String>,
|
|
313
|
-
detected_threats?: Set<String>,
|
|
314
|
-
max_threat_severity?: Long,
|
|
315
|
-
contains_secrets?: Bool,
|
|
316
|
-
|
|
317
|
-
// --- Secrets ---
|
|
318
|
-
secret_types?: Set<String>,
|
|
319
|
-
secret_count?: Long,
|
|
320
|
-
|
|
321
|
-
// --- PII Detection ---
|
|
322
|
-
pii_detected?: Bool,
|
|
323
|
-
pii_types?: Set<String>,
|
|
324
|
-
pii_count?: Long,
|
|
325
|
-
|
|
326
|
-
// --- Usage Budget (multi-window, multi-dimension) ---
|
|
327
|
-
budget_remaining_pct?: Long,
|
|
328
|
-
budget_exceeded?: Bool,
|
|
329
|
-
budget_cost_micros_this_turn?: Long,
|
|
330
|
-
budget_model?: String,
|
|
331
|
-
budget_tokens_pct_session?: Long,
|
|
332
|
-
budget_tokens_pct_daily?: Long,
|
|
333
|
-
budget_tokens_pct_monthly?: Long,
|
|
334
|
-
budget_cost_pct_daily?: Long,
|
|
335
|
-
budget_cost_pct_monthly?: Long,
|
|
336
|
-
budget_exceeded_session?: Bool,
|
|
337
|
-
budget_exceeded_daily?: Bool,
|
|
338
|
-
budget_exceeded_monthly?: Bool,
|
|
339
|
-
},
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
// =============================================================================
|
|
2
|
-
// Agent Security Policy (Default)
|
|
3
|
-
// =============================================================================
|
|
4
|
-
// Detects and blocks tool poisoning, rug pull attacks, indirect prompt injection,
|
|
5
|
-
// and MCP supply chain threats.
|
|
6
|
-
//
|
|
7
|
-
// Category: agent_security
|
|
8
|
-
// Namespace: MCPGateway
|
|
9
|
-
// =============================================================================
|
|
10
|
-
|
|
11
|
-
// Block tool calls with tool poisoning risk
|
|
12
|
-
@id("as-block-tool-poisoning")
|
|
13
|
-
@name("Block tool poisoning")
|
|
14
|
-
@description("Block tool execution when hidden instructions are detected in tool descriptions or arguments (score >= 70)")
|
|
15
|
-
@severity("critical")
|
|
16
|
-
@tags("tool-poisoning,agent-security,owasp-asi01")
|
|
17
|
-
@reject_message("Tool execution blocked: hidden manipulation instructions detected in tool description or arguments (OWASP ASI01).")
|
|
18
|
-
forbid (
|
|
19
|
-
principal,
|
|
20
|
-
action == MCPGateway::Action::"call_tool",
|
|
21
|
-
resource
|
|
22
|
-
)
|
|
23
|
-
when {
|
|
24
|
-
context has tool_poisoning_score && context.tool_poisoning_score >= 70
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// Block MCP server connections with poisoning risk
|
|
28
|
-
@id("as-block-server-poisoning")
|
|
29
|
-
@name("Block poisoned MCP servers")
|
|
30
|
-
@description("Block connections to MCP servers when tool poisoning patterns are detected (score >= 60)")
|
|
31
|
-
@severity("critical")
|
|
32
|
-
@tags("tool-poisoning,mcp-security,owasp-asi04,owasp-mcp02")
|
|
33
|
-
@reject_message("MCP server connection blocked: tool poisoning patterns detected in server tool descriptions.")
|
|
34
|
-
forbid (
|
|
35
|
-
principal,
|
|
36
|
-
action == MCPGateway::Action::"connect_server",
|
|
37
|
-
resource
|
|
38
|
-
)
|
|
39
|
-
when {
|
|
40
|
-
context has tool_poisoning_score && context.tool_poisoning_score >= 60
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Block tool calls with behavioral drift (rug pull)
|
|
44
|
-
@id("as-block-rug-pull")
|
|
45
|
-
@name("Block rug pull attacks")
|
|
46
|
-
@description("Block tool execution when behavioral drift is detected (score >= 70)")
|
|
47
|
-
@severity("critical")
|
|
48
|
-
@tags("rug-pull,agent-security,owasp-asi04")
|
|
49
|
-
@reject_message("Tool execution blocked: tool behavior has changed significantly from its established pattern.")
|
|
50
|
-
forbid (
|
|
51
|
-
principal,
|
|
52
|
-
action in [MCPGateway::Action::"call_tool", MCPGateway::Action::"connect_server"],
|
|
53
|
-
resource
|
|
54
|
-
)
|
|
55
|
-
when {
|
|
56
|
-
context has rug_pull_score && context.rug_pull_score >= 70
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// Block with indirect injection from tool outputs
|
|
60
|
-
@id("as-block-indirect-injection")
|
|
61
|
-
@name("Block indirect prompt injection")
|
|
62
|
-
@description("Block when indirect prompt injection is detected in tool outputs (score >= 70)")
|
|
63
|
-
@severity("critical")
|
|
64
|
-
@tags("indirect-injection,owasp-llm01,owasp-asi01")
|
|
65
|
-
@reject_message("Content blocked: indirect prompt injection detected in tool output or retrieved content.")
|
|
66
|
-
forbid (
|
|
67
|
-
principal,
|
|
68
|
-
action in [MCPGateway::Action::"call_tool", MCPGateway::Action::"connect_server"],
|
|
69
|
-
resource
|
|
70
|
-
)
|
|
71
|
-
when {
|
|
72
|
-
context has indirect_injection_score && context.indirect_injection_score >= 70
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// Strict indirect injection for sensitive tool calls
|
|
76
|
-
@id("as-block-indirect-injection-sensitive-tools")
|
|
77
|
-
@name("Block indirect injection on sensitive tools")
|
|
78
|
-
@description("Lower threshold (>= 50) for indirect injection when the tool is classified as sensitive")
|
|
79
|
-
@severity("critical")
|
|
80
|
-
@tags("indirect-injection,sensitive-tools,owasp-asi02")
|
|
81
|
-
@reject_message("Sensitive tool execution blocked: moderate indirect injection risk detected.")
|
|
82
|
-
forbid (
|
|
83
|
-
principal,
|
|
84
|
-
action == MCPGateway::Action::"call_tool",
|
|
85
|
-
resource
|
|
86
|
-
)
|
|
87
|
-
when {
|
|
88
|
-
context has indirect_injection_score && context.indirect_injection_score >= 50 &&
|
|
89
|
-
context has tool_is_sensitive && context.tool_is_sensitive
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// Block unverified MCP server tool calls with detected threats
|
|
93
|
-
@id("as-block-unverified-threats")
|
|
94
|
-
@name("Block unverified server threats")
|
|
95
|
-
@description("Block tool calls from unverified MCP servers when any threat is detected")
|
|
96
|
-
@severity("high")
|
|
97
|
-
@tags("mcp-trust,owasp-asi04,supply-chain")
|
|
98
|
-
@reject_message("Tool execution blocked: the MCP server is unverified and security threats were detected.")
|
|
99
|
-
forbid (
|
|
100
|
-
principal,
|
|
101
|
-
action == MCPGateway::Action::"call_tool",
|
|
102
|
-
resource
|
|
103
|
-
)
|
|
104
|
-
when {
|
|
105
|
-
context has mcp_server_verified && context.mcp_server_verified == false &&
|
|
106
|
-
context has threat_count && context.threat_count > 0
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
// Block connections to MCP servers with risky configurations
|
|
110
|
-
@id("as-block-mcp-config-risk")
|
|
111
|
-
@name("Block risky MCP server configs")
|
|
112
|
-
@description("Block MCP server connections when risky configuration patterns are detected (score >= 70)")
|
|
113
|
-
@severity("high")
|
|
114
|
-
@tags("mcp-config,owasp-mcp03,supply-chain")
|
|
115
|
-
@reject_message("MCP server connection blocked: risky server configuration detected.")
|
|
116
|
-
forbid (
|
|
117
|
-
principal,
|
|
118
|
-
action == MCPGateway::Action::"connect_server",
|
|
119
|
-
resource
|
|
120
|
-
)
|
|
121
|
-
when {
|
|
122
|
-
context has mcp_config_risk && context.mcp_config_risk &&
|
|
123
|
-
context has mcp_risk_score && context.mcp_risk_score >= 70
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// Block connections to unverified MCP servers
|
|
127
|
-
@id("as-block-unverified-server-connect")
|
|
128
|
-
@name("Block unverified MCP server connections")
|
|
129
|
-
@description("Block connections to MCP servers that are not from a verified registry")
|
|
130
|
-
@severity("high")
|
|
131
|
-
@tags("mcp-trust,owasp-asi04,owasp-mcp05,supply-chain")
|
|
132
|
-
@reject_message("MCP server connection blocked: server is not from a verified registry.")
|
|
133
|
-
forbid (
|
|
134
|
-
principal,
|
|
135
|
-
action == MCPGateway::Action::"connect_server",
|
|
136
|
-
resource
|
|
137
|
-
)
|
|
138
|
-
when {
|
|
139
|
-
context has mcp_server_verified && context.mcp_server_verified == false
|
|
140
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// =============================================================================
|
|
2
|
-
// Baseline Permit Policy (Default)
|
|
3
|
-
// =============================================================================
|
|
4
|
-
// Permits all actions by default. Threat-specific forbid policies override
|
|
5
|
-
// this to block when detection engines identify issues.
|
|
6
|
-
//
|
|
7
|
-
// Cedar is default-deny: without at least one permit rule, every request
|
|
8
|
-
// is denied regardless of forbid rules.
|
|
9
|
-
//
|
|
10
|
-
// Category: organization
|
|
11
|
-
// Namespace: MCPGateway
|
|
12
|
-
// =============================================================================
|
|
13
|
-
|
|
14
|
-
@id("baseline-permit-all")
|
|
15
|
-
@name("Permit all actions by default")
|
|
16
|
-
@description("Baseline permit for all actions -- threat-specific forbid policies override this when threats are detected")
|
|
17
|
-
@severity("low")
|
|
18
|
-
@tags("baseline,permit-default,organization")
|
|
19
|
-
permit (
|
|
20
|
-
principal,
|
|
21
|
-
action,
|
|
22
|
-
resource
|
|
23
|
-
);
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// =============================================================================
|
|
2
|
-
// Semantic Threat Detection Policy (Default)
|
|
3
|
-
// =============================================================================
|
|
4
|
-
// Detects and blocks prompt injection, jailbreak attempts, and high-severity
|
|
5
|
-
// threats in MCP tool calls and server connections.
|
|
6
|
-
//
|
|
7
|
-
// Category: semantic
|
|
8
|
-
// Namespace: MCPGateway
|
|
9
|
-
// =============================================================================
|
|
10
|
-
|
|
11
|
-
// Block content with prompt injection patterns detected by rules
|
|
12
|
-
@id("semantic-block-injection")
|
|
13
|
-
@name("Block prompt injection")
|
|
14
|
-
@description("Block tool calls when detection engine rules identify prompt injection patterns in tool arguments or content")
|
|
15
|
-
@severity("critical")
|
|
16
|
-
@tags("injection,security,owasp-llm01,baseline")
|
|
17
|
-
@reject_message("Tool call was blocked because prompt injection patterns were detected in the content (OWASP LLM01).")
|
|
18
|
-
forbid (
|
|
19
|
-
principal,
|
|
20
|
-
action == MCPGateway::Action::"call_tool",
|
|
21
|
-
resource
|
|
22
|
-
)
|
|
23
|
-
when {
|
|
24
|
-
context has detected_threats && context.detected_threats.contains("prompt_injection")
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// Block content with high ML injection confidence
|
|
28
|
-
@id("semantic-block-injection-score")
|
|
29
|
-
@name("Block high-confidence injection")
|
|
30
|
-
@description("Block tool calls when the ML injection classifier confidence exceeds 75/100")
|
|
31
|
-
@severity("critical")
|
|
32
|
-
@tags("injection,ml-classifier,security,owasp-llm01")
|
|
33
|
-
@reject_message("Tool call was blocked because the ML classifier detected prompt injection with high confidence.")
|
|
34
|
-
forbid (
|
|
35
|
-
principal,
|
|
36
|
-
action == MCPGateway::Action::"call_tool",
|
|
37
|
-
resource
|
|
38
|
-
)
|
|
39
|
-
when {
|
|
40
|
-
context has injection_confidence && context.injection_confidence >= 75
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Block content with jailbreak patterns
|
|
44
|
-
@id("semantic-block-jailbreak")
|
|
45
|
-
@name("Block jailbreak attempts")
|
|
46
|
-
@description("Block tool calls when jailbreak patterns are detected in content")
|
|
47
|
-
@severity("critical")
|
|
48
|
-
@tags("jailbreak,security,owasp-llm02,baseline")
|
|
49
|
-
@reject_message("Tool call was blocked because jailbreak patterns were detected.")
|
|
50
|
-
forbid (
|
|
51
|
-
principal,
|
|
52
|
-
action == MCPGateway::Action::"call_tool",
|
|
53
|
-
resource
|
|
54
|
-
)
|
|
55
|
-
when {
|
|
56
|
-
context has detected_threats && context.detected_threats.contains("jailbreak")
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// Block content with high ML jailbreak confidence
|
|
60
|
-
@id("semantic-block-jailbreak-score")
|
|
61
|
-
@name("Block high-confidence jailbreak")
|
|
62
|
-
@description("Block tool calls when the ML jailbreak classifier confidence exceeds 75/100")
|
|
63
|
-
@severity("critical")
|
|
64
|
-
@tags("jailbreak,ml-classifier,security,owasp-llm02")
|
|
65
|
-
@reject_message("Tool call was blocked because the ML classifier detected a jailbreak attempt with high confidence.")
|
|
66
|
-
forbid (
|
|
67
|
-
principal,
|
|
68
|
-
action == MCPGateway::Action::"call_tool",
|
|
69
|
-
resource
|
|
70
|
-
)
|
|
71
|
-
when {
|
|
72
|
-
context has jailbreak_confidence && context.jailbreak_confidence >= 75
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// Block any content with critical severity threats
|
|
76
|
-
@id("semantic-block-critical")
|
|
77
|
-
@name("Block critical threats")
|
|
78
|
-
@description("Block all MCP operations when any detection engine reports critical severity")
|
|
79
|
-
@severity("critical")
|
|
80
|
-
@tags("critical,baseline,security,catch-all")
|
|
81
|
-
@reject_message("MCP operation was blocked because security scanners detected a critical-severity threat.")
|
|
82
|
-
forbid (
|
|
83
|
-
principal,
|
|
84
|
-
action,
|
|
85
|
-
resource
|
|
86
|
-
)
|
|
87
|
-
when {
|
|
88
|
-
context has highest_severity && context.highest_severity == "critical"
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// Block tool calls with multiple concurrent threats
|
|
92
|
-
@id("semantic-block-multi-threat-tools")
|
|
93
|
-
@name("Block multi-threat tool calls")
|
|
94
|
-
@description("Block tool execution when 3+ distinct threats are detected simultaneously")
|
|
95
|
-
@severity("high")
|
|
96
|
-
@tags("multi-threat,tools,security,defense-in-depth")
|
|
97
|
-
@reject_message("Tool execution was blocked because multiple security threats were detected simultaneously.")
|
|
98
|
-
forbid (
|
|
99
|
-
principal,
|
|
100
|
-
action == MCPGateway::Action::"call_tool",
|
|
101
|
-
resource
|
|
102
|
-
)
|
|
103
|
-
when {
|
|
104
|
-
context has threat_count && context.threat_count >= 3
|
|
105
|
-
};
|