@highflame/policy 2.2.35 → 2.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/_schemas/agent_ops/context.json +822 -0
  2. package/_schemas/agent_ops/schema.cedarschema +134 -109
  3. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_cross_origin.cedar +6 -4
  4. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_escalation.cedar +5 -4
  5. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_inter_agent_injection.cedar +9 -8
  6. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_claude_block_injection.cedar +2 -2
  7. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_defaults.cedar +3 -3
  8. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_multi_agent_trust.cedar +6 -6
  9. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_chat_assistant.cedar +5 -4
  10. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_defaults.cedar +18 -12
  11. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_semantic.cedar +6 -6
  12. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_toxicity.cedar +4 -4
  13. package/_schemas/agent_ops/templates/ported/data-protection/data_protection_advanced_secrets.cedar +4 -2
  14. package/_schemas/agent_ops/templates/ported/data-protection/data_protection_data_pipeline.cedar +2 -1
  15. package/_schemas/agent_ops/templates/ported/data-protection/data_protection_defaults.cedar +4 -2
  16. package/_schemas/agent_ops/templates/ported/data-protection/privacy_advanced_pii.cedar +42 -21
  17. package/_schemas/agent_ops/templates/ported/data-protection/privacy_defaults.cedar +14 -7
  18. package/_schemas/agent_ops/templates/ported/data-protection/privacy_pii_model.cedar +10 -5
  19. package/_schemas/agent_ops/templates/ported/organization/organization_team_permissions.cedar +3 -2
  20. package/_schemas/agent_ops/templates/ported/threat-detection/security_advanced_block_critical_severity.cedar +3 -3
  21. package/_schemas/agent_ops/templates/ported/threat-detection/security_chat_assistant.cedar +5 -4
  22. package/_schemas/agent_ops/templates/ported/threat-detection/security_data_pipeline_block_injection.cedar +3 -2
  23. package/_schemas/agent_ops/templates/ported/threat-detection/security_injection.cedar +9 -8
  24. package/_schemas/agent_ops/templates/ported/threat-detection/security_patterns.cedar +5 -3
  25. package/_schemas/agent_ops/templates/ported/threat-detection/semantic_defaults.cedar +9 -7
  26. package/_schemas/ai_gateway/context.json +308 -0
  27. package/_schemas/ai_gateway/schema.cedarschema +44 -7
  28. package/_schemas/ai_gateway/templates/defaults/agent_security.cedar +5 -16
  29. package/_schemas/ai_gateway/templates/defaults/pii.cedar +14 -7
  30. package/_schemas/ai_gateway/templates/defaults/pii_advanced.cedar +42 -21
  31. package/_schemas/ai_gateway/templates/defaults/pii_model.cedar +10 -5
  32. package/_schemas/ai_gateway/templates/defaults/semantic.cedar +9 -74
  33. package/_schemas/ai_gateway/templates/defaults/tools.cedar +7 -38
  34. package/_schemas/ai_gateway/templates/secrets.cedar +3 -3
  35. package/_schemas/guardrails/context.json +701 -0
  36. package/_schemas/guardrails/schema.cedarschema +30 -2
  37. package/_schemas/guardrails/templates/defaults/agent_identity.cedar +3 -3
  38. package/_schemas/guardrails/templates/defaults/injection.cedar +9 -8
  39. package/_schemas/guardrails/templates/defaults/pii.cedar +14 -7
  40. package/_schemas/guardrails/templates/defaults/pii_model.cedar +10 -5
  41. package/_schemas/guardrails/templates/defaults/secrets.cedar +4 -2
  42. package/_schemas/guardrails/templates/defaults/security_patterns.cedar +5 -3
  43. package/_schemas/guardrails/templates/defaults/semantic.cedar +6 -6
  44. package/_schemas/guardrails/templates/defaults/toxicity.cedar +6 -6
  45. package/_schemas/guardrails/templates/profiles/a2a_security/cross_origin.cedar +6 -4
  46. package/_schemas/guardrails/templates/profiles/a2a_security/escalation_detection.cedar +5 -4
  47. package/_schemas/guardrails/templates/profiles/a2a_security/inter_agent_injection.cedar +9 -8
  48. package/_schemas/guardrails/templates/profiles/advanced_detection/pii.cedar +42 -21
  49. package/_schemas/guardrails/templates/profiles/advanced_detection/secrets.cedar +4 -2
  50. package/_schemas/guardrails/templates/profiles/chat_assistant/security.cedar +5 -4
  51. package/_schemas/guardrails/templates/profiles/chat_assistant/trust_safety.cedar +5 -4
  52. package/_schemas/guardrails/templates/profiles/data_pipeline/data_protection.cedar +2 -1
  53. package/_schemas/guardrails/templates/profiles/data_pipeline/security.cedar +3 -2
  54. package/_schemas/guardrails/templates/profiles/multi_agent/agent_trust.cedar +6 -6
  55. package/_schemas/guardrails/templates/templates.json +0 -9
  56. package/_schemas/overwatch/context.json +30 -0
  57. package/_schemas/overwatch/schema.cedarschema +7 -0
  58. package/dist/agent_ops-context.gen.d.ts +6 -1
  59. package/dist/agent_ops-context.gen.js +10 -0
  60. package/dist/agent_ops-defaults.gen.js +177 -120
  61. package/dist/agent_ops-entities.gen.js +5 -1
  62. package/dist/ai_gateway-context.gen.d.ts +6 -1
  63. package/dist/ai_gateway-context.gen.js +10 -0
  64. package/dist/ai_gateway-defaults.gen.js +90 -164
  65. package/dist/ai_gateway-detectors.gen.js +6 -1
  66. package/dist/ai_gateway-entities.gen.js +6 -2
  67. package/dist/guardrails-context.gen.d.ts +6 -1
  68. package/dist/guardrails-context.gen.js +10 -0
  69. package/dist/guardrails-defaults.gen.js +144 -145
  70. package/dist/guardrails-detectors.gen.js +6 -1
  71. package/dist/guardrails-entities.gen.js +5 -1
  72. package/dist/overwatch-context.gen.d.ts +6 -1
  73. package/dist/overwatch-context.gen.js +10 -0
  74. package/dist/overwatch-detectors.gen.js +6 -1
  75. package/dist/service-schemas.gen.d.ts +4 -4
  76. package/dist/service-schemas.gen.js +528 -118
  77. package/package.json +1 -1
  78. package/_schemas/guardrails/templates/profiles/advanced_detection/threat_severity.cedar +0 -30
@@ -22,7 +22,8 @@
22
22
  @reject_message("Content blocked: national identifier (SSN, passport, or driver's license) patterns detected.")
23
23
  forbid (
24
24
  principal,
25
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
25
+ action in [AIGateway::Action::"process_prompt",
26
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
26
27
  resource
27
28
  )
28
29
  when {
@@ -44,7 +45,8 @@ when {
44
45
  @reject_message("Content blocked: credit card number patterns detected.")
45
46
  forbid (
46
47
  principal,
47
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
48
+ action in [AIGateway::Action::"process_prompt",
49
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
48
50
  resource
49
51
  )
50
52
  when {
@@ -63,7 +65,8 @@ when {
63
65
  @reject_message("Content blocked: bank account (IBAN) number patterns detected.")
64
66
  forbid (
65
67
  principal,
66
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
68
+ action in [AIGateway::Action::"process_prompt",
69
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
67
70
  resource
68
71
  )
69
72
  when {
@@ -85,7 +88,8 @@ when {
85
88
  @reject_message("Content blocked: medical record identifier patterns detected.")
86
89
  forbid (
87
90
  principal,
88
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
91
+ action in [AIGateway::Action::"process_prompt",
92
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
89
93
  resource
90
94
  )
91
95
  when {
@@ -109,7 +113,8 @@ when {
109
113
  @reject_message("Content blocked: tax identifier (ITIN or EIN) patterns detected.")
110
114
  forbid (
111
115
  principal,
112
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
116
+ action in [AIGateway::Action::"process_prompt",
117
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
113
118
  resource
114
119
  )
115
120
  when {
@@ -129,7 +134,8 @@ when {
129
134
  @reject_message("Content blocked: credential or API key patterns detected.")
130
135
  forbid (
131
136
  principal,
132
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
137
+ action in [AIGateway::Action::"process_prompt",
138
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
133
139
  resource
134
140
  )
135
141
  when {
@@ -160,7 +166,8 @@ when {
160
166
  @reject_message("Content blocked: cryptocurrency wallet address patterns detected.")
161
167
  forbid (
162
168
  principal,
163
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
169
+ action in [AIGateway::Action::"process_prompt",
170
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
164
171
  resource
165
172
  )
166
173
  when {
@@ -179,7 +186,8 @@ when {
179
186
  @reject_message("Content blocked: personal name patterns detected.")
180
187
  forbid (
181
188
  principal,
182
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
189
+ action in [AIGateway::Action::"process_prompt",
190
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
183
191
  resource
184
192
  )
185
193
  when {
@@ -198,7 +206,8 @@ when {
198
206
  @reject_message("Content blocked: email address patterns detected.")
199
207
  forbid (
200
208
  principal,
201
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
209
+ action in [AIGateway::Action::"process_prompt",
210
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
202
211
  resource
203
212
  )
204
213
  when {
@@ -217,7 +226,8 @@ when {
217
226
  @reject_message("Content blocked: phone number patterns detected.")
218
227
  forbid (
219
228
  principal,
220
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
229
+ action in [AIGateway::Action::"process_prompt",
230
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
221
231
  resource
222
232
  )
223
233
  when {
@@ -236,7 +246,8 @@ when {
236
246
  @reject_message("Content blocked: date or time patterns detected.")
237
247
  forbid (
238
248
  principal,
239
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
249
+ action in [AIGateway::Action::"process_prompt",
250
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
240
251
  resource
241
252
  )
242
253
  when {
@@ -258,7 +269,8 @@ when {
258
269
  @reject_message("Content blocked: URL patterns detected.")
259
270
  forbid (
260
271
  principal,
261
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
272
+ action in [AIGateway::Action::"process_prompt",
273
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
262
274
  resource
263
275
  )
264
276
  when {
@@ -277,7 +289,8 @@ when {
277
289
  @reject_message("Content blocked: street address or location patterns detected.")
278
290
  forbid (
279
291
  principal,
280
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
292
+ action in [AIGateway::Action::"process_prompt",
293
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
281
294
  resource
282
295
  )
283
296
  when {
@@ -298,7 +311,8 @@ when {
298
311
  @reject_message("Content blocked: organization name patterns detected.")
299
312
  forbid (
300
313
  principal,
301
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
314
+ action in [AIGateway::Action::"process_prompt",
315
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
302
316
  resource
303
317
  )
304
318
  when {
@@ -317,7 +331,8 @@ when {
317
331
  @reject_message("Content blocked: occupation patterns detected.")
318
332
  forbid (
319
333
  principal,
320
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
334
+ action in [AIGateway::Action::"process_prompt",
335
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
321
336
  resource
322
337
  )
323
338
  when {
@@ -336,7 +351,8 @@ when {
336
351
  @reject_message("Content blocked: username patterns detected.")
337
352
  forbid (
338
353
  principal,
339
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
354
+ action in [AIGateway::Action::"process_prompt",
355
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
340
356
  resource
341
357
  )
342
358
  when {
@@ -355,7 +371,8 @@ when {
355
371
  @reject_message("Content blocked: employee or customer identifier patterns detected.")
356
372
  forbid (
357
373
  principal,
358
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
374
+ action in [AIGateway::Action::"process_prompt",
375
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
359
376
  resource
360
377
  )
361
378
  when {
@@ -376,7 +393,8 @@ when {
376
393
  @reject_message("Content blocked: device or network identifier patterns detected.")
377
394
  forbid (
378
395
  principal,
379
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
396
+ action in [AIGateway::Action::"process_prompt",
397
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
380
398
  resource
381
399
  )
382
400
  when {
@@ -403,7 +421,8 @@ when {
403
421
  @reject_message("Content blocked: vehicle identifier (VIN or plate) patterns detected.")
404
422
  forbid (
405
423
  principal,
406
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
424
+ action in [AIGateway::Action::"process_prompt",
425
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
407
426
  resource
408
427
  )
409
428
  when {
@@ -423,7 +442,8 @@ when {
423
442
  @reject_message("Content blocked: salary or financial amount patterns detected.")
424
443
  forbid (
425
444
  principal,
426
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
445
+ action in [AIGateway::Action::"process_prompt",
446
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
427
447
  resource
428
448
  )
429
449
  when {
@@ -444,7 +464,8 @@ when {
444
464
  @reject_message("Content blocked: sensitive attribute (ethnicity, religion, etc.) patterns detected.")
445
465
  forbid (
446
466
  principal,
447
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
467
+ action in [AIGateway::Action::"process_prompt",
468
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
448
469
  resource
449
470
  )
450
471
  when {
@@ -22,7 +22,8 @@
22
22
  @reject_message("Content blocked: national identifier (SSN, passport, or driver's license) patterns detected.")
23
23
  forbid (
24
24
  principal,
25
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
25
+ action in [AIGateway::Action::"process_prompt",
26
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
26
27
  resource
27
28
  )
28
29
  when {
@@ -37,7 +38,8 @@ when {
37
38
  @reject_message("Content blocked: credit card number patterns detected.")
38
39
  forbid (
39
40
  principal,
40
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
41
+ action in [AIGateway::Action::"process_prompt",
42
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
41
43
  resource
42
44
  )
43
45
  when {
@@ -52,7 +54,8 @@ when {
52
54
  @reject_message("Content blocked: bank account (IBAN) number patterns detected.")
53
55
  forbid (
54
56
  principal,
55
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
57
+ action in [AIGateway::Action::"process_prompt",
58
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
56
59
  resource
57
60
  )
58
61
  when {
@@ -67,7 +70,8 @@ when {
67
70
  @reject_message("Content blocked: medical record identifier patterns detected.")
68
71
  forbid (
69
72
  principal,
70
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
73
+ action in [AIGateway::Action::"process_prompt",
74
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
71
75
  resource
72
76
  )
73
77
  when {
@@ -82,7 +86,8 @@ when {
82
86
  @reject_message("Content blocked: credential or API key patterns detected.")
83
87
  forbid (
84
88
  principal,
85
- action in [AIGateway::Action::"process_prompt", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
89
+ action in [AIGateway::Action::"process_prompt",
90
+ AIGateway::Action::"process_response", AIGateway::Action::"call_tool", AIGateway::Action::"read_file", AIGateway::Action::"write_file"],
86
91
  resource
87
92
  )
88
93
  when {
@@ -1,21 +1,20 @@
1
1
  // =============================================================================
2
2
  // Semantic Threat Detection (Default)
3
3
  // =============================================================================
4
- // Blocks prompt injection, jailbreak attempts, and high-severity threats in
5
- // MCP tool calls and LLM prompts. Uses both detection-engine rule triggers and
6
- // ML classifier confidence scores.
4
+ // Blocks prompt injection and jailbreak attempts in MCP tool calls and LLM
5
+ // prompts via ML classifier confidence scores.
7
6
  //
8
- // Detection layers:
9
- // - Rule triggers (detected_threats), always available
10
- // - ML classifier scores (injection_score, jailbreak_score), require API token
11
- // - Severity aggregation (highest_severity, threat_count), catch-all rules
7
+ // The detected_threats rule-trigger clauses and the highest_severity /
8
+ // threat_count severity-aggregation clauses this template used to carry were
9
+ // removed: AIGateway does not run threat aggregation, so its projected context
10
+ // never contains those keys and the rules could never fire
11
+ // (highflame-shield#429). The ML-score rules below are the working coverage
12
+ // for the same threats. Restore aggregate rules only if the product gains
13
+ // aggregation.
12
14
  //
13
15
  // Context keys consumed:
14
- // - detected_threats: Set<String>
15
16
  // - injection_score: Long (0-100)
16
17
  // - jailbreak_score: Long (0-100)
17
- // - highest_severity: String
18
- // - threat_count: Long
19
18
  //
20
19
  // Compliance:
21
20
  // - OWASP LLM01, OWASP LLM02
@@ -29,21 +28,6 @@
29
28
  // Section 1: Prompt injection
30
29
  // ---------------------------------------------------------------------------
31
30
 
32
- @id("semantic.block-injection-rule")
33
- @name("Block injection (rule)")
34
- @description("Blocks call_tool when detected_threats contains \"prompt_injection\".")
35
- @severity("critical")
36
- @tags("category:semantic,threat:injection,detection:rule,surface:call-tool,owasp:llm01,mitre:atlas-t0051,posture:baseline")
37
- @reject_message("Tool execution blocked: prompt injection patterns detected (OWASP LLM01).")
38
- forbid (
39
- principal,
40
- action == AIGateway::Action::"call_tool",
41
- resource
42
- )
43
- when {
44
- context has detected_threats && context.detected_threats.contains("prompt_injection")
45
- };
46
-
47
31
  @id("semantic.block-injection-ml")
48
32
  @name("Block injection (ML)")
49
33
  @description("Blocks call_tool when injection_score >= 75.")
@@ -63,21 +47,6 @@ when {
63
47
  // Section 2: Jailbreak
64
48
  // ---------------------------------------------------------------------------
65
49
 
66
- @id("semantic.block-jailbreak-rule")
67
- @name("Block jailbreak (rule)")
68
- @description("Blocks call_tool when detected_threats contains \"jailbreak\".")
69
- @severity("critical")
70
- @tags("category:semantic,threat:jailbreak,detection:rule,surface:call-tool,owasp:llm02,mitre:atlas-t0054,posture:baseline")
71
- @reject_message("Tool execution blocked: jailbreak patterns detected (OWASP LLM02).")
72
- forbid (
73
- principal,
74
- action == AIGateway::Action::"call_tool",
75
- resource
76
- )
77
- when {
78
- context has detected_threats && context.detected_threats.contains("jailbreak")
79
- };
80
-
81
50
  @id("semantic.block-jailbreak-ml")
82
51
  @name("Block jailbreak (ML)")
83
52
  @description("Blocks call_tool when jailbreak_score >= 75.")
@@ -92,37 +61,3 @@ forbid (
92
61
  when {
93
62
  context has jailbreak_score && context.jailbreak_score >= 75
94
63
  };
95
-
96
- // ---------------------------------------------------------------------------
97
- // Section 3: Severity aggregation
98
- // ---------------------------------------------------------------------------
99
-
100
- @id("semantic.block-critical")
101
- @name("Block critical threats")
102
- @description("Blocks all MCP operations when highest_severity equals \"critical\".")
103
- @severity("critical")
104
- @tags("category:semantic,detection:aggregate,posture:catch-all")
105
- @reject_message("MCP operation blocked: a critical-severity threat was detected.")
106
- forbid (
107
- principal,
108
- action,
109
- resource
110
- )
111
- when {
112
- context has highest_severity && context.highest_severity == "critical"
113
- };
114
-
115
- @id("semantic.block-multi-threat")
116
- @name("Block multi-threat tool calls")
117
- @description("Blocks call_tool when threat_count >= 3.")
118
- @severity("high")
119
- @tags("category:semantic,detection:aggregate,surface:call-tool,posture:catch-all")
120
- @reject_message("Tool execution blocked: multiple concurrent security threats were detected.")
121
- forbid (
122
- principal,
123
- action == AIGateway::Action::"call_tool",
124
- resource
125
- )
126
- when {
127
- context has threat_count && context.threat_count >= 3
128
- };
@@ -1,20 +1,15 @@
1
1
  // =============================================================================
2
2
  // Tool Permissioning (Default)
3
3
  // =============================================================================
4
- // Blocks MCP tool calls based on risk scoring, threat detection, and tool
5
- // classification.
4
+ // Blocks MCP tool calls based on risk scoring and tool classification.
6
5
  //
7
6
  // Detection layers:
8
7
  // - Computed risk score (tool_risk_score)
9
8
  // - Detector category labels (tool_category, tool_is_sensitive)
10
- // - Threat aggregation (threat_count, max_threat_severity)
11
9
  //
12
10
  // Context keys consumed:
13
11
  // - tool_risk_score: Long (0-100)
14
12
  // - tool_category: String
15
- // - tool_is_sensitive: Bool
16
- // - threat_count: Long
17
- // - max_threat_severity: Long (0-4)
18
13
  //
19
14
  // Compliance:
20
15
  // - OWASP LLM06, OWASP ASI02
@@ -53,38 +48,12 @@ when {
53
48
  context has tool_category && context.tool_category == "dangerous"
54
49
  };
55
50
 
56
- @id("tools.block-sensitive-with-threats")
57
- @name("Block sensitive tools with threats")
58
- @description("Blocks call_tool when tool_is_sensitive is true and threat_count >= 1.")
59
- @severity("high")
60
- @tags("category:tools,detection:aggregate,surface:call-tool,owasp:llm06")
61
- @reject_message("Tool execution blocked: a sensitive tool was called while threats were detected.")
62
- forbid (
63
- principal,
64
- action == AIGateway::Action::"call_tool",
65
- resource
66
- )
67
- when {
68
- context has tool_is_sensitive && context.tool_is_sensitive == true &&
69
- context has threat_count && context.threat_count >= 1
70
- };
71
-
72
- @id("tools.block-high-severity")
73
- @name("Block high-severity tool calls")
74
- @description("Blocks call_tool when threat_count >= 1 and max_threat_severity >= 3.")
75
- @severity("high")
76
- @tags("category:tools,detection:aggregate,surface:call-tool")
77
- @reject_message("Tool execution blocked: high or critical severity threats were detected.")
78
- forbid (
79
- principal,
80
- action == AIGateway::Action::"call_tool",
81
- resource
82
- )
83
- when {
84
- context has threat_count && context has max_threat_severity &&
85
- context.threat_count >= 1 && context.max_threat_severity >= 3
86
- };
87
-
88
51
  // The command-injection rule was removed while that detector is disabled, so
89
52
  // this template cannot instantiate a rule that can never fire. See
90
53
  // highflame-shield#386; restore it when the detector is re-enabled.
54
+
55
+ // The threat_count / max_threat_severity aggregate rules
56
+ // (tools.block-sensitive-with-threats, tools.block-high-severity) were removed
57
+ // for the same reason: AIGateway does not run threat aggregation, so its
58
+ // projected context never contains those keys and the rules could never fire
59
+ // (highflame-shield#429). Restore them only if the product gains aggregation.
@@ -17,13 +17,13 @@
17
17
 
18
18
  @id("data-protection.block-secrets")
19
19
  @name("Block secrets in prompts")
20
- @description("Blocks process_prompt when secrets_detected is true.")
20
+ @description("Blocks process_prompt and process_response when secrets_detected is true.")
21
21
  @severity("critical")
22
- @tags("category:data-protection,threat:secrets,detection:rule,surface:process-prompt,owasp:llm06")
22
+ @tags("category:data-protection,threat:secrets,detection:rule,surface:process-prompt,surface:process-response,owasp:llm06")
23
23
  @reject_message("Prompt blocked: secrets or credentials were detected — remove sensitive data and retry.")
24
24
  forbid (
25
25
  principal,
26
- action == AIGateway::Action::"process_prompt",
26
+ action in [AIGateway::Action::"process_prompt", AIGateway::Action::"process_response"],
27
27
  resource
28
28
  )
29
29
  when {