@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.
Files changed (82) hide show
  1. package/_schemas/agent_ops/context.json +792 -0
  2. package/_schemas/agent_ops/schema.cedarschema +127 -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 +278 -0
  27. package/_schemas/ai_gateway/schema.cedarschema +37 -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 +671 -0
  36. package/_schemas/guardrails/schema.cedarschema +23 -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/dist/agent_ops-defaults.gen.js +177 -120
  57. package/dist/agent_ops-entities.gen.js +5 -1
  58. package/dist/ai_gateway-defaults.gen.js +90 -164
  59. package/dist/ai_gateway-entities.gen.js +6 -2
  60. package/dist/engine.d.ts +10 -0
  61. package/dist/engine.js +25 -1
  62. package/dist/guardrails-defaults.gen.js +144 -145
  63. package/dist/guardrails-entities.gen.js +5 -1
  64. package/dist/service-schemas.gen.d.ts +3 -3
  65. package/dist/service-schemas.gen.js +480 -118
  66. package/package.json +1 -1
  67. package/_schemas/guardrails/templates/profiles/advanced_detection/threat_severity.cedar +0 -30
  68. package/_schemas/mcp_gateway/context.json +0 -655
  69. package/_schemas/mcp_gateway/schema.cedarschema +0 -342
  70. package/_schemas/mcp_gateway/templates/defaults/agent_security.cedar +0 -140
  71. package/_schemas/mcp_gateway/templates/defaults/baseline.cedar +0 -23
  72. package/_schemas/mcp_gateway/templates/defaults/semantic.cedar +0 -105
  73. package/_schemas/mcp_gateway/templates/defaults/tools.cedar +0 -92
  74. package/_schemas/mcp_gateway/templates/mcp_server_allowlist.cedar +0 -33
  75. package/_schemas/mcp_gateway/templates/mcp_tool_permissions.cedar +0 -77
  76. package/_schemas/mcp_gateway/templates/templates.json +0 -89
  77. package/dist/mcp_gateway-context.gen.d.ts +0 -51
  78. package/dist/mcp_gateway-context.gen.js +0 -52
  79. package/dist/mcp_gateway-defaults.gen.d.ts +0 -61
  80. package/dist/mcp_gateway-defaults.gen.js +0 -668
  81. package/dist/mcp_gateway-entities.gen.d.ts +0 -11
  82. package/dist/mcp_gateway-entities.gen.js +0 -37
@@ -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 {