@highflame/policy 2.1.32 → 2.1.33

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.
@@ -4,7 +4,7 @@
4
4
  "description": "Sentry browser security — monitors AI chat interactions and enforces data-protection, content-safety, and compliance policies",
5
5
  "actions": [
6
6
  {
7
- "name": "send_message",
7
+ "name": "process_prompt",
8
8
  "description": "User sends a message (prompt) to an AI chat service via the browser",
9
9
  "context_attributes": [
10
10
  {
@@ -23,7 +23,7 @@
23
23
  "key": "event",
24
24
  "type": "string",
25
25
  "required": true,
26
- "description": "Event type (always 'send_message')"
26
+ "description": "Event type (always 'process_prompt')"
27
27
  },
28
28
  {
29
29
  "key": "user_email",
@@ -62,7 +62,7 @@ entity User;
62
62
  // ENTITIES - Resources (scoped under Project)
63
63
  // =============================================================================
64
64
 
65
- /// AI chat session — resource for send_message and receive_response actions
65
+ /// AI chat session — resource for process_prompt and receive_response actions
66
66
  entity ChatSession in [Project];
67
67
 
68
68
  /// Document or file being uploaded — resource for upload_file action
@@ -74,14 +74,14 @@ entity Document in [Project];
74
74
 
75
75
  // User sends a message (prompt) to an AI chat service
76
76
  // Threat focus: data leakage (PII, secrets, confidential data), injection, content safety
77
- action send_message appliesTo {
77
+ action process_prompt appliesTo {
78
78
  principal: [User],
79
79
  resource: [ChatSession],
80
80
  context: {
81
81
  // --- Core Metadata ---
82
82
  content: String, // Raw message content being sent
83
83
  source: String, // Browser extension identifier: "sentry"
84
- event: String, // Event type: "send_message"
84
+ event: String, // Event type: "process_prompt"
85
85
  user_email: String, // User identifier (SSO/OAuth verified)
86
86
  target_app: String, // AI service: "chatgpt", "gemini", "claude", "copilot", "custom"
87
87
  target_url?: String, // Full URL of the AI chat service
@@ -4,10 +4,15 @@
4
4
  // Controls over paste operations into AI chat services. Covers:
5
5
  // - Blanket paste blocking (admin-configurable)
6
6
  // - Paste-with-secrets blocking
7
+ // - Paste-with-PII blocking
7
8
  // - Paste-with-source-code blocking
9
+ // - Large-paste threat blocking
10
+ // - Paste-with-encoded-payload blocking
11
+ // - Paste-with-invisible-character blocking
8
12
  //
9
- // Cross-cutting secret rules (e.g. high-risk credential types) are defined
10
- // in secrets.cedar and apply to paste content as well.
13
+ // All policies in this file are scoped to action == "paste_content". Other
14
+ // templates (semantic.cedar, content_safety.cedar, pii.cedar, secrets.cedar)
15
+ // cover process_prompt and upload_file for the same threat categories.
11
16
  //
12
17
  // Category: clipboard
13
18
  // Namespace: Sentry
@@ -58,19 +63,36 @@ when {
58
63
  context has pii_detected && context.pii_detected
59
64
  };
60
65
 
61
- // Block pasted source code
62
- @id("sentry-org-block-code-paste")
63
- @name("Block pasted source code")
64
- @description("Block paste operations when content is primarily source code (>80%). Prevents code exfiltration via clipboard from IDEs, terminals, or code repositories into AI chats.")
66
+ // Block pastes containing encoded injection payloads
67
+ @id("sentry-clipboard-block-paste-encoded")
68
+ @name("Block encoded paste content")
69
+ @description("Block paste operations when encoded injection payloads (base64, hex, unicode) are detected. Attackers use encoding to smuggle injection payloads via clipboard transfer.")
65
70
  @severity("high")
66
- @tags("source-code,paste-safety,ip-protection,data-leakage")
67
- @reject_message("Paste blocked: the content appears to be primarily source code (>80%). Pasting bulk source code into AI services risks intellectual property exposure.")
71
+ @tags("paste-safety,encoding,injection,clipboard")
72
+ @reject_message("Paste blocked: encoded injection payloads detected in pasted content. Content with hidden encoded instructions cannot be shared with AI services.")
68
73
  forbid (
69
74
  principal,
70
75
  action == Sentry::Action::"paste_content",
71
76
  resource
72
77
  )
73
78
  when {
74
- context has contains_code && context.contains_code &&
75
- context has code_ratio && context.code_ratio > 80
79
+ context has encoded_content_detected && context.encoded_content_detected &&
80
+ context has encoded_score && context.encoded_score >= 60
81
+ };
82
+
83
+ // Block pastes with invisible characters
84
+ @id("sentry-clipboard-block-paste-invisible")
85
+ @name("Block paste with invisible characters")
86
+ @description("Block paste operations containing invisible Unicode characters (zero-width, bidi overrides). These can hide malicious instructions that appear invisible to users but are processed by AI models.")
87
+ @severity("high")
88
+ @tags("paste-safety,unicode,invisible-chars,clipboard")
89
+ @reject_message("Paste blocked: invisible Unicode characters detected. Hidden characters can disguise malicious instructions that AI models process but users cannot see.")
90
+ forbid (
91
+ principal,
92
+ action == Sentry::Action::"paste_content",
93
+ resource
94
+ )
95
+ when {
96
+ context has contains_invisible_chars && context.contains_invisible_chars &&
97
+ context has invisible_chars_score && context.invisible_chars_score >= 50
76
98
  };
@@ -2,8 +2,10 @@
2
2
  // Content Safety Policy (Default)
3
3
  // =============================================================================
4
4
  // Detects and blocks violent, harmful, hateful, sexual, and profane content
5
- // in AI chat interactions. Includes cut-and-paste safety rules to prevent
6
- // unsafe content from being transferred into AI services.
5
+ // in AI chat interactions across messages and file uploads.
6
+ //
7
+ // Paste-specific content safety rules live in clipboard.cedar — see
8
+ // "Clipboard Policy".
7
9
  //
8
10
  // The detection engine runs ML classifiers (toxicity, content safety) and
9
11
  // produces normalized scores (0-100) for each category.
@@ -21,19 +23,19 @@
21
23
  // ---------------------------------------------------------------------------
22
24
  // Section 1: Violence & Weapons
23
25
  // Blocks content promoting, describing, or instructing violence and weapons.
24
- // Applies to messages, paste, and file uploads.
26
+ // Applies to messages and file uploads.
25
27
  // ---------------------------------------------------------------------------
26
28
 
27
29
  // Block violent content across all input channels
28
30
  @id("sentry-cs-block-violence")
29
31
  @name("Block violent content")
30
- @description("Block content when the ML violence detection score exceeds threshold (80/100). Catches graphic violence descriptions, instructions for causing harm, and violent threat language in messages, pastes, and uploads.")
32
+ @description("Block content when the ML violence detection score exceeds threshold (80/100). Catches graphic violence descriptions, instructions for causing harm, and violent threat language in messages and uploads.")
31
33
  @severity("critical")
32
34
  @tags("violence,content-safety,trust-safety,nist-si-4,iso-42001")
33
35
  @reject_message("Content blocked: violent content detected. AI services must not process violent content in enterprise environments. Please rephrase without violence-related language.")
34
36
  forbid (
35
37
  principal,
36
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
38
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
37
39
  resource
38
40
  )
39
41
  when {
@@ -49,7 +51,7 @@ when {
49
51
  @reject_message("Content blocked: weapons-related content detected. AI services must not process weapons manufacturing, procurement, or specification content.")
50
52
  forbid (
51
53
  principal,
52
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
54
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
53
55
  resource
54
56
  )
55
57
  when {
@@ -70,7 +72,7 @@ when {
70
72
  @reject_message("Content blocked: hate speech or discriminatory content detected. AI services must not process hateful, discriminatory, or dehumanizing content.")
71
73
  forbid (
72
74
  principal,
73
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
75
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
74
76
  resource
75
77
  )
76
78
  when {
@@ -90,7 +92,7 @@ when {
90
92
  @reject_message("Content blocked: criminal activity content detected. AI services must not process content related to illegal activities or fraud.")
91
93
  forbid (
92
94
  principal,
93
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
95
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
94
96
  resource
95
97
  )
96
98
  when {
@@ -110,7 +112,7 @@ when {
110
112
  @reject_message("Content blocked: sexual content detected. AI services must not process sexually explicit material in enterprise environments.")
111
113
  forbid (
112
114
  principal,
113
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
115
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
114
116
  resource
115
117
  )
116
118
  when {
@@ -131,102 +133,10 @@ when {
131
133
  @reject_message("Content blocked: excessive profanity detected. Please rephrase in a professional manner.")
132
134
  forbid (
133
135
  principal,
134
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
136
+ action == Sentry::Action::"process_prompt",
135
137
  resource
136
138
  )
137
139
  when {
138
140
  context has profanity_score && context.profanity_score >= 90
139
141
  };
140
142
 
141
- // ---------------------------------------------------------------------------
142
- // Section 6: Cut & Paste Safety
143
- // Specific rules for content pasted from external sources into AI chats.
144
- // Paste operations are a primary vector for data leakage.
145
- // ---------------------------------------------------------------------------
146
-
147
- // Block large pastes with any detected threats
148
- @id("sentry-cs-block-large-paste-threats")
149
- @name("Block large pastes with threats")
150
- @description("Block large paste operations (>5000 chars) when any threats are detected. Large pastes with threats likely indicate bulk data dumps from emails, documents, or databases being leaked to AI services.")
151
- @severity("high")
152
- @tags("paste-safety,data-leakage,content-safety")
153
- @reject_message("Large paste operation blocked: security threats were detected in the pasted content. Large data transfers to AI services require threat-free content.")
154
- forbid (
155
- principal,
156
- action == Sentry::Action::"paste_content",
157
- resource
158
- )
159
- when {
160
- context has paste_length && context has threat_count &&
161
- context.paste_length > 5000 && context.threat_count >= 1
162
- };
163
-
164
- // Block pastes containing encoded injection payloads
165
- @id("sentry-cs-block-paste-encoded")
166
- @name("Block encoded paste content")
167
- @description("Block paste operations when encoded injection payloads (base64, hex, unicode) are detected. Attackers use encoding to smuggle injection payloads via clipboard transfer.")
168
- @severity("high")
169
- @tags("paste-safety,encoding,injection,content-safety")
170
- @reject_message("Paste blocked: encoded injection payloads detected in pasted content. Content with hidden encoded instructions cannot be shared with AI services.")
171
- forbid (
172
- principal,
173
- action == Sentry::Action::"paste_content",
174
- resource
175
- )
176
- when {
177
- context has encoded_content_detected && context.encoded_content_detected &&
178
- context has encoded_score && context.encoded_score >= 60
179
- };
180
-
181
- // Block pastes with invisible characters
182
- @id("sentry-cs-block-paste-invisible")
183
- @name("Block paste with invisible characters")
184
- @description("Block paste operations containing invisible Unicode characters (zero-width, bidi overrides). These can hide malicious instructions that appear invisible to users but are processed by AI models.")
185
- @severity("high")
186
- @tags("paste-safety,unicode,invisible-chars,content-safety")
187
- @reject_message("Paste blocked: invisible Unicode characters detected. Hidden characters can disguise malicious instructions that AI models process but users cannot see.")
188
- forbid (
189
- principal,
190
- action == Sentry::Action::"paste_content",
191
- resource
192
- )
193
- when {
194
- context has contains_invisible_chars && context.contains_invisible_chars &&
195
- context has invisible_chars_score && context.invisible_chars_score >= 50
196
- };
197
-
198
- // ---------------------------------------------------------------------------
199
- // Section 7: AI Response Safety
200
- // Block harmful content in AI responses before user sees it.
201
- // ---------------------------------------------------------------------------
202
-
203
- // Block violent/harmful AI responses
204
- @id("sentry-cs-block-response-safety")
205
- @name("Block harmful AI responses")
206
- @description("Block AI responses containing high-severity violent, hateful, or criminal content. Prevents harmful AI-generated content from reaching users in enterprise environments.")
207
- @severity("critical")
208
- @tags("response-safety,content-safety,owasp-llm02")
209
- @reject_message("AI response blocked: harmful content detected in the response. The AI service generated content that violates enterprise content safety policies.")
210
- forbid (
211
- principal,
212
- action == Sentry::Action::"receive_response",
213
- resource
214
- )
215
- when {
216
- context has violence_score && context.violence_score >= 80
217
- };
218
-
219
- @id("sentry-cs-block-response-hate")
220
- @name("Block hateful AI responses")
221
- @description("Block AI responses with hate speech or discriminatory content.")
222
- @severity("critical")
223
- @tags("response-safety,hate-speech,content-safety,owasp-llm02")
224
- @reject_message("AI response blocked: hate speech or discriminatory content detected in the response.")
225
- forbid (
226
- principal,
227
- action == Sentry::Action::"receive_response",
228
- resource
229
- )
230
- when {
231
- context has hate_speech_score && context.hate_speech_score >= 75
232
- };
@@ -9,8 +9,6 @@
9
9
  // 1. MIP label enforcement — sensitivity_level from document metadata
10
10
  // 2. PII/secrets in file content — from Shield PIIRegexDetector/SecretsDetector
11
11
  // 3. Injection payloads in files — from Shield InjectionDetector
12
- // 4. File type restrictions — block dangerous extensions
13
- // 5. Phishing link detection — from CheckPhishDetector
14
12
  //
15
13
  // Compliance:
16
14
  // Microsoft Information Protection (MIP) — label-based access control
@@ -112,63 +110,3 @@ forbid (
112
110
  when {
113
111
  context has pii_detected && context.pii_detected
114
112
  };
115
-
116
- // Block files with phishing links
117
- @id("sentry-file-block-phishing")
118
- @name("Block files with phishing links")
119
- @description("Block file uploads when phishing URLs are detected in document content. Prevents sharing of compromised documents that could expose phishing links to AI processing.")
120
- @severity("high")
121
- @tags("phishing,file-upload,security")
122
- @reject_message("Upload blocked: phishing URLs detected in the file. Documents containing phishing links cannot be shared with AI services.")
123
- forbid (
124
- principal,
125
- action == Sentry::Action::"upload_file",
126
- resource
127
- )
128
- when {
129
- context has phishing_detected && context.phishing_detected
130
- };
131
-
132
- // ---------------------------------------------------------------------------
133
- // Section 3: File Type & Size Restrictions
134
- // Block potentially dangerous file types and oversized files.
135
- // ---------------------------------------------------------------------------
136
-
137
- // Block large file uploads with any threats
138
- @id("sentry-file-block-large-threats")
139
- @name("Block large files with threats")
140
- @description("Block file uploads over 10MB when any threats are detected. Large files with threats likely contain data dumps or bulk exports being exfiltrated to AI services.")
141
- @severity("high")
142
- @tags("file-upload,size-limit,data-protection")
143
- @reject_message("Upload blocked: security threats detected in a large file. Large data transfers to AI services require threat-free content.")
144
- forbid (
145
- principal,
146
- action == Sentry::Action::"upload_file",
147
- resource
148
- )
149
- when {
150
- context has file_size_bytes && context has threat_count &&
151
- context.file_size_bytes > 10485760 && context.threat_count >= 1
152
- };
153
-
154
- // ---------------------------------------------------------------------------
155
- // Section 4: Source Code Protection
156
- // Block source code uploads to AI services.
157
- // ---------------------------------------------------------------------------
158
-
159
- // Block files with high code content
160
- @id("sentry-file-block-source-code")
161
- @name("Block source code uploads")
162
- @description("Block file uploads when source code constitutes more than 80% of the content. Prevents bulk source code exfiltration to external AI services where it may be used for training or exposed.")
163
- @severity("high")
164
- @tags("source-code,ip-protection,file-upload,data-leakage")
165
- @reject_message("Upload blocked: the file appears to be primarily source code (>80%). Bulk source code should not be shared with external AI services to protect intellectual property.")
166
- forbid (
167
- principal,
168
- action == Sentry::Action::"upload_file",
169
- resource
170
- )
171
- when {
172
- context has contains_code && context.contains_code &&
173
- context has code_ratio && context.code_ratio > 80
174
- };
@@ -28,7 +28,7 @@
28
28
  @reject_message("Message blocked: the content appears to be primarily source code (>80%). Bulk source code should not be shared with external AI services to protect intellectual property.")
29
29
  forbid (
30
30
  principal,
31
- action == Sentry::Action::"send_message",
31
+ action == Sentry::Action::"process_prompt",
32
32
  resource
33
33
  )
34
34
  when {
@@ -1,8 +1,10 @@
1
1
  // =============================================================================
2
2
  // PII Detection Policy (Default)
3
3
  // =============================================================================
4
- // Detects and blocks personally identifiable information across messages,
5
- // pasted content, file uploads, and AI responses. Uses multi-layered detection:
4
+ // Detects and blocks personally identifiable information across messages
5
+ // and file uploads. Uses multi-layered detection:
6
+ //
7
+ // Paste-targeted PII rules live in clipboard.cedar.
6
8
  //
7
9
  // 1. PII boolean flag (pii_detected) — broadest catch from detection engine
8
10
  // 2. Granular PII type matching (pii_types) — type-specific blocking
@@ -30,16 +32,16 @@
30
32
  // Fires when the detection pipeline identifies PII in any content.
31
33
  // ---------------------------------------------------------------------------
32
34
 
33
- // Block messages containing detected PII
35
+ // Block messages and uploads containing detected PII
34
36
  @id("sentry-pii-block-messages")
35
- @name("Block messages with PII")
36
- @description("Block messages when the detection engine identifies any PII patterns. Prevents employees from accidentally sharing personal data with AI chat services.")
37
+ @name("Block messages and uploads with PII")
38
+ @description("Block messages and file uploads when the detection engine identifies any PII patterns. Prevents employees from accidentally sharing personal data with AI chat services.")
37
39
  @severity("critical")
38
40
  @tags("pii,privacy,data-protection,gdpr-art-32,owasp-llm06")
39
- @reject_message("Your message was blocked because personally identifiable information was detected. Remove all PII (names, addresses, SSNs, credit cards, etc.) before sending to AI services.")
41
+ @reject_message("Content blocked: personally identifiable information was detected. Remove all PII (names, addresses, SSNs, credit cards, etc.) before sending to AI services.")
40
42
  forbid (
41
43
  principal,
42
- action == Sentry::Action::"send_message",
44
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
43
45
  resource
44
46
  )
45
47
  when {
@@ -54,13 +56,13 @@ when {
54
56
  // Block credit card numbers (PCI DSS compliance)
55
57
  @id("sentry-pii-block-credit-cards")
56
58
  @name("Block credit card numbers")
57
- @description("Block content containing credit card number patterns across all actions. PCI DSS 3.4 requires PANs are rendered unreadable — AI services must never receive raw card numbers.")
59
+ @description("Block messages and file uploads containing credit card number patterns. PCI DSS 3.4 requires PANs are rendered unreadable — AI services must never receive raw card numbers.")
58
60
  @severity("critical")
59
61
  @tags("pci,credit-card,payment,compliance,pci-dss-3.4")
60
62
  @reject_message("Content blocked: credit card number patterns detected. Sharing payment card data with AI services violates PCI DSS. Use tokenized references instead.")
61
63
  forbid (
62
64
  principal,
63
- action,
65
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
64
66
  resource
65
67
  )
66
68
  when {
@@ -71,13 +73,13 @@ when {
71
73
  // Block Social Security Numbers
72
74
  @id("sentry-pii-block-ssn")
73
75
  @name("Block Social Security Numbers")
74
- @description("Block content containing SSN patterns (XXX-XX-XXXX and variants). SSNs are high-value identity theft targets — exposure through AI services is a critical privacy violation.")
76
+ @description("Block messages and file uploads containing SSN patterns (XXX-XX-XXXX and variants). SSNs are high-value identity theft targets — exposure through AI services is a critical privacy violation.")
75
77
  @severity("critical")
76
78
  @tags("ssn,identity,privacy,compliance,nist-si-4")
77
79
  @reject_message("Content blocked: Social Security Number patterns detected. SSNs must never be shared with AI services.")
78
80
  forbid (
79
81
  principal,
80
- action,
82
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
81
83
  resource
82
84
  )
83
85
  when {
@@ -88,13 +90,13 @@ when {
88
90
  // Block passport numbers
89
91
  @id("sentry-pii-block-passport")
90
92
  @name("Block passport numbers")
91
- @description("Block content containing passport number patterns. Passport numbers are government-issued identifiers with high identity theft risk.")
93
+ @description("Block messages and file uploads containing passport number patterns. Passport numbers are government-issued identifiers with high identity theft risk.")
92
94
  @severity("critical")
93
95
  @tags("passport,identity,privacy,gdpr")
94
96
  @reject_message("Content blocked: passport number patterns detected. Government-issued identifiers must not be shared with AI services.")
95
97
  forbid (
96
98
  principal,
97
- action,
99
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
98
100
  resource
99
101
  )
100
102
  when {
@@ -104,13 +106,13 @@ when {
104
106
  // Block IBAN (International Bank Account Numbers)
105
107
  @id("sentry-pii-block-iban")
106
108
  @name("Block bank account numbers")
107
- @description("Block content containing IBAN patterns. Bank account numbers are sensitive financial identifiers that must not be exposed to AI services.")
109
+ @description("Block messages and file uploads containing IBAN patterns. Bank account numbers are sensitive financial identifiers that must not be exposed to AI services.")
108
110
  @severity("critical")
109
111
  @tags("iban,financial,privacy,gdpr,pci-dss")
110
112
  @reject_message("Content blocked: bank account number (IBAN) patterns detected. Financial account numbers must not be shared with AI services.")
111
113
  forbid (
112
114
  principal,
113
- action,
115
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
114
116
  resource
115
117
  )
116
118
  when {
@@ -120,13 +122,13 @@ when {
120
122
  // Block bulk PII exposure
121
123
  @id("sentry-pii-block-bulk-exposure")
122
124
  @name("Block bulk PII exposure")
123
- @description("Block content containing 3 or more PII matches. Multiple PII items indicate a data dump — customer lists, CSV exports, or database content being leaked to AI services.")
125
+ @description("Block messages and file uploads containing 3 or more PII matches. Multiple PII items indicate a data dump — customer lists, CSV exports, or database content being leaked to AI services.")
124
126
  @severity("critical")
125
127
  @tags("pii,bulk,data-exfiltration,gdpr-art-32,ccpa")
126
128
  @reject_message("Content blocked: multiple PII items detected (3+). Bulk personal data must never be shared with AI services. Use data masking or tokenization.")
127
129
  forbid (
128
130
  principal,
129
- action,
131
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
130
132
  resource
131
133
  )
132
134
  when {
@@ -141,13 +143,13 @@ when {
141
143
  // Block high-confidence PII
142
144
  @id("sentry-pii-block-high-confidence")
143
145
  @name("Block high-confidence PII")
144
- @description("Block content when the PII confidence score exceeds threshold (80/100). Catches novel PII patterns including names, addresses, and identifiers that regex rules may miss.")
146
+ @description("Block messages and file uploads when the PII confidence score exceeds threshold (80/100). Catches novel PII patterns including names, addresses, and identifiers that regex rules may miss.")
145
147
  @severity("critical")
146
148
  @tags("pii,confidence,privacy,compliance,ml-classifier")
147
149
  @reject_message("Content blocked: the ML classifier detected personally identifiable information with high confidence. The content appears to contain personal data.")
148
150
  forbid (
149
151
  principal,
150
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
152
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
151
153
  resource
152
154
  )
153
155
  when {
@@ -162,36 +164,16 @@ when {
162
164
  // Block PII threat category
163
165
  @id("sentry-pii-block-threat-category")
164
166
  @name("Block PII threat category")
165
- @description("Block content when threat categorization identifies PII. Defense-in-depth behind the pii_detected boolean — catches cases where PII is flagged at the aggregation layer.")
167
+ @description("Block messages and file uploads when threat categorization identifies PII. Defense-in-depth behind the pii_detected boolean — catches cases where PII is flagged at the aggregation layer.")
166
168
  @severity("high")
167
169
  @tags("pii,privacy,data-protection,gdpr")
168
170
  @reject_message("Content blocked: threat scanners detected personally identifiable information. Remove all PII before submitting.")
169
171
  forbid (
170
172
  principal,
171
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
173
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
172
174
  resource
173
175
  )
174
176
  when {
175
177
  context has threat_categories && context.threat_categories.contains("pii")
176
178
  };
177
179
 
178
- // ---------------------------------------------------------------------------
179
- // Section 5: AI Response PII Blocking
180
- // Prevent AI responses containing PII from reaching the user.
181
- // ---------------------------------------------------------------------------
182
-
183
- // Block AI responses containing PII
184
- @id("sentry-pii-block-responses")
185
- @name("Block AI responses with PII")
186
- @description("Block AI responses when PII is detected in the output. Prevents AI services from exposing personal data in generated responses (e.g., when the model echoes back or generates PII from training data).")
187
- @severity("high")
188
- @tags("pii,response-safety,data-protection,owasp-llm06")
189
- @reject_message("AI response blocked: personally identifiable information detected in the AI response. The AI service generated content containing personal data.")
190
- forbid (
191
- principal,
192
- action == Sentry::Action::"receive_response",
193
- resource
194
- )
195
- when {
196
- context has pii_detected && context.pii_detected
197
- };