@highflame/policy 2.1.35 → 2.1.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 (81) hide show
  1. package/_schemas/ai_gateway/context.json +431 -11
  2. package/_schemas/ai_gateway/schema.cedarschema +91 -11
  3. package/_schemas/ai_gateway/templates/defaults/agent_security.cedar +66 -43
  4. package/_schemas/ai_gateway/templates/defaults/baseline.cedar +9 -11
  5. package/_schemas/ai_gateway/templates/defaults/semantic.cedar +63 -40
  6. package/_schemas/ai_gateway/templates/defaults/tools.cedar +48 -36
  7. package/_schemas/ai_gateway/templates/llm_default_allow.cedar +9 -10
  8. package/_schemas/ai_gateway/templates/mcp_server_allowlist.cedar +22 -14
  9. package/_schemas/ai_gateway/templates/mcp_tool_permissions.cedar +29 -27
  10. package/_schemas/ai_gateway/templates/pii_redaction.cedar +38 -33
  11. package/_schemas/ai_gateway/templates/templates.json +52 -50
  12. package/_schemas/guardrails/context.json +12 -12
  13. package/_schemas/guardrails/schema.cedarschema +12 -12
  14. package/_schemas/guardrails/templates/defaults/agent_identity.cedar +60 -56
  15. package/_schemas/guardrails/templates/defaults/agentic_safety.cedar +83 -58
  16. package/_schemas/guardrails/templates/defaults/baseline.cedar +9 -12
  17. package/_schemas/guardrails/templates/defaults/injection.cedar +48 -36
  18. package/_schemas/guardrails/templates/defaults/pii.cedar +27 -20
  19. package/_schemas/guardrails/templates/defaults/secrets.cedar +39 -22
  20. package/_schemas/guardrails/templates/defaults/security_patterns.cedar +38 -25
  21. package/_schemas/guardrails/templates/defaults/semantic.cedar +47 -31
  22. package/_schemas/guardrails/templates/defaults/tool_risk.cedar +34 -26
  23. package/_schemas/guardrails/templates/defaults/toxicity.cedar +57 -47
  24. package/_schemas/guardrails/templates/mcp_tool_permissions.cedar +60 -43
  25. package/_schemas/guardrails/templates/profiles/a2a_security/cross_origin.cedar +29 -42
  26. package/_schemas/guardrails/templates/profiles/a2a_security/escalation_detection.cedar +43 -57
  27. package/_schemas/guardrails/templates/profiles/a2a_security/identity_enforcement.cedar +40 -57
  28. package/_schemas/guardrails/templates/profiles/a2a_security/inter_agent_injection.cedar +48 -62
  29. package/_schemas/guardrails/templates/profiles/a2a_security/supply_chain.cedar +40 -56
  30. package/_schemas/guardrails/templates/profiles/advanced_detection/pii.cedar +24 -34
  31. package/_schemas/guardrails/templates/profiles/advanced_detection/secrets.cedar +45 -37
  32. package/_schemas/guardrails/templates/profiles/advanced_detection/threat_severity.cedar +11 -16
  33. package/_schemas/guardrails/templates/profiles/chat_assistant/privacy.cedar +22 -9
  34. package/_schemas/guardrails/templates/profiles/chat_assistant/security.cedar +27 -15
  35. package/_schemas/guardrails/templates/profiles/chat_assistant/trust_safety.cedar +37 -22
  36. package/_schemas/guardrails/templates/profiles/code_agent/agentic_security.cedar +68 -47
  37. package/_schemas/guardrails/templates/profiles/code_agent/encoding.cedar +17 -21
  38. package/_schemas/guardrails/templates/profiles/code_agent/path_security.cedar +74 -73
  39. package/_schemas/guardrails/templates/profiles/code_agent/security.cedar +13 -9
  40. package/_schemas/guardrails/templates/profiles/code_agent/supply_chain.cedar +36 -58
  41. package/_schemas/guardrails/templates/profiles/data_pipeline/agentic_security.cedar +22 -15
  42. package/_schemas/guardrails/templates/profiles/data_pipeline/data_protection.cedar +52 -0
  43. package/_schemas/guardrails/templates/profiles/data_pipeline/privacy.cedar +41 -18
  44. package/_schemas/guardrails/templates/profiles/data_pipeline/security.cedar +18 -36
  45. package/_schemas/guardrails/templates/profiles/multi_agent/agent_safety.cedar +86 -79
  46. package/_schemas/guardrails/templates/profiles/multi_agent/agent_trust.cedar +73 -70
  47. package/_schemas/guardrails/templates/templates.json +198 -217
  48. package/_schemas/overwatch/context.json +14 -14
  49. package/_schemas/overwatch/schema.cedarschema +12 -12
  50. package/_schemas/sentry/context.json +11 -11
  51. package/_schemas/sentry/schema.cedarschema +11 -11
  52. package/_schemas/sentry/templates/defaults/baseline.cedar +8 -12
  53. package/_schemas/sentry/templates/defaults/clipboard.cedar +43 -42
  54. package/_schemas/sentry/templates/defaults/content_safety.cedar +38 -68
  55. package/_schemas/sentry/templates/defaults/file_safety.cedar +18 -26
  56. package/_schemas/sentry/templates/defaults/organization.cedar +10 -17
  57. package/_schemas/sentry/templates/defaults/pii.cedar +52 -73
  58. package/_schemas/sentry/templates/defaults/secrets.cedar +65 -58
  59. package/_schemas/sentry/templates/defaults/semantic.cedar +40 -59
  60. package/_schemas/sentry/templates/templates.json +53 -43
  61. package/dist/ai_gateway-context.gen.d.ts +18 -4
  62. package/dist/ai_gateway-context.gen.js +18 -4
  63. package/dist/ai_gateway-defaults.gen.d.ts +4 -1
  64. package/dist/ai_gateway-defaults.gen.js +398 -320
  65. package/dist/builder.d.ts +2 -1
  66. package/dist/builder.js +5 -2
  67. package/dist/guardrails-context.gen.d.ts +5 -5
  68. package/dist/guardrails-context.gen.js +5 -5
  69. package/dist/guardrails-defaults.gen.d.ts +4 -1
  70. package/dist/guardrails-defaults.gen.js +2130 -1903
  71. package/dist/overwatch-context.gen.d.ts +5 -5
  72. package/dist/overwatch-context.gen.js +5 -5
  73. package/dist/overwatch-defaults.gen.d.ts +4 -1
  74. package/dist/overwatch-defaults.gen.js +560 -566
  75. package/dist/sentry-context.gen.d.ts +3 -3
  76. package/dist/sentry-context.gen.js +3 -3
  77. package/dist/sentry-defaults.gen.d.ts +4 -1
  78. package/dist/sentry-defaults.gen.js +392 -453
  79. package/dist/service-schemas.gen.d.ts +4 -4
  80. package/dist/service-schemas.gen.js +249 -99
  81. package/package.json +1 -1
@@ -1,34 +1,31 @@
1
1
  // =============================================================================
2
2
  // Code Agent — Path Security
3
3
  // =============================================================================
4
- // Blocks access to sensitive file paths including environment files, credential
5
- // files, system directories, and credential directories. Also blocks destructive
4
+ // Blocks access to sensitive file paths: environment files, credential files,
5
+ // system directories, and credential/key directories. Also blocks destructive
6
6
  // file operations (delete, rmdir, unlink) by default.
7
7
  //
8
- // Adapted from Overwatch IDE security policies for Guardrails namespace.
8
+ // Context keys consumed:
9
+ // - path: String
10
+ // - tool_name: String
9
11
  //
10
12
  // Compliance:
11
- // NIST 800-53 AC-6 (Least Privilege)
12
- // NIST 800-53 SC-28 (Protection of Information at Rest)
13
- // MITRE ATT&CK T1552 (Unsecured Credentials)
14
- // MITRE ATT&CK T1005 (Data from Local System)
15
- // CIS Benchmark 1.4 (Secrets Management)
13
+ // - NIST 800-53 AC-6, SC-28; MITRE ATT&CK T1552, T1005; CIS 1.4
16
14
  //
17
- // Category: security
15
+ // Category: security
18
16
  // Namespace: Guardrails
19
17
  // =============================================================================
20
18
 
21
19
  // ---------------------------------------------------------------------------
22
- // Section 1: Environment File Protection
23
- // Environment files are the #1 source of accidental credential exposure.
20
+ // Section 1: Environment files (.env*)
24
21
  // ---------------------------------------------------------------------------
25
22
 
26
- @id("code-block-env-files")
27
- @name("Block .env file access")
28
- @description("Block access to .env files that commonly contain secrets, API keys, and database credentials. Environment files are the #1 source of accidental credential exposure in development workflows.")
23
+ @id("security.code-block-env-files")
24
+ @name("Block dotenv file access (code profile)")
25
+ @description("Blocks read_file, write_file, and call_tool when path matches *.env*.")
29
26
  @severity("high")
30
- @tags("profile,code-agent,path-security,env-files,secrets,nist-sc-28,mitre-t1552")
31
- @reject_message("Access to .env files is blocked because they commonly contain secrets, API keys, and database credentials. Use a secrets manager instead of .env files.")
27
+ @tags("category:security,threat:secrets,detection:pattern,compliance:nist-si-3")
28
+ @reject_message("File access blocked: .env files commonly contain secrets and API keys use a secrets manager instead.")
32
29
  forbid (
33
30
  principal,
34
31
  action in [Guardrails::Action::"read_file", Guardrails::Action::"write_file", Guardrails::Action::"call_tool"],
@@ -39,16 +36,15 @@ when {
39
36
  };
40
37
 
41
38
  // ---------------------------------------------------------------------------
42
- // Section 2: Credential File Protection
43
- // Blocks access to common credential and configuration files.
39
+ // Section 2: Credential files
44
40
  // ---------------------------------------------------------------------------
45
41
 
46
- @id("code-block-credential-files")
47
- @name("Block credential file access")
48
- @description("Block access to common credential files: .netrc, .npmrc, .pypirc, Docker config, Kubernetes config, cloud provider credentials, and service account files.")
42
+ @id("security.code-block-credential-files")
43
+ @name("Block credential files (code profile)")
44
+ @description("Blocks read_file, write_file, and call_tool when path matches a common credential file.")
49
45
  @severity("high")
50
- @tags("profile,code-agent,path-security,credential-files,secrets,nist-sc-28,mitre-t1555")
51
- @reject_message("Access to this credential file is blocked. Files like .netrc, .npmrc, .pypirc, and cloud provider config files commonly contain hardcoded credentials.")
46
+ @tags("category:security,threat:secrets,detection:pattern,compliance:nist-si-3")
47
+ @reject_message("File access blocked: .netrc, .npmrc, .pypirc, cloud config, and service-account files commonly contain hardcoded credentials.")
52
48
  forbid (
53
49
  principal,
54
50
  action in [Guardrails::Action::"read_file", Guardrails::Action::"write_file", Guardrails::Action::"call_tool"],
@@ -56,27 +52,28 @@ forbid (
56
52
  )
57
53
  when {
58
54
  context has path &&
59
- (context.path like "*/.netrc" ||
60
- context.path like "*/.npmrc" ||
61
- context.path like "*/.pypirc" ||
62
- context.path like "*/.docker/config.json" ||
63
- context.path like "*/.kube/config" ||
64
- context.path like "*/.config/gcloud/*" ||
65
- context.path like "*/credentials.json" ||
66
- context.path like "*/service-account*.json")
55
+ (
56
+ context.path like "*/.netrc" ||
57
+ context.path like "*/.npmrc" ||
58
+ context.path like "*/.pypirc" ||
59
+ context.path like "*/.docker/config.json" ||
60
+ context.path like "*/.kube/config" ||
61
+ context.path like "*/.config/gcloud/*" ||
62
+ context.path like "*/credentials.json" ||
63
+ context.path like "*/service-account*.json"
64
+ )
67
65
  };
68
66
 
69
67
  // ---------------------------------------------------------------------------
70
- // Section 3: System Directory Protection
71
- // Blocks access to sensitive system directories.
68
+ // Section 3: System directories
72
69
  // ---------------------------------------------------------------------------
73
70
 
74
- @id("code-block-system-paths")
75
- @name("Block system directory access")
76
- @description("Prevent access to sensitive system directories (/etc, /proc, /sys, /root, /var). These directories contain system configuration, process information, and credentials that agents must never access.")
71
+ @id("security.code-block-system-paths")
72
+ @name("Block system directory access (code profile)")
73
+ @description("Blocks read_file, write_file, and call_tool on /etc, /proc, /sys, /root, /var/log, /var/run paths.")
77
74
  @severity("high")
78
- @tags("profile,code-agent,path-security,system-paths,nist-ac-6,mitre-t1005")
79
- @reject_message("Access blocked: this path targets a sensitive system directory. AI agents are restricted from accessing /etc, /proc, /sys, /root, and /var directories.")
75
+ @tags("category:security,threat:path-traversal,detection:pattern,mitre:t1005")
76
+ @reject_message("File access blocked: sensitive system directory targeted agents may not access /etc, /proc, /sys, /root, or /var.")
80
77
  forbid (
81
78
  principal,
82
79
  action in [Guardrails::Action::"read_file", Guardrails::Action::"write_file", Guardrails::Action::"call_tool"],
@@ -84,25 +81,26 @@ forbid (
84
81
  )
85
82
  when {
86
83
  context has path &&
87
- (context.path like "/etc/*" ||
88
- context.path like "/proc/*" ||
89
- context.path like "/sys/*" ||
90
- context.path like "/root/*" ||
91
- context.path like "/var/log/*" ||
92
- context.path like "/var/run/*")
84
+ (
85
+ context.path like "/etc/*" ||
86
+ context.path like "/proc/*" ||
87
+ context.path like "/sys/*" ||
88
+ context.path like "/root/*" ||
89
+ context.path like "/var/log/*" ||
90
+ context.path like "/var/run/*"
91
+ )
93
92
  };
94
93
 
95
94
  // ---------------------------------------------------------------------------
96
- // Section 4: Credential Directory Protection
97
- // Blocks access to SSH keys, cloud credentials, and key material.
95
+ // Section 4: Credential and key directories
98
96
  // ---------------------------------------------------------------------------
99
97
 
100
- @id("code-block-credential-paths")
101
- @name("Block credential directory access")
102
- @description("Prevent access to SSH keys, cloud provider credentials, GPG keys, and other authentication material directories. These are primary targets for credential theft (MITRE T1552).")
98
+ @id("security.code-block-credential-paths")
99
+ @name("Block credential directories (code profile)")
100
+ @description("Blocks read_file, write_file, and call_tool on .ssh, .aws, .gnupg, .azure, .config/gcloud, .pem, and id_* paths.")
103
101
  @severity("critical")
104
- @tags("profile,code-agent,path-security,credentials,ssh,aws,mitre-t1552")
105
- @reject_message("Access blocked: this path targets a credential or key directory (.ssh, .aws, .gnupg, .config/gcloud). AI agents must never access authentication material.")
102
+ @tags("category:security,threat:secrets,detection:pattern,compliance:nist-si-3")
103
+ @reject_message("File access blocked: SSH, cloud, or GPG key material targeted agents must never access authentication material.")
106
104
  forbid (
107
105
  principal,
108
106
  action in [Guardrails::Action::"read_file", Guardrails::Action::"write_file", Guardrails::Action::"call_tool"],
@@ -110,28 +108,29 @@ forbid (
110
108
  )
111
109
  when {
112
110
  context has path &&
113
- (context.path like "*/.ssh/*" ||
114
- context.path like "*/.aws/*" ||
115
- context.path like "*/.gnupg/*" ||
116
- context.path like "*/.config/gcloud/*" ||
117
- context.path like "*/.azure/*" ||
118
- context.path like "*.pem" ||
119
- context.path like "*/id_rsa*" ||
120
- context.path like "*/id_ed25519*" ||
121
- context.path like "*/id_ecdsa*")
111
+ (
112
+ context.path like "*/.ssh/*" ||
113
+ context.path like "*/.aws/*" ||
114
+ context.path like "*/.gnupg/*" ||
115
+ context.path like "*/.config/gcloud/*" ||
116
+ context.path like "*/.azure/*" ||
117
+ context.path like "*.pem" ||
118
+ context.path like "*/id_rsa*" ||
119
+ context.path like "*/id_ed25519*" ||
120
+ context.path like "*/id_ecdsa*"
121
+ )
122
122
  };
123
123
 
124
124
  // ---------------------------------------------------------------------------
125
- // Section 5: Destructive File Operations
126
- // Blocks destructive file operations by default.
125
+ // Section 5: Destructive file operations
127
126
  // ---------------------------------------------------------------------------
128
127
 
129
- @id("code-block-destructive-ops")
130
- @name("Block destructive file operations")
131
- @description("Block file deletion, directory removal, and other destructive operations. Agents should not have delete access by default — destructive operations require explicit human approval.")
128
+ @id("security.code-block-destructive-ops")
129
+ @name("Block destructive file operations (code profile)")
130
+ @description("Blocks call_tool when tool_name is a destructive file operation.")
132
131
  @severity("high")
133
- @tags("profile,code-agent,path-security,destructive,file-ops,nist-ac-3")
134
- @reject_message("Tool execution was blocked: destructive file operations (delete, rmdir, unlink) are restricted to prevent data loss. Request explicit human approval for destructive actions.")
132
+ @tags("category:security,detection:rule,surface:call-tool,compliance:nist-si-3")
133
+ @reject_message("Tool execution blocked: destructive file operations (delete, rmdir, unlink) require explicit human approval.")
135
134
  forbid (
136
135
  principal,
137
136
  action == Guardrails::Action::"call_tool",
@@ -139,10 +138,12 @@ forbid (
139
138
  )
140
139
  when {
141
140
  context has tool_name &&
142
- (context.tool_name == "fs.delete" ||
143
- context.tool_name == "fs.rmdir" ||
144
- context.tool_name == "fs.unlink" ||
145
- context.tool_name == "fs.remove" ||
146
- context.tool_name == "delete_file" ||
147
- context.tool_name == "remove_directory")
141
+ (
142
+ context.tool_name == "fs.delete" ||
143
+ context.tool_name == "fs.rmdir" ||
144
+ context.tool_name == "fs.unlink" ||
145
+ context.tool_name == "fs.remove" ||
146
+ context.tool_name == "delete_file" ||
147
+ context.tool_name == "remove_directory"
148
+ )
148
149
  };
@@ -1,22 +1,26 @@
1
1
  // =============================================================================
2
- // Code Agent — Security
2
+ // Code Agent — Secrets Protection
3
3
  // =============================================================================
4
- // Secrets protection for coding assistants.
5
4
  // Prevents code agents from writing detected secrets to output files.
6
5
  //
7
- // Category: security
6
+ // Context keys consumed:
7
+ // - secrets_detected: Bool
8
+ //
9
+ // Category: data-protection
8
10
  // Namespace: Guardrails
9
11
  // =============================================================================
10
12
 
11
- @id("code-block-write-secrets")
12
- @name("Block writing secrets to files")
13
- @description("Prevents code agents from writing detected secrets to output files")
13
+ @id("data-protection.code-block-write-secrets")
14
+ @name("Block writing secrets to files (code profile)")
15
+ @description("Blocks write_file when secrets_detected is true.")
14
16
  @severity("critical")
15
- @tags("profile,code-agent,secrets,security")
17
+ @tags("category:data-protection,threat:secrets,detection:rule,surface:write-file,owasp:llm06")
18
+ @reject_message("File write blocked: secrets detected in content — code agents must not persist credentials.")
16
19
  forbid (
17
20
  principal,
18
21
  action == Guardrails::Action::"write_file",
19
22
  resource
20
- ) when {
21
- context has contains_secrets && context.contains_secrets == true
23
+ )
24
+ when {
25
+ context has secrets_detected && context.secrets_detected == true
22
26
  };
@@ -1,40 +1,30 @@
1
1
  // =============================================================================
2
2
  // Code Agent — Supply Chain Security
3
3
  // =============================================================================
4
- // Detects and blocks MCP server poisoning, indirect prompt injection from tool
5
- // outputs, credential theft chains, and destructive operation sequences.
4
+ // Detects and blocks MCP server poisoning, indirect prompt injection from
5
+ // tool outputs, credential theft chains, and destructive operation sequences.
6
6
  //
7
- // These are agentic AI-specific attack vectors where tool descriptions, server
8
- // responses, or behavioral drift manipulate agent behavior.
9
- //
10
- // Adapted from Overwatch agent security and behavioral analysis policies for
11
- // the Guardrails namespace.
7
+ // Context keys consumed:
8
+ // - tool_poisoning_score: Long (0-100)
9
+ // - indirect_injection_score: Long (0-100)
10
+ // - tool_is_sensitive: Bool
11
+ // - suspicious_pattern: Bool
12
+ // - pattern_type: String
12
13
  //
13
14
  // Compliance:
14
- // OWASP ASI01 (Agent Goal Hijack)
15
- // OWASP ASI02 (Tool Misuse)
16
- // OWASP ASI04 (Supply Chain)
17
- // OWASP LLM01 (Prompt Injection) — indirect variant
18
- // OWASP MCP01-05
19
- // MITRE ATLAS AML.T0051 (Prompt Injection)
20
- // MITRE ATT&CK T1552 (Unsecured Credentials)
15
+ // - OWASP ASI01, ASI02, ASI04, LLM01 (indirect), MCP01–05
16
+ // - MITRE ATLAS AML.T0051, MITRE ATT&CK T1552
21
17
  //
22
- // Category: agentic_security
18
+ // Category: agent-security
23
19
  // Namespace: Guardrails
24
20
  // =============================================================================
25
21
 
26
- // ---------------------------------------------------------------------------
27
- // Section 1: MCP Server Poisoning
28
- // Blocks connections to MCP servers with poisoned tool descriptions.
29
- // Lower threshold than tool-level poisoning since it affects all tools.
30
- // ---------------------------------------------------------------------------
31
-
32
- @id("code-block-server-poisoning")
33
- @name("Block poisoned MCP servers")
34
- @description("Block connections to MCP servers when tool poisoning patterns are detected in tool descriptions (score >= 60). Lower threshold than tool-level poisoning since server-level poisoning affects all tools on the server.")
22
+ @id("agent-security.code-block-server-poisoning")
23
+ @name("Block poisoned MCP servers (code profile)")
24
+ @description("Blocks connect_server when tool_poisoning_score >= 60.")
35
25
  @severity("critical")
36
- @tags("profile,code-agent,supply-chain,tool-poisoning,mcp-security,owasp-asi04")
37
- @reject_message("MCP server connection blocked: tool poisoning patterns detected in server tool descriptions. Review server tools before connecting.")
26
+ @tags("category:agent-security,threat:tool-poisoning,detection:ml,surface:connect-server,owasp:asi04")
27
+ @reject_message("MCP server connection blocked: tool poisoning patterns detected in server tool descriptions.")
38
28
  forbid (
39
29
  principal,
40
30
  action == Guardrails::Action::"connect_server",
@@ -44,19 +34,12 @@ when {
44
34
  context has tool_poisoning_score && context.tool_poisoning_score >= 60
45
35
  };
46
36
 
47
- // ---------------------------------------------------------------------------
48
- // Section 2: Indirect Prompt Injection
49
- // Blocks injection from tool outputs and retrieved content — not direct
50
- // user input but external content that manipulates agent behavior.
51
- // Ref: EchoLeak CVE-2025-32711, IDEsaster (30+ CVEs)
52
- // ---------------------------------------------------------------------------
53
-
54
- @id("code-block-indirect-injection")
55
- @name("Block indirect prompt injection")
56
- @description("Block tool execution when indirect prompt injection is detected in tool outputs, file contents, or retrieved documents (score >= 70). Defends against injection via external content that manipulates agent behavior.")
37
+ @id("agent-security.code-block-indirect-injection")
38
+ @name("Block indirect injection (code profile)")
39
+ @description("Blocks call_tool when indirect_injection_score >= 70.")
57
40
  @severity("critical")
58
- @tags("profile,code-agent,supply-chain,indirect-injection,owasp-llm01,owasp-asi01")
59
- @reject_message("Content blocked: indirect prompt injection detected in tool output or retrieved content. An external source may be attempting to hijack agent behavior.")
41
+ @tags("category:agent-security,threat:indirect-injection,detection:ml,surface:call-tool,owasp:llm01,owasp:asi01")
42
+ @reject_message("Content blocked: indirect prompt injection detected in tool output or retrieved content.")
60
43
  forbid (
61
44
  principal,
62
45
  action == Guardrails::Action::"call_tool",
@@ -66,12 +49,12 @@ when {
66
49
  context has indirect_injection_score && context.indirect_injection_score >= 70
67
50
  };
68
51
 
69
- @id("code-block-indirect-injection-sensitive")
70
- @name("Block indirect injection on sensitive tools")
71
- @description("Lower threshold (>= 50) for indirect injection when the tool is classified as sensitive. Even moderate injection risk on sensitive tools (shell, file write, network) warrants blocking.")
52
+ @id("agent-security.code-block-indirect-injection-sensitive")
53
+ @name("Block indirect injection on sensitive tools (code profile)")
54
+ @description("Blocks call_tool when indirect_injection_score >= 50 and tool_is_sensitive is true.")
72
55
  @severity("critical")
73
- @tags("profile,code-agent,supply-chain,indirect-injection,sensitive-tools,owasp-asi02")
74
- @reject_message("Sensitive tool execution blocked: moderate indirect injection risk detected. Sensitive tools require higher confidence that content is safe.")
56
+ @tags("category:agent-security,threat:indirect-injection,detection:ml,surface:call-tool,owasp:asi02")
57
+ @reject_message("Sensitive tool execution blocked: moderate indirect-injection risk detected (code profile).")
75
58
  forbid (
76
59
  principal,
77
60
  action == Guardrails::Action::"call_tool",
@@ -82,17 +65,12 @@ when {
82
65
  context has tool_is_sensitive && context.tool_is_sensitive == true
83
66
  };
84
67
 
85
- // ---------------------------------------------------------------------------
86
- // Section 3: Behavioral Attack Patterns
87
- // Detects multi-step attack chains targeting credentials and workspace integrity.
88
- // ---------------------------------------------------------------------------
89
-
90
- @id("code-block-credential-theft")
91
- @name("Block credential theft chains")
92
- @description("Block tool execution when a credential theft chain is detected — accessing SSH keys, cloud credentials, or API tokens followed by encoding, compression, or transfer operations. Multi-step attack pattern for autonomous credential harvesting.")
68
+ @id("agent-security.code-block-credential-theft")
69
+ @name("Block credential theft chains (code profile)")
70
+ @description("Blocks call_tool when suspicious_pattern is true and pattern_type equals \"credential_theft\".")
93
71
  @severity("critical")
94
- @tags("profile,code-agent,supply-chain,credential-theft,behavioral,mitre-t1552")
95
- @reject_message("Tool execution blocked: credential theft chain detected. The agent is performing a multi-step operation to harvest and exfiltrate credentials.")
72
+ @tags("category:agent-security,threat:exfiltration,detection:rule,surface:call-tool,mitre:t1059")
73
+ @reject_message("Tool execution blocked: credential theft chain detected multi-step credential harvesting pattern.")
96
74
  forbid (
97
75
  principal,
98
76
  action == Guardrails::Action::"call_tool",
@@ -103,12 +81,12 @@ when {
103
81
  context has pattern_type && context.pattern_type == "credential_theft"
104
82
  };
105
83
 
106
- @id("code-block-destructive-sequence")
107
- @name("Block destructive operation sequences")
108
- @description("Block tool execution when a destructive operation sequence is detected bulk file deletions, permission changes, config overwrites, or repository manipulation patterns. Prevents agent-initiated workspace damage.")
84
+ @id("agent-security.code-block-destructive-sequence")
85
+ @name("Block destructive operation sequences (code profile)")
86
+ @description("Blocks call_tool when suspicious_pattern is true and pattern_type equals \"destructive_sequence\".")
109
87
  @severity("critical")
110
- @tags("profile,code-agent,supply-chain,destructive,behavioral,owasp-asi02")
111
- @reject_message("Tool execution blocked: destructive operation sequence detected. The agent is performing a pattern of destructive operations that could damage the workspace.")
88
+ @tags("category:agent-security,detection:rule,surface:call-tool,owasp:asi02")
89
+ @reject_message("Tool execution blocked: destructive operation sequence detected bulk deletions, config overwrites, or repo manipulation.")
112
90
  forbid (
113
91
  principal,
114
92
  action == Guardrails::Action::"call_tool",
@@ -2,37 +2,44 @@
2
2
  // Data Pipeline — Agentic Security
3
3
  // =============================================================================
4
4
  // Exfiltration prevention and tool risk controls for data pipelines.
5
- // Prevents retrieval data from being sent to external endpoints.
6
5
  //
7
- // Category: agentic_security
6
+ // Context keys consumed:
7
+ // - suspicious_pattern: Bool
8
+ // - pattern_type: String
9
+ // - tool_risk_score: Long (0-100)
10
+ //
11
+ // Category: agent-security
8
12
  // Namespace: Guardrails
9
13
  // =============================================================================
10
14
 
11
- @id("data-block-exfiltration")
12
- @name("Block data exfiltration from pipeline")
13
- @description("Prevents retrieval data from being sent to external endpoints")
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.")
14
18
  @severity("critical")
15
- @tags("profile,data-pipeline,exfiltration,security")
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.")
16
21
  forbid (
17
22
  principal,
18
23
  action == Guardrails::Action::"call_tool",
19
24
  resource
20
- ) when {
25
+ )
26
+ when {
21
27
  context has suspicious_pattern && context.suspicious_pattern == true &&
22
28
  context has pattern_type &&
23
- (context.pattern_type == "data_exfiltration" ||
24
- context.pattern_type == "db_exfiltration")
29
+ (context.pattern_type == "data_exfiltration" || context.pattern_type == "db_exfiltration")
25
30
  };
26
31
 
27
- @id("data-block-high-risk-tools")
28
- @name("Block high-risk tools in pipeline")
29
- @description("Forbids tools with elevated risk in data processing context")
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.")
30
35
  @severity("high")
31
- @tags("profile,data-pipeline,tools,security")
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.")
32
38
  forbid (
33
39
  principal,
34
40
  action == Guardrails::Action::"call_tool",
35
41
  resource
36
- ) when {
37
- context has tool_risk_score && context.tool_risk_score > 60
42
+ )
43
+ when {
44
+ context has tool_risk_score && context.tool_risk_score >= 61
38
45
  };
@@ -0,0 +1,52 @@
1
+ // =============================================================================
2
+ // Data Pipeline — Data Protection (Secrets)
3
+ // =============================================================================
4
+ // Strict secrets detection for data pipelines. Any secret triggers a block;
5
+ // secrets in writes are blocked unconditionally to prevent persistence.
6
+ //
7
+ // Context keys consumed:
8
+ // - secrets_detected: Bool
9
+ // - secret_count: Long
10
+ //
11
+ // Compliance:
12
+ // - OWASP LLM06
13
+ //
14
+ // Category: data-protection
15
+ // Namespace: Guardrails
16
+ // =============================================================================
17
+
18
+ @id("data-protection.data-pipeline-block-secrets")
19
+ @name("Block secrets in data pipeline")
20
+ @description("Blocks process_prompt, call_tool, read_file, and write_file when secrets_detected is true.")
21
+ @severity("critical")
22
+ @tags("category:data-protection,threat:secrets,detection:rule,owasp:llm06")
23
+ @reject_message("Request blocked: secrets detected in a data pipeline — any credential exposure is unacceptable here.")
24
+ forbid (
25
+ principal,
26
+ action in [
27
+ Guardrails::Action::"process_prompt",
28
+ Guardrails::Action::"call_tool",
29
+ Guardrails::Action::"read_file",
30
+ Guardrails::Action::"write_file"
31
+ ],
32
+ resource
33
+ )
34
+ when {
35
+ context has secrets_detected && context.secrets_detected == true
36
+ };
37
+
38
+ @id("data-protection.data-pipeline-block-secrets-output")
39
+ @name("Block secrets in pipeline outputs")
40
+ @description("Blocks write_file when secrets_detected is true or secret_count >= 1.")
41
+ @severity("critical")
42
+ @tags("category:data-protection,threat:secrets,detection:rule,surface:write-file,owasp:llm06")
43
+ @reject_message("File write blocked: secrets detected in pipeline output — credentials must not be persisted.")
44
+ forbid (
45
+ principal,
46
+ action == Guardrails::Action::"write_file",
47
+ resource
48
+ )
49
+ when {
50
+ (context has secrets_detected && context.secrets_detected == true) ||
51
+ (context has secret_count && context.secret_count >= 1)
52
+ };
@@ -4,37 +4,60 @@
4
4
  // Strict PII protection for RAG pipelines and data processing agents.
5
5
  // Zero-tolerance for sensitive PII types — data pipelines must not leak PII.
6
6
  //
7
- // Category: privacy
7
+ // Context keys consumed:
8
+ // - pii_detected: Bool
9
+ // - pii_types: Set<String>
10
+ //
11
+ // Compliance:
12
+ // - GDPR Art. 32, HIPAA §164.312, PCI DSS 3.4
13
+ //
14
+ // Category: privacy
8
15
  // Namespace: Guardrails
9
16
  // =============================================================================
10
17
 
11
- @id("data-pii-block-all")
12
- @name("Block all PII in data pipeline")
13
- @description("Forbids any PII in both inputs and outputs data pipelines must not process or leak PII")
18
+ @id("privacy.data-pipeline-block-pii")
19
+ @name("Block PII in data pipeline")
20
+ @description("Blocks process_prompt, call_tool, read_file, and write_file when pii_detected is true.")
14
21
  @severity("critical")
15
- @tags("profile,data-pipeline,pii,privacy")
22
+ @tags("category:privacy,threat:pii,detection:rule,compliance:gdpr,compliance:hipaa")
23
+ @reject_message("Request blocked: PII detected in a data pipeline — pipelines must not process or leak personal data.")
16
24
  forbid (
17
25
  principal,
18
- action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
26
+ action in [
27
+ Guardrails::Action::"process_prompt",
28
+ Guardrails::Action::"call_tool",
29
+ Guardrails::Action::"read_file",
30
+ Guardrails::Action::"write_file"
31
+ ],
19
32
  resource
20
- ) when {
33
+ )
34
+ when {
21
35
  context has pii_detected && context.pii_detected == true
22
36
  };
23
37
 
24
- @id("data-pii-block-sensitive-types")
25
- @name("Block sensitive PII types strictly")
26
- @description("Zero-tolerance for SSN, credit cards, passport numbers, and medical IDs in data pipelines")
38
+ @id("privacy.data-pipeline-block-pii-sensitive")
39
+ @name("Block sensitive PII types in data pipeline")
40
+ @description("Blocks process_prompt, call_tool, read_file, and write_file when pii_types contains SSN, credit_card, passport, medical_id, or tax_id.")
27
41
  @severity("critical")
28
- @tags("profile,data-pipeline,pii,compliance")
42
+ @tags("category:privacy,threat:pii,detection:rule,compliance:gdpr,compliance:hipaa,compliance:pci-dss")
43
+ @reject_message("Request blocked: highly sensitive PII (SSN, credit card, passport, medical ID, or tax ID) detected in a data pipeline.")
29
44
  forbid (
30
45
  principal,
31
- action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
46
+ action in [
47
+ Guardrails::Action::"process_prompt",
48
+ Guardrails::Action::"call_tool",
49
+ Guardrails::Action::"read_file",
50
+ Guardrails::Action::"write_file"
51
+ ],
32
52
  resource
33
- ) when {
53
+ )
54
+ when {
34
55
  context has pii_types &&
35
- (context.pii_types.contains("ssn") ||
36
- context.pii_types.contains("credit_card") ||
37
- context.pii_types.contains("passport") ||
38
- context.pii_types.contains("medical_id") ||
39
- context.pii_types.contains("tax_id"))
56
+ (
57
+ context.pii_types.contains("ssn") ||
58
+ context.pii_types.contains("credit_card") ||
59
+ context.pii_types.contains("passport") ||
60
+ context.pii_types.contains("medical_id") ||
61
+ context.pii_types.contains("tax_id")
62
+ )
40
63
  };