@highflame/policy 2.2.31 → 2.2.32

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 (58) hide show
  1. package/_schemas/agent_ops/context.json +1272 -439
  2. package/_schemas/agent_ops/schema.cedarschema +24 -0
  3. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_cross_origin.cedar +92 -0
  4. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_escalation.cedar +99 -0
  5. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_identity_enforcement.cedar +101 -0
  6. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_a2a_inter_agent_injection.cedar +120 -0
  7. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_claude_block_injection.cedar +30 -0
  8. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_defaults.cedar +122 -0
  9. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_multi_agent_safety.cedar +164 -0
  10. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_multi_agent_trust.cedar +143 -0
  11. package/_schemas/agent_ops/templates/ported/agent-security/agent_security_data_pipeline.cedar +45 -0
  12. package/_schemas/agent_ops/templates/ported/agent-security/agent_security_defaults.cedar +164 -0
  13. package/_schemas/agent_ops/templates/ported/agent-security/agent_security_malicious_package.cedar +59 -0
  14. package/_schemas/agent_ops/templates/ported/agent-security/agent_security_param_validation.cedar +119 -0
  15. package/_schemas/agent_ops/templates/ported/agent-security/agent_security_tool_risk.cedar +66 -0
  16. package/_schemas/agent_ops/templates/ported/code-security/agent_identity_a2a_supply_chain.cedar +101 -0
  17. package/_schemas/agent_ops/templates/ported/code-security/agent_security_code_agent.cedar +130 -0
  18. package/_schemas/agent_ops/templates/ported/code-security/agent_security_code_agent_supply_chain.cedar +116 -0
  19. package/_schemas/agent_ops/templates/ported/code-security/security_code_agent_encoding.cedar +51 -0
  20. package/_schemas/agent_ops/templates/ported/code-security/security_code_agent_path_security.cedar +149 -0
  21. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_chat_assistant.cedar +58 -0
  22. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_defaults.cedar +111 -0
  23. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_semantic.cedar +78 -0
  24. package/_schemas/agent_ops/templates/ported/content-safety/trust_safety_toxicity.cedar +71 -0
  25. package/_schemas/agent_ops/templates/ported/data-protection/data_protection_advanced_secrets.cedar +74 -0
  26. package/_schemas/agent_ops/templates/ported/data-protection/data_protection_code_block_write_secrets.cedar +26 -0
  27. package/_schemas/agent_ops/templates/ported/data-protection/data_protection_data_pipeline.cedar +52 -0
  28. package/_schemas/agent_ops/templates/ported/data-protection/data_protection_defaults.cedar +57 -0
  29. package/_schemas/agent_ops/templates/ported/data-protection/privacy_advanced_pii.cedar +465 -0
  30. package/_schemas/agent_ops/templates/ported/data-protection/privacy_defaults.cedar +164 -0
  31. package/_schemas/agent_ops/templates/ported/data-protection/privacy_pii_model.cedar +90 -0
  32. package/_schemas/agent_ops/templates/ported/organization/organization_deny_baseline.cedar +22 -0
  33. package/_schemas/agent_ops/templates/ported/organization/organization_team_permissions.cedar +38 -0
  34. package/_schemas/agent_ops/templates/ported/threat-detection/security_advanced_block_critical_severity.cedar +30 -0
  35. package/_schemas/agent_ops/templates/ported/threat-detection/security_chat_assistant.cedar +47 -0
  36. package/_schemas/agent_ops/templates/ported/threat-detection/security_data_pipeline_block_injection.cedar +31 -0
  37. package/_schemas/agent_ops/templates/ported/threat-detection/security_injection.cedar +82 -0
  38. package/_schemas/agent_ops/templates/ported/threat-detection/security_patterns.cedar +72 -0
  39. package/_schemas/agent_ops/templates/ported/threat-detection/semantic_defaults.cedar +155 -0
  40. package/_schemas/agent_ops/templates/ported/tool-permissioning/tools_bash_operation_classes.cedar +142 -0
  41. package/_schemas/agent_ops/templates/ported/tool-permissioning/tools_block_shell.cedar +40 -0
  42. package/_schemas/agent_ops/templates/ported/tool-permissioning/tools_defaults.cedar +76 -0
  43. package/_schemas/agent_ops/templates/ported/tool-permissioning/tools_mcp_server_allowlist.cedar +41 -0
  44. package/_schemas/agent_ops/templates/ported/tool-permissioning/tools_mcp_tool_permissions.cedar +103 -0
  45. package/_schemas/agent_ops/templates/templates.json +752 -8
  46. package/_schemas/ai_gateway/context.json +2 -2
  47. package/_schemas/guardrails/context.json +2 -2
  48. package/_schemas/guardrails/templates/templates.json +6 -1
  49. package/_schemas/overwatch/context.json +3 -3
  50. package/dist/aarm-annotations.gen.js +1 -1
  51. package/dist/agent_ops-context.gen.d.ts +5 -1
  52. package/dist/agent_ops-context.gen.js +8 -0
  53. package/dist/agent_ops-defaults.gen.js +5168 -8
  54. package/dist/guardrails-defaults.gen.js +6 -1
  55. package/dist/overwatch-defaults.gen.js +109 -0
  56. package/dist/service-schemas.gen.d.ts +1 -1
  57. package/dist/service-schemas.gen.js +48 -12
  58. package/package.json +1 -1
@@ -0,0 +1,164 @@
1
+ // =============================================================================
2
+ // Multi-Agent Orchestration — Cross-Turn Agent Safety
3
+ // =============================================================================
4
+ // Session-aware policies that combine cross-turn detection history with
5
+ // agent identity for defense-in-depth. When one agent in a multi-agent
6
+ // session detects a threat, subsequent agents in the same session are
7
+ // restricted accordingly.
8
+ //
9
+ // Context keys consumed:
10
+ // - agent_trust_level, agent_type, tool_name, tool_is_sensitive
11
+ // - session_pii_detected, session_pii_types
12
+ // - session_secrets_detected, session_injection_detected
13
+ // - session_command_injection
14
+ // - session_threat_turns: Long
15
+ // - session_cumulative_risk_score: Long
16
+ // - suspicious_pattern: Bool
17
+ //
18
+ // Compliance:
19
+ // - OWASP LLM01, LLM08
20
+ //
21
+ // Category: agent-identity
22
+ // Namespace: AgentOps
23
+ // =============================================================================
24
+
25
+ // ---------------------------------------------------------------------------
26
+ // Section 1: PII containment
27
+ // ---------------------------------------------------------------------------
28
+
29
+ @id("agent-identity.multi-agent-pii-block-network-tools")
30
+ @name("Block network tools for non-first-party agents after PII")
31
+ @description("Blocks call_tool when agent_trust_level is not \"first_party\", session_pii_detected is true, and tool_name is a network tool.")
32
+ @severity("critical")
33
+ @tags("category:agent-identity,threat:exfiltration,scope:per-agent,detection:aggregate,surface:call-tool")
34
+ @reject_message("Tool execution blocked: PII was detected earlier in this session and non-first-party agents cannot use network tools afterwards.")
35
+ forbid (
36
+ principal is AgentOps::Agent,
37
+ action == AgentOps::Action::"call_tool",
38
+ resource
39
+ )
40
+ when {
41
+ context has agent_trust_level && context.agent_trust_level != "first_party" &&
42
+ context has session_pii_detected && context.session_pii_detected == true &&
43
+ context has tool_name &&
44
+ (
45
+ context.tool_name == "http_post" ||
46
+ context.tool_name == "send_email" ||
47
+ context.tool_name == "http_request" ||
48
+ context.tool_name == "webhook"
49
+ )
50
+ };
51
+
52
+ @id("agent-identity.multi-agent-pii-block-unverified-write")
53
+ @name("Block unverified agents from writing files after PII")
54
+ @description("Blocks write_file when agent_trust_level is \"unverified\" and session_pii_detected is true.")
55
+ @severity("high")
56
+ @tags("category:agent-identity,threat:pii,scope:per-agent,detection:aggregate,surface:write-file")
57
+ @reject_message("File write blocked: PII was detected earlier in this session and unverified agents cannot persist files.")
58
+ forbid (
59
+ principal is AgentOps::Agent,
60
+ action == AgentOps::Action::"write_file",
61
+ resource
62
+ )
63
+ when {
64
+ context has agent_trust_level && context.agent_trust_level == "unverified" &&
65
+ context has session_pii_detected && context.session_pii_detected == true
66
+ };
67
+
68
+ // ---------------------------------------------------------------------------
69
+ // Section 2: Secrets containment
70
+ // ---------------------------------------------------------------------------
71
+
72
+ @id("agent-identity.multi-agent-secrets-lockdown")
73
+ @name("Block sensitive tools after secrets in session")
74
+ @description("Blocks call_tool when agent_trust_level is not \"first_party\", session_secrets_detected is true, and tool_is_sensitive is true.")
75
+ @severity("critical")
76
+ @tags("category:agent-identity,threat:secrets,scope:per-agent,detection:aggregate,surface:call-tool")
77
+ @reject_message("Tool execution blocked: secrets were detected earlier in this session and non-first-party agents cannot call sensitive tools afterwards.")
78
+ forbid (
79
+ principal is AgentOps::Agent,
80
+ action == AgentOps::Action::"call_tool",
81
+ resource
82
+ )
83
+ when {
84
+ context has agent_trust_level && context.agent_trust_level != "first_party" &&
85
+ context has session_secrets_detected && context.session_secrets_detected == true &&
86
+ context has tool_is_sensitive && context.tool_is_sensitive == true
87
+ };
88
+
89
+ // ---------------------------------------------------------------------------
90
+ // Section 3: Injection escalation
91
+ // ---------------------------------------------------------------------------
92
+
93
+ @id("agent-identity.multi-agent-post-injection-lockdown")
94
+ @name("Block unverified agents after injection in session")
95
+ @description("Blocks call_tool when agent_trust_level is \"unverified\" and session_injection_detected is true.")
96
+ @severity("critical")
97
+ @tags("category:agent-identity,threat:injection,scope:per-agent,detection:aggregate,surface:call-tool")
98
+ @reject_message("Tool execution blocked: injection was detected earlier in this session — unverified agents cannot continue.")
99
+ forbid (
100
+ principal is AgentOps::Agent,
101
+ action == AgentOps::Action::"call_tool",
102
+ resource
103
+ )
104
+ when {
105
+ context has agent_trust_level && context.agent_trust_level == "unverified" &&
106
+ context has session_injection_detected && context.session_injection_detected == true
107
+ };
108
+
109
+ @id("agent-identity.multi-agent-post-command-injection-shell")
110
+ @name("Block shell after command injection in session")
111
+ @description("Blocks call_tool when session_command_injection is true and tool_name is a shell tool.")
112
+ @severity("critical")
113
+ @tags("category:agent-identity,threat:command-injection,scope:per-agent,detection:aggregate,surface:call-tool,mitre:t1059")
114
+ @reject_message("Tool execution blocked: command injection was detected earlier in this session — no agent may execute shell commands afterwards.")
115
+ forbid (
116
+ principal is AgentOps::Agent,
117
+ action == AgentOps::Action::"call_tool",
118
+ resource
119
+ )
120
+ when {
121
+ context has session_command_injection && context.session_command_injection == true &&
122
+ context has tool_name &&
123
+ (context.tool_name == "shell" || context.tool_name == "execute_command" || context.tool_name == "bash")
124
+ };
125
+
126
+ // ---------------------------------------------------------------------------
127
+ // Section 4: Cumulative risk circuit breakers
128
+ // ---------------------------------------------------------------------------
129
+
130
+ @id("agent-identity.multi-agent-high-cumulative-risk")
131
+ @name("Block non-first-party sensitive tools at cumulative risk")
132
+ @description("Blocks call_tool when agent_trust_level is not \"first_party\", session_cumulative_risk_score >= 201, and tool_is_sensitive is true.")
133
+ @severity("high")
134
+ @tags("category:agent-identity,scope:per-agent,detection:aggregate,surface:call-tool,posture:catch-all")
135
+ @reject_message("Tool execution blocked: cumulative session risk exceeded the multi-agent threshold for sensitive tools.")
136
+ forbid (
137
+ principal is AgentOps::Agent,
138
+ action == AgentOps::Action::"call_tool",
139
+ resource
140
+ )
141
+ when {
142
+ context has agent_trust_level && context.agent_trust_level != "first_party" &&
143
+ context has session_cumulative_risk_score && context.session_cumulative_risk_score >= 201 &&
144
+ context has tool_is_sensitive && context.tool_is_sensitive == true
145
+ };
146
+
147
+ @id("agent-identity.multi-agent-extreme-risk-lockdown")
148
+ @name("Block unverified agents at extreme cumulative risk")
149
+ @description("Blocks call_tool when agent_trust_level is \"unverified\" and session_cumulative_risk_score >= 501 or session_threat_turns >= 6.")
150
+ @severity("critical")
151
+ @tags("category:agent-identity,scope:per-agent,detection:aggregate,surface:call-tool,posture:catch-all")
152
+ @reject_message("Tool execution blocked: this session has accumulated extreme risk — unverified agents are locked out.")
153
+ forbid (
154
+ principal is AgentOps::Agent,
155
+ action == AgentOps::Action::"call_tool",
156
+ resource
157
+ )
158
+ when {
159
+ context has agent_trust_level && context.agent_trust_level == "unverified" &&
160
+ (
161
+ (context has session_cumulative_risk_score && context.session_cumulative_risk_score >= 501) ||
162
+ (context has session_threat_turns && context.session_threat_turns >= 6)
163
+ )
164
+ };
@@ -0,0 +1,143 @@
1
+ // =============================================================================
2
+ // Multi-Agent Orchestration — Agent Trust
3
+ // =============================================================================
4
+ // Production-grade trust policies for multi-agent systems where an
5
+ // orchestrator coordinates sub-agents with varying trust levels. Enforces
6
+ // least-privilege access: each agent gets only the permissions its trust
7
+ // level and type warrant.
8
+ //
9
+ // Context keys consumed:
10
+ // - agent_id, agent_type, agent_trust_level, agent_framework, agent_publisher
11
+ // - tool_name, tool_category, tool_is_sensitive, tool_risk_score
12
+ // - mcp_server_verified
13
+ // - injection_score, jailbreak_score
14
+ //
15
+ // Compliance:
16
+ // - OWASP LLM01, LLM08; OWASP ASI03, ASI05
17
+ //
18
+ // Category: agent-identity
19
+ // Namespace: AgentOps
20
+ // =============================================================================
21
+
22
+ // ---------------------------------------------------------------------------
23
+ // Section 1: Tiered tool access
24
+ // ---------------------------------------------------------------------------
25
+
26
+ @id("agent-identity.multi-agent-block-non-first-party-dangerous")
27
+ @name("Block non-first-party agents from dangerous tools")
28
+ @description("Blocks call_tool when agent_trust_level is not \"first_party\" and tool_category is \"dangerous\".")
29
+ @severity("critical")
30
+ @tags("category:agent-identity,scope:per-agent,detection:rule,surface:call-tool")
31
+ @reject_message("Tool execution blocked: dangerous tools are restricted to first-party agents.")
32
+ forbid (
33
+ principal is AgentOps::Agent,
34
+ action == AgentOps::Action::"call_tool",
35
+ resource
36
+ )
37
+ when {
38
+ context has agent_trust_level && context.agent_trust_level != "first_party" &&
39
+ context has tool_category && context.tool_category == "dangerous"
40
+ };
41
+
42
+ @id("agent-identity.multi-agent-block-unverified-sensitive")
43
+ @name("Block unverified agents from sensitive tools")
44
+ @description("Blocks call_tool when agent_trust_level is \"unverified\" and tool_is_sensitive is true.")
45
+ @severity("high")
46
+ @tags("category:agent-identity,scope:per-agent,detection:rule,surface:call-tool")
47
+ @reject_message("Tool execution blocked: unverified agents may only use tools classified as safe.")
48
+ forbid (
49
+ principal is AgentOps::Agent,
50
+ action == AgentOps::Action::"call_tool",
51
+ resource
52
+ )
53
+ when {
54
+ context has agent_trust_level && context.agent_trust_level == "unverified" &&
55
+ context has tool_is_sensitive && context.tool_is_sensitive == true
56
+ };
57
+
58
+ @id("agent-identity.multi-agent-block-unverified-mcp")
59
+ @name("Block unverified agents on unverified MCP servers")
60
+ @description("Blocks call_tool when agent_trust_level is \"unverified\" and mcp_server_verified is false.")
61
+ @severity("critical")
62
+ @tags("category:agent-identity,threat:supply-chain,scope:per-agent,detection:rule,surface:call-tool")
63
+ @reject_message("Tool execution blocked: unverified agents cannot use unverified MCP servers — supply-chain risk too high.")
64
+ forbid (
65
+ principal is AgentOps::Agent,
66
+ action == AgentOps::Action::"call_tool",
67
+ resource
68
+ )
69
+ when {
70
+ context has agent_trust_level && context.agent_trust_level == "unverified" &&
71
+ context has mcp_server_verified && context.mcp_server_verified == false
72
+ };
73
+
74
+ // ---------------------------------------------------------------------------
75
+ // Section 2: Autonomous-agent safeguards
76
+ // ---------------------------------------------------------------------------
77
+
78
+ @id("agent-identity.multi-agent-cap-autonomous-tool-risk")
79
+ @name("Block high-risk tools for autonomous agents")
80
+ @description("Blocks call_tool when agent_type is \"autonomous\" and tool_risk_score >= 71.")
81
+ @severity("high")
82
+ @tags("category:agent-identity,scope:per-agent,detection:aggregate,surface:call-tool")
83
+ @reject_message("Tool execution blocked: autonomous agents require human oversight for high-risk tools.")
84
+ forbid (
85
+ principal is AgentOps::Agent,
86
+ action == AgentOps::Action::"call_tool",
87
+ resource
88
+ )
89
+ when {
90
+ context has agent_type && context.agent_type == "autonomous" &&
91
+ context has tool_risk_score && context.tool_risk_score >= 71
92
+ };
93
+
94
+ @id("agent-identity.multi-agent-autonomous-injection")
95
+ @name("Block injection on autonomous agents (stricter)")
96
+ @description("Blocks process_prompt when agent_type is \"autonomous\" and injection_score >= 51.")
97
+ @severity("high")
98
+ @tags("category:agent-identity,threat:injection,detection:ml,surface:process-prompt,owasp:llm01")
99
+ @reject_message("Prompt blocked: lower injection threshold applies to autonomous agents and was exceeded.")
100
+ forbid (
101
+ principal is AgentOps::Agent,
102
+ action == AgentOps::Action::"process_prompt",
103
+ resource
104
+ )
105
+ when {
106
+ context has agent_type && context.agent_type == "autonomous" &&
107
+ context has injection_score && context.injection_score >= 51
108
+ };
109
+
110
+ @id("agent-identity.multi-agent-autonomous-jailbreak")
111
+ @name("Block jailbreak on autonomous agents (stricter)")
112
+ @description("Blocks process_prompt when agent_type is \"autonomous\" and jailbreak_score >= 51.")
113
+ @severity("high")
114
+ @tags("category:agent-identity,threat:jailbreak,detection:ml,surface:process-prompt,owasp:llm02")
115
+ @reject_message("Prompt blocked: lower jailbreak threshold applies to autonomous agents and was exceeded.")
116
+ forbid (
117
+ principal is AgentOps::Agent,
118
+ action == AgentOps::Action::"process_prompt",
119
+ resource
120
+ )
121
+ when {
122
+ context has agent_type && context.agent_type == "autonomous" &&
123
+ context has jailbreak_score && context.jailbreak_score >= 51
124
+ };
125
+
126
+ // ---------------------------------------------------------------------------
127
+ // Section 3: MCP server-connection trust
128
+ // ---------------------------------------------------------------------------
129
+
130
+ @id("agent-identity.multi-agent-block-unverified-server-connect")
131
+ @name("Block unverified agents from connecting to MCP servers")
132
+ @description("Blocks connect_server when agent_trust_level is \"unverified\".")
133
+ @severity("high")
134
+ @tags("category:agent-identity,threat:supply-chain,scope:per-agent,detection:rule,surface:connect-server")
135
+ @reject_message("MCP server connection blocked: unverified agents cannot establish new server connections.")
136
+ forbid (
137
+ principal is AgentOps::Agent,
138
+ action == AgentOps::Action::"connect_server",
139
+ resource
140
+ )
141
+ when {
142
+ context has agent_trust_level && context.agent_trust_level == "unverified"
143
+ };
@@ -0,0 +1,45 @@
1
+ // =============================================================================
2
+ // Data Pipeline — Agentic Security
3
+ // =============================================================================
4
+ // Exfiltration prevention and tool risk controls for data pipelines.
5
+ //
6
+ // Context keys consumed:
7
+ // - suspicious_pattern: Bool
8
+ // - pattern_type: String
9
+ // - tool_risk_score: Long (0-100)
10
+ //
11
+ // Category: agent-security
12
+ // Namespace: AgentOps
13
+ // =============================================================================
14
+
15
+ @id("agent-security.data-pipeline-block-exfiltration")
16
+ @name("Block data exfiltration (data-pipeline profile)")
17
+ @description("Blocks call_tool when suspicious_pattern is true and pattern_type matches an exfiltration class.")
18
+ @severity("critical")
19
+ @tags("category:agent-security,threat:exfiltration,detection:rule,surface:call-tool")
20
+ @reject_message("Tool execution blocked: data exfiltration pattern detected in a data pipeline.")
21
+ forbid (
22
+ principal,
23
+ action == AgentOps::Action::"call_tool",
24
+ resource
25
+ )
26
+ when {
27
+ context has suspicious_pattern && context.suspicious_pattern == true &&
28
+ context has pattern_type &&
29
+ (context.pattern_type == "data_exfiltration" || context.pattern_type == "db_exfiltration")
30
+ };
31
+
32
+ @id("agent-security.data-pipeline-block-high-risk-tools")
33
+ @name("Block high-risk tools (data-pipeline profile)")
34
+ @description("Blocks call_tool when tool_risk_score >= 61.")
35
+ @severity("high")
36
+ @tags("category:agent-security,detection:aggregate,surface:call-tool,owasp:llm06")
37
+ @reject_message("Tool execution blocked: elevated tool risk in a data pipeline.")
38
+ forbid (
39
+ principal,
40
+ action == AgentOps::Action::"call_tool",
41
+ resource
42
+ )
43
+ when {
44
+ context has tool_risk_score && context.tool_risk_score >= 61
45
+ };
@@ -0,0 +1,164 @@
1
+ // =============================================================================
2
+ // Agentic Safety (Default)
3
+ // =============================================================================
4
+ // Blocks suspicious agentic behaviour patterns: tool-call loops, data
5
+ // exfiltration sequences, budget overruns, plus MCP supply-chain risks
6
+ // (tool poisoning, rug pull, risky MCP configs).
7
+ //
8
+ // Context keys consumed:
9
+ // - loop_detected: Bool
10
+ // - loop_count: Long
11
+ // - suspicious_pattern: Bool
12
+ // - pattern_type: String
13
+ // - sequence_risk: Long (0-100)
14
+ // - budget_exceeded: Bool
15
+ // - budget_remaining_pct: Long (0-100)
16
+ // - tool_poisoning_score: Long (0-100)
17
+ // - rug_pull_detected: Bool
18
+ // - rug_pull_score: Long (0-100)
19
+ // - mcp_config_risk: Bool
20
+ // - mcp_risk_score: Long (0-100)
21
+ //
22
+ // Compliance:
23
+ // - OWASP LLM06, OWASP ASI01, OWASP ASI04
24
+ //
25
+ // Category: agent-security
26
+ // Namespace: AgentOps
27
+ // =============================================================================
28
+
29
+ // ---------------------------------------------------------------------------
30
+ // Section 1: Loops, exfiltration, budget
31
+ // ---------------------------------------------------------------------------
32
+
33
+ @id("agent-security.block-loops")
34
+ @name("Block tool call loops")
35
+ @description("Blocks call_tool when loop_detected is true and loop_count >= 4.")
36
+ @severity("high")
37
+ @tags("category:agent-security,threat:loop,detection:aggregate,surface:call-tool")
38
+ @reject_message("Tool execution blocked: an infinite tool-call loop was detected.")
39
+ forbid (
40
+ principal,
41
+ action == AgentOps::Action::"call_tool",
42
+ resource
43
+ )
44
+ when {
45
+ context has loop_detected && context.loop_detected == true &&
46
+ context has loop_count && context.loop_count >= 4
47
+ };
48
+
49
+ @id("agent-security.block-exfiltration")
50
+ @name("Block data exfiltration patterns")
51
+ @description("Blocks call_tool when suspicious_pattern is true and pattern_type matches an exfiltration class.")
52
+ @severity("critical")
53
+ @tags("category:agent-security,threat:exfiltration,detection:rule,surface:call-tool")
54
+ @reject_message("Tool execution blocked: suspicious action sequence consistent with data exfiltration.")
55
+ forbid (
56
+ principal,
57
+ action == AgentOps::Action::"call_tool",
58
+ resource
59
+ )
60
+ when {
61
+ context has suspicious_pattern && context.suspicious_pattern == true &&
62
+ context has pattern_type &&
63
+ (
64
+ context.pattern_type == "data_exfiltration" ||
65
+ context.pattern_type == "secret_exfiltration" ||
66
+ context.pattern_type == "db_exfiltration"
67
+ )
68
+ };
69
+
70
+ @id("agent-security.block-sequence-risk")
71
+ @name("Block high-risk action sequences")
72
+ @description("Blocks call_tool when sequence_risk >= 81.")
73
+ @severity("high")
74
+ @tags("category:agent-security,detection:aggregate,surface:call-tool")
75
+ @reject_message("Tool execution blocked: action sequence scored a high cumulative risk.")
76
+ forbid (
77
+ principal,
78
+ action == AgentOps::Action::"call_tool",
79
+ resource
80
+ )
81
+ when {
82
+ context has sequence_risk && context.sequence_risk >= 81
83
+ };
84
+
85
+ @id("agent-security.block-budget-exceeded")
86
+ @name("Block on budget exceeded")
87
+ @description("Blocks call_tool when budget_exceeded is true.")
88
+ @severity("medium")
89
+ @tags("category:agent-security,threat:budget-violation,detection:rule,surface:call-tool")
90
+ @reject_message("Tool execution blocked: the agent has exhausted its token or cost budget.")
91
+ forbid (
92
+ principal,
93
+ action == AgentOps::Action::"call_tool",
94
+ resource
95
+ )
96
+ when {
97
+ context has budget_exceeded && context.budget_exceeded == true
98
+ };
99
+
100
+ @id("agent-security.block-budget-low")
101
+ @name("Block when budget critically low")
102
+ @description("Blocks call_tool when budget_remaining_pct <= 4.")
103
+ @severity("medium")
104
+ @tags("category:agent-security,threat:budget-violation,detection:rule,surface:call-tool")
105
+ @reject_message("Tool execution blocked: remaining budget is below the critical threshold.")
106
+ forbid (
107
+ principal,
108
+ action == AgentOps::Action::"call_tool",
109
+ resource
110
+ )
111
+ when {
112
+ context has budget_remaining_pct && context.budget_remaining_pct <= 4
113
+ };
114
+
115
+ // ---------------------------------------------------------------------------
116
+ // Section 2: MCP supply chain
117
+ // ---------------------------------------------------------------------------
118
+
119
+ @id("agent-security.block-tool-poisoning")
120
+ @name("Block tool poisoning")
121
+ @description("Blocks call_tool and connect_server when tool_poisoning_score >= 70.")
122
+ @severity("critical")
123
+ @tags("category:agent-security,threat:tool-poisoning,detection:ml,owasp:asi01")
124
+ @reject_message("Tool execution blocked: hidden manipulation instructions detected in tool description or arguments (OWASP ASI01).")
125
+ forbid (
126
+ principal,
127
+ action in [AgentOps::Action::"call_tool", AgentOps::Action::"connect_server"],
128
+ resource
129
+ )
130
+ when {
131
+ context has tool_poisoning_score && context.tool_poisoning_score >= 70
132
+ };
133
+
134
+ @id("agent-security.block-rug-pull")
135
+ @name("Block rug pull attacks")
136
+ @description("Blocks call_tool when rug_pull_detected is true and rug_pull_score >= 70.")
137
+ @severity("high")
138
+ @tags("category:agent-security,threat:rug-pull,detection:ml,owasp:asi04")
139
+ @reject_message("Tool execution blocked: tool behavior has drifted significantly from its established pattern.")
140
+ forbid (
141
+ principal,
142
+ action == AgentOps::Action::"call_tool",
143
+ resource
144
+ )
145
+ when {
146
+ context has rug_pull_detected && context.rug_pull_detected == true &&
147
+ context has rug_pull_score && context.rug_pull_score >= 70
148
+ };
149
+
150
+ @id("agent-security.block-mcp-config-risk")
151
+ @name("Block risky MCP server configs")
152
+ @description("Blocks call_tool and connect_server when mcp_config_risk is true and mcp_risk_score >= 70.")
153
+ @severity("high")
154
+ @tags("category:agent-security,threat:mcp-config-risk,detection:ml,owasp:asi04")
155
+ @reject_message("MCP operation blocked: risky server configuration detected.")
156
+ forbid (
157
+ principal,
158
+ action in [AgentOps::Action::"call_tool", AgentOps::Action::"connect_server"],
159
+ resource
160
+ )
161
+ when {
162
+ context has mcp_config_risk && context.mcp_config_risk == true &&
163
+ context has mcp_risk_score && context.mcp_risk_score >= 70
164
+ };
@@ -0,0 +1,59 @@
1
+ // =============================================================================
2
+ // Malicious Package (Default)
3
+ // =============================================================================
4
+ // Blocks tool calls that install or download packages flagged as malicious
5
+ // by the osv.dev database (OpenSSF MAL- advisories). The malicious_package
6
+ // detector (Shield, Tier Slow) parses package-manager invocations (pip, npm,
7
+ // yarn, pnpm, bun, uv, gem, cargo, go, composer) out of tool-call arguments
8
+ // and checks each referenced package against the OSV batch API.
9
+ //
10
+ // Context keys consumed:
11
+ // - malicious_package_detected: Bool
12
+ // - package_install_detected: Bool
13
+ // - package_check_status: String ("" | "degraded")
14
+ //
15
+ // Compliance:
16
+ // - OWASP LLM03 (Supply Chain), OWASP ASI02
17
+ //
18
+ // Category: agent-security
19
+ // Namespace: AgentOps
20
+ // =============================================================================
21
+
22
+ @id("agent-security.block-malicious-package")
23
+ @name("Block malicious package installs")
24
+ @description("Blocks call_tool when a referenced package carries a known-malicious osv.dev (MAL-) advisory.")
25
+ @severity("critical")
26
+ @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:call-tool,owasp:llm03,owasp:asi02")
27
+ @reject_message("Package install blocked: the requested package is flagged as malicious in the osv.dev database.")
28
+ forbid (
29
+ principal,
30
+ action == AgentOps::Action::"call_tool",
31
+ resource
32
+ )
33
+ when {
34
+ context has malicious_package_detected &&
35
+ context.malicious_package_detected == true
36
+ };
37
+
38
+ // Alternative (fail-closed): the detector fails OPEN by design — when the
39
+ // OSV lookup is unavailable, installs proceed with package_check_status set
40
+ // to "degraded". Uncomment to block package installs whenever they cannot be
41
+ // verified, trading install availability for supply-chain certainty.
42
+ //
43
+ // @id("agent-security.block-unverified-package")
44
+ // @name("Block unverified package installs")
45
+ // @description("Blocks call_tool package installs when the malicious-package lookup is degraded.")
46
+ // @severity("medium")
47
+ // @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:call-tool,owasp:llm03")
48
+ // @reject_message("Package install blocked: the package could not be verified against the malicious-package database.")
49
+ // forbid (
50
+ // principal,
51
+ // action == AgentOps::Action::"call_tool",
52
+ // resource
53
+ // )
54
+ // when {
55
+ // context has package_install_detected &&
56
+ // context.package_install_detected == true &&
57
+ // context has package_check_status &&
58
+ // context.package_check_status == "degraded"
59
+ // };