@highflame/policy 2.2.25 → 2.2.27

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.
@@ -0,0 +1,41 @@
1
+ // =============================================================================
2
+ // MCP Server Allowlist
3
+ // =============================================================================
4
+ // Restricts MCP server connections to a pre-approved list. Customize the
5
+ // `context.mcp_server` values in the permit rule to match the allowed
6
+ // servers for your environment.
7
+ //
8
+ // Context keys consumed:
9
+ // - mcp_server: String
10
+ //
11
+ // Category: tools
12
+ // Namespace: Guardrails
13
+ // =============================================================================
14
+
15
+ @id("tools.allow-mcp-allowlist")
16
+ @name("Allow allowlisted MCP servers")
17
+ @description("Permits connect_server when mcp_server is in the allowlist.")
18
+ @severity("medium")
19
+ @tags("category:tools,surface:connect-server,scope:org-wide,posture:deny-default")
20
+ permit (
21
+ principal,
22
+ action == Guardrails::Action::"connect_server",
23
+ resource
24
+ )
25
+ when {
26
+ context has mcp_server &&
27
+ (context.mcp_server == "filesystem" ||
28
+ context.mcp_server == "playwright")
29
+ };
30
+
31
+ @id("tools.deny-non-allowlisted-mcp")
32
+ @name("Block non-allowlisted MCP servers")
33
+ @description("Blocks connect_server unconditionally so only the allowlist permit applies.")
34
+ @severity("medium")
35
+ @tags("category:tools,surface:connect-server,scope:org-wide,posture:deny-default")
36
+ @reject_message("MCP server connection blocked: server is not on the allowlist.")
37
+ forbid (
38
+ principal,
39
+ action == Guardrails::Action::"connect_server",
40
+ resource
41
+ );
@@ -231,6 +231,15 @@
231
231
  "severity": "critical",
232
232
  "tags": ["category:tools", "threat:supply-chain", "posture:deny-default"]
233
233
  },
234
+ {
235
+ "id": "tools.mcp-server-allowlist",
236
+ "name": "MCP Server Allowlist",
237
+ "description": "Restrict MCP server connections to a pre-approved list. Customize the allowlist values to match the servers permitted in your environment.",
238
+ "category": "tools",
239
+ "file": "mcp_server_allowlist.cedar",
240
+ "severity": "medium",
241
+ "tags": ["category:tools", "surface:connect-server", "scope:org-wide", "posture:deny-default"]
242
+ },
234
243
  {
235
244
  "id": "security.chat-assistant",
236
245
  "name": "Chat Assistant — Security",
@@ -233,6 +233,24 @@
233
233
  "required": true,
234
234
  "description": "Indirect prompt injection risk score (0-100) — injection via tool outputs or retrieved content"
235
235
  },
236
+ {
237
+ "key": "package_install_detected",
238
+ "type": "boolean",
239
+ "required": false,
240
+ "description": "True iff a package install/download command was recognized in the request content."
241
+ },
242
+ {
243
+ "key": "malicious_package_detected",
244
+ "type": "boolean",
245
+ "required": false,
246
+ "description": "True iff any referenced package has a known-malicious (MAL-) OSV advisory."
247
+ },
248
+ {
249
+ "key": "package_check_status",
250
+ "type": "string",
251
+ "required": false,
252
+ "description": "Set to 'degraded' when the osv.dev lookup failed (fail-open); empty otherwise."
253
+ },
236
254
  {
237
255
  "key": "session_pii_detected",
238
256
  "type": "boolean",
@@ -1184,6 +1184,48 @@ when {
1184
1184
  context has mcp_server_verified && context.mcp_server_verified == false
1185
1185
  };
1186
1186
  `;
1187
+ const GUARDRAILS_TOOLS_MCP_SERVER_ALLOWLIST_CEDAR = `// =============================================================================
1188
+ // MCP Server Allowlist
1189
+ // =============================================================================
1190
+ // Restricts MCP server connections to a pre-approved list. Customize the
1191
+ // \`context.mcp_server\` values in the permit rule to match the allowed
1192
+ // servers for your environment.
1193
+ //
1194
+ // Context keys consumed:
1195
+ // - mcp_server: String
1196
+ //
1197
+ // Category: tools
1198
+ // Namespace: Guardrails
1199
+ // =============================================================================
1200
+
1201
+ @id("tools.allow-mcp-allowlist")
1202
+ @name("Allow allowlisted MCP servers")
1203
+ @description("Permits connect_server when mcp_server is in the allowlist.")
1204
+ @severity("medium")
1205
+ @tags("category:tools,surface:connect-server,scope:org-wide,posture:deny-default")
1206
+ permit (
1207
+ principal,
1208
+ action == Guardrails::Action::"connect_server",
1209
+ resource
1210
+ )
1211
+ when {
1212
+ context has mcp_server &&
1213
+ (context.mcp_server == "filesystem" ||
1214
+ context.mcp_server == "playwright")
1215
+ };
1216
+
1217
+ @id("tools.deny-non-allowlisted-mcp")
1218
+ @name("Block non-allowlisted MCP servers")
1219
+ @description("Blocks connect_server unconditionally so only the allowlist permit applies.")
1220
+ @severity("medium")
1221
+ @tags("category:tools,surface:connect-server,scope:org-wide,posture:deny-default")
1222
+ @reject_message("MCP server connection blocked: server is not on the allowlist.")
1223
+ forbid (
1224
+ principal,
1225
+ action == Guardrails::Action::"connect_server",
1226
+ resource
1227
+ );
1228
+ `;
1187
1229
  const GUARDRAILS_SECURITY_CHAT_ASSISTANT_CEDAR = `// =============================================================================
1188
1230
  // Chat Assistant — Security
1189
1231
  // =============================================================================
@@ -3568,6 +3610,15 @@ export const GUARDRAILS_TEMPLATES = [
3568
3610
  severity: 'critical',
3569
3611
  tags: ['category:tools', 'threat:supply-chain', 'posture:deny-default'],
3570
3612
  },
3613
+ {
3614
+ id: 'tools.mcp-server-allowlist',
3615
+ name: 'MCP Server Allowlist',
3616
+ description: 'Restrict MCP server connections to a pre-approved list. Customize the allowlist values to match the servers permitted in your environment.',
3617
+ category: 'tools',
3618
+ cedarText: GUARDRAILS_TOOLS_MCP_SERVER_ALLOWLIST_CEDAR,
3619
+ severity: 'medium',
3620
+ tags: ['category:tools', 'surface:connect-server', 'scope:org-wide', 'posture:deny-default'],
3621
+ },
3571
3622
  {
3572
3623
  id: 'security.chat-assistant',
3573
3624
  name: 'Chat Assistant — Security',
@@ -3995,6 +4046,15 @@ export const GUARDRAILS_TEMPLATES_JSON = `{
3995
4046
  "severity": "critical",
3996
4047
  "tags": ["category:tools", "threat:supply-chain", "posture:deny-default"]
3997
4048
  },
4049
+ {
4050
+ "id": "tools.mcp-server-allowlist",
4051
+ "name": "MCP Server Allowlist",
4052
+ "description": "Restrict MCP server connections to a pre-approved list. Customize the allowlist values to match the servers permitted in your environment.",
4053
+ "category": "tools",
4054
+ "file": "mcp_server_allowlist.cedar",
4055
+ "severity": "medium",
4056
+ "tags": ["category:tools", "surface:connect-server", "scope:org-wide", "posture:deny-default"]
4057
+ },
3998
4058
  {
3999
4059
  "id": "security.chat-assistant",
4000
4060
  "name": "Chat Assistant — Security",
@@ -1654,8 +1654,8 @@ when {
1654
1654
  const OVERWATCH_AGENT_SECURITY_MALICIOUS_PACKAGE_CEDAR = `// =============================================================================
1655
1655
  // Malicious Package (Default)
1656
1656
  // =============================================================================
1657
- // Blocks tool calls that install or download packages flagged as malicious
1658
- // by the osv.dev database (OpenSSF MAL- advisories). The malicious_package
1657
+ // Blocks prompts and tool calls that install or download packages flagged as
1658
+ // malicious by the osv.dev database (OpenSSF MAL- advisories). The malicious_package
1659
1659
  // detector (Shield, Tier Slow) parses package-manager invocations (pip, npm,
1660
1660
  // yarn, pnpm, bun, uv, gem, cargo, go, composer) out of tool-call arguments
1661
1661
  // and checks each referenced package against the OSV batch API.
@@ -1678,13 +1678,13 @@ const OVERWATCH_AGENT_SECURITY_MALICIOUS_PACKAGE_CEDAR = `// ===================
1678
1678
 
1679
1679
  @id("agent-security.block-malicious-package")
1680
1680
  @name("Block malicious package installs")
1681
- @description("Blocks call_tool when a referenced package carries a known-malicious osv.dev (MAL-) advisory.")
1681
+ @description("Blocks process_prompt and call_tool when a referenced package carries a known-malicious osv.dev (MAL-) advisory.")
1682
1682
  @severity("critical")
1683
- @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:call-tool,owasp:llm03,owasp:asi02")
1683
+ @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:process-prompt,surface:call-tool,owasp:llm03,owasp:asi02")
1684
1684
  @reject_message("Package install blocked: the requested package is flagged as malicious in the osv.dev database.")
1685
1685
  forbid (
1686
1686
  principal,
1687
- action == Overwatch::Action::"call_tool",
1687
+ action in [Overwatch::Action::"process_prompt", Overwatch::Action::"call_tool"],
1688
1688
  resource
1689
1689
  )
1690
1690
  when {
@@ -1699,13 +1699,13 @@ when {
1699
1699
  //
1700
1700
  // @id("agent-security.block-unverified-package")
1701
1701
  // @name("Block unverified package installs")
1702
- // @description("Blocks call_tool package installs when the malicious-package lookup is degraded.")
1702
+ // @description("Blocks process_prompt and call_tool package installs when the malicious-package lookup is degraded.")
1703
1703
  // @severity("medium")
1704
- // @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:call-tool,owasp:llm03")
1704
+ // @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:process-prompt,surface:call-tool,owasp:llm03")
1705
1705
  // @reject_message("Package install blocked: the package could not be verified against the malicious-package database.")
1706
1706
  // forbid (
1707
1707
  // principal,
1708
- // action == Overwatch::Action::"call_tool",
1708
+ // action in [Overwatch::Action::"process_prompt", Overwatch::Action::"call_tool"],
1709
1709
  // resource
1710
1710
  // )
1711
1711
  // when {
@@ -3968,6 +3968,9 @@ export const OVERWATCH_CONTEXT = {
3968
3968
  { "key": "jailbreak_pulse_score", "type": "number", "required": false, "description": "Highflame single-turn classifier score for jailbreak attempts (0-100). Raw score from Pulse detector before combination with deep-context" },
3969
3969
  { "key": "jailbreak_deep_context_score", "type": "number", "required": false, "description": "DeepContext multi-turn analyzer score for jailbreak attempts (0-100). Detects jailbreak escalation patterns across conversation turns" },
3970
3970
  { "key": "indirect_injection_score", "type": "number", "required": true, "description": "Indirect prompt injection risk score (0-100) — injection via tool outputs or retrieved content" },
3971
+ { "key": "package_install_detected", "type": "boolean", "required": false, "description": "True iff a package install/download command was recognized in the request content." },
3972
+ { "key": "malicious_package_detected", "type": "boolean", "required": false, "description": "True iff any referenced package has a known-malicious (MAL-) OSV advisory." },
3973
+ { "key": "package_check_status", "type": "string", "required": false, "description": "Set to \'degraded\' when the osv.dev lookup failed (fail-open); empty otherwise." },
3971
3974
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3972
3975
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3973
3976
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highflame/policy",
3
- "version": "2.2.25",
3
+ "version": "2.2.27",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },