@highflame/policy 2.2.4 → 2.2.6

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 (24) hide show
  1. package/_schemas/ai_gateway/templates/defaults/pii.cedar +164 -0
  2. package/_schemas/ai_gateway/templates/defaults/pii_advanced.cedar +465 -0
  3. package/_schemas/ai_gateway/templates/defaults/pii_model.cedar +90 -0
  4. package/_schemas/ai_gateway/templates/secrets.cedar +46 -0
  5. package/_schemas/ai_gateway/templates/templates.json +88 -11
  6. package/_schemas/guardrails/templates/defaults/pii.cedar +137 -28
  7. package/_schemas/guardrails/templates/defaults/pii_model.cedar +90 -0
  8. package/_schemas/guardrails/templates/profiles/advanced_detection/pii.cedar +433 -31
  9. package/_schemas/guardrails/templates/templates.json +158 -43
  10. package/_schemas/sentry/templates/defaults/clipboard.cedar +3 -18
  11. package/_schemas/sentry/templates/defaults/file_safety.cedar +2 -17
  12. package/_schemas/sentry/templates/defaults/pii.cedar +102 -96
  13. package/_schemas/sentry/templates/defaults/pii_advanced.cedar +465 -0
  14. package/_schemas/sentry/templates/defaults/pii_model.cedar +90 -0
  15. package/_schemas/sentry/templates/templates.json +68 -11
  16. package/dist/ai_gateway-defaults.gen.d.ts +1 -1
  17. package/dist/ai_gateway-defaults.gen.js +838 -59
  18. package/dist/guardrails-defaults.gen.js +834 -226
  19. package/dist/overwatch-defaults.gen.js +703 -114
  20. package/dist/sentry-defaults.gen.js +746 -138
  21. package/package.json +1 -1
  22. package/_schemas/ai_gateway/templates/pii_redaction.cedar +0 -94
  23. package/_schemas/guardrails/templates/profiles/chat_assistant/privacy.cedar +0 -35
  24. package/_schemas/guardrails/templates/profiles/data_pipeline/privacy.cedar +0 -63
@@ -1,63 +1,465 @@
1
1
  // =============================================================================
2
- // Advanced Detection PII
2
+ // Comprehensive PII (Tier 3)
3
3
  // =============================================================================
4
- // Layered PII detection: bulk exposure threshold, ML classifier confidence,
5
- // and file-operation blocking. Goes beyond the boolean pii_detected flag.
4
+ // Blocks every PII entity type structural and contextual, sensitive and situational — one forbid rule per group so any individual type can be toggled off. High false-positive surface; opt-in.
6
5
  //
7
- // Context keys consumed:
8
- // - pii_count: Long
9
- // - pii_score: Long (0-100)
10
- // - pii_detected: Bool
6
+ // Sensitivity tiers and the structural (regex) / contextual (model) type
7
+ // vocabulary are defined canonically in schemas/_shared/pii_taxonomy.json and
8
+ // enforced by tools/lint-templates.
11
9
  //
12
- // Compliance:
13
- // - PCI DSS 3.4, GDPR Art. 32, HIPAA §164.312, CCPA §1798.150
14
- // - NIST 800-53 SI-4
10
+ // Context keys consumed:
11
+ // - pii_types: Set<String> (union of structural lowercase + contextual uppercase types)
15
12
  //
16
13
  // Category: privacy
17
14
  // Namespace: Guardrails
18
15
  // =============================================================================
19
16
 
20
- @id("privacy.advanced-block-pii-bulk")
21
- @name("Block bulk PII exposure")
22
- @description("Blocks process_prompt and call_tool when pii_count >= 3.")
17
+ @id("privacy.block-pii-national-id-all")
18
+ @name("Block national ID numbers (comprehensive)")
19
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a national ID (SSN, passport, or driver's license).")
20
+ @severity("high")
21
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
22
+ @reject_message("Content blocked: national identifier (SSN, passport, or driver's license) patterns detected.")
23
+ forbid (
24
+ principal,
25
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
26
+ resource
27
+ )
28
+ when {
29
+ context has pii_types &&
30
+ (
31
+ context.pii_types.contains("ssn") ||
32
+ context.pii_types.contains("passport") ||
33
+ context.pii_types.contains("national_id") ||
34
+ context.pii_types.contains("drivers_license") ||
35
+ context.pii_types.contains("NATIONAL_ID")
36
+ )
37
+ };
38
+
39
+ @id("privacy.block-pii-credit-card-all")
40
+ @name("Block credit card numbers (comprehensive)")
41
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a credit card number.")
23
42
  @severity("critical")
24
- @tags("category:privacy,threat:pii,threat:exfiltration,detection:aggregate,compliance:gdpr,compliance:pci-dss")
25
- @reject_message("Content blocked: 3+ PII items detected — bulk exposure indicates data dump or exfiltration.")
43
+ @tags("category:privacy,threat:pii,detection:pattern,compliance:pci-dss,owasp:llm06")
44
+ @reject_message("Content blocked: credit card number patterns detected.")
45
+ forbid (
46
+ principal,
47
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
48
+ resource
49
+ )
50
+ when {
51
+ context has pii_types &&
52
+ (
53
+ context.pii_types.contains("credit_card") ||
54
+ context.pii_types.contains("CREDIT_CARD")
55
+ )
56
+ };
57
+
58
+ @id("privacy.block-pii-bank-account-all")
59
+ @name("Block bank account numbers (comprehensive)")
60
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a bank account number (IBAN, SWIFT/BIC, or routing number).")
61
+ @severity("critical")
62
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
63
+ @reject_message("Content blocked: bank account (IBAN) number patterns detected.")
64
+ forbid (
65
+ principal,
66
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
67
+ resource
68
+ )
69
+ when {
70
+ context has pii_types &&
71
+ (
72
+ context.pii_types.contains("iban") ||
73
+ context.pii_types.contains("bank_account") ||
74
+ context.pii_types.contains("swift_bic") ||
75
+ context.pii_types.contains("aba_routing") ||
76
+ context.pii_types.contains("ACCOUNT_NUMBER")
77
+ )
78
+ };
79
+
80
+ @id("privacy.block-pii-medical-all")
81
+ @name("Block medical identifiers (comprehensive)")
82
+ @description("Blocks prompts, tool calls, and file reads/writes that contain medical data (record number, MBI, NPI, or blood type).")
83
+ @severity("medium")
84
+ @tags("category:privacy,threat:pii,detection:pattern,compliance:hipaa,owasp:llm06")
85
+ @reject_message("Content blocked: medical record identifier patterns detected.")
86
+ forbid (
87
+ principal,
88
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
89
+ resource
90
+ )
91
+ when {
92
+ context has pii_types &&
93
+ (
94
+ context.pii_types.contains("medical_record") ||
95
+ context.pii_types.contains("patient_record") ||
96
+ context.pii_types.contains("medicare_beneficiary_id") ||
97
+ context.pii_types.contains("npi") ||
98
+ context.pii_types.contains("medical_term") ||
99
+ context.pii_types.contains("blood_type") ||
100
+ context.pii_types.contains("MEDICAL")
101
+ )
102
+ };
103
+
104
+ @id("privacy.block-pii-tax-id-all")
105
+ @name("Block tax identifiers (comprehensive)")
106
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a tax ID (ITIN, EIN, or PTIN).")
107
+ @severity("high")
108
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
109
+ @reject_message("Content blocked: tax identifier (ITIN or EIN) patterns detected.")
26
110
  forbid (
27
111
  principal,
28
- action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool"],
112
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
29
113
  resource
30
114
  )
31
115
  when {
32
- context has pii_count && context.pii_count >= 3
116
+ context has pii_types &&
117
+ (
118
+ context.pii_types.contains("itin") ||
119
+ context.pii_types.contains("ein") ||
120
+ context.pii_types.contains("ptin")
121
+ )
33
122
  };
34
123
 
35
- @id("privacy.advanced-block-pii-ml")
36
- @name("Block high-confidence PII (ML)")
37
- @description("Blocks process_prompt and call_tool when pii_score >= 80.")
124
+ @id("privacy.block-pii-credential-all")
125
+ @name("Block credentials (comprehensive)")
126
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a credential or secret (API key, token, password hash, or private key).")
38
127
  @severity("critical")
39
- @tags("category:privacy,threat:pii,detection:ml,compliance:gdpr,compliance:hipaa")
40
- @reject_message("Content blocked: the ML classifier detected personally identifiable information with high confidence.")
128
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
129
+ @reject_message("Content blocked: credential or API key patterns detected.")
130
+ forbid (
131
+ principal,
132
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
133
+ resource
134
+ )
135
+ when {
136
+ context has pii_types &&
137
+ (
138
+ context.pii_types.contains("aws_access_key") ||
139
+ context.pii_types.contains("api_key") ||
140
+ context.pii_types.contains("jwt_token") ||
141
+ context.pii_types.contains("encryption_key") ||
142
+ context.pii_types.contains("http_basic_auth") ||
143
+ context.pii_types.contains("gcp_credential") ||
144
+ context.pii_types.contains("gcp_api_key") ||
145
+ context.pii_types.contains("gcp_signed_policy") ||
146
+ context.pii_types.contains("session_cookie") ||
147
+ context.pii_types.contains("oauth_token") ||
148
+ context.pii_types.contains("tls_certificate") ||
149
+ context.pii_types.contains("password_hash") ||
150
+ context.pii_types.contains("csrf_token") ||
151
+ context.pii_types.contains("CREDENTIAL")
152
+ )
153
+ };
154
+
155
+ @id("privacy.block-pii-crypto-all")
156
+ @name("Block cryptocurrency addresses (comprehensive)")
157
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a cryptocurrency wallet address.")
158
+ @severity("high")
159
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
160
+ @reject_message("Content blocked: cryptocurrency wallet address patterns detected.")
161
+ forbid (
162
+ principal,
163
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
164
+ resource
165
+ )
166
+ when {
167
+ context has pii_types &&
168
+ (
169
+ context.pii_types.contains("bitcoin_address") ||
170
+ context.pii_types.contains("ethereum_address")
171
+ )
172
+ };
173
+
174
+ @id("privacy.block-pii-names-all")
175
+ @name("Block personal names (comprehensive)")
176
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a personal name.")
177
+ @severity("low")
178
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
179
+ @reject_message("Content blocked: personal name patterns detected.")
180
+ forbid (
181
+ principal,
182
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
183
+ resource
184
+ )
185
+ when {
186
+ context has pii_types &&
187
+ (
188
+ context.pii_types.contains("person_name") ||
189
+ context.pii_types.contains("PERSON")
190
+ )
191
+ };
192
+
193
+ @id("privacy.block-pii-email-all")
194
+ @name("Block email addresses (comprehensive)")
195
+ @description("Blocks prompts, tool calls, and file reads/writes that contain an email address.")
196
+ @severity("medium")
197
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
198
+ @reject_message("Content blocked: email address patterns detected.")
199
+ forbid (
200
+ principal,
201
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
202
+ resource
203
+ )
204
+ when {
205
+ context has pii_types &&
206
+ (
207
+ context.pii_types.contains("email") ||
208
+ context.pii_types.contains("EMAIL_ADDRESS")
209
+ )
210
+ };
211
+
212
+ @id("privacy.block-pii-phone-all")
213
+ @name("Block phone numbers (comprehensive)")
214
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a phone number.")
215
+ @severity("medium")
216
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
217
+ @reject_message("Content blocked: phone number patterns detected.")
218
+ forbid (
219
+ principal,
220
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
221
+ resource
222
+ )
223
+ when {
224
+ context has pii_types &&
225
+ (
226
+ context.pii_types.contains("phone") ||
227
+ context.pii_types.contains("PHONE_NUMBER")
228
+ )
229
+ };
230
+
231
+ @id("privacy.block-pii-datetime-all")
232
+ @name("Block dates and times (comprehensive)")
233
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a date or time (date of birth, timestamp, or card expiry).")
234
+ @severity("medium")
235
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
236
+ @reject_message("Content blocked: date or time patterns detected.")
237
+ forbid (
238
+ principal,
239
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
240
+ resource
241
+ )
242
+ when {
243
+ context has pii_types &&
244
+ (
245
+ context.pii_types.contains("date_of_birth") ||
246
+ context.pii_types.contains("date_time") ||
247
+ context.pii_types.contains("time") ||
248
+ context.pii_types.contains("card_expiry") ||
249
+ context.pii_types.contains("DATE_TIME")
250
+ )
251
+ };
252
+
253
+ @id("privacy.block-pii-url-all")
254
+ @name("Block URLs (comprehensive)")
255
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a URL.")
256
+ @severity("low")
257
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
258
+ @reject_message("Content blocked: URL patterns detected.")
259
+ forbid (
260
+ principal,
261
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
262
+ resource
263
+ )
264
+ when {
265
+ context has pii_types &&
266
+ (
267
+ context.pii_types.contains("url") ||
268
+ context.pii_types.contains("URL")
269
+ )
270
+ };
271
+
272
+ @id("privacy.block-pii-location-all")
273
+ @name("Block locations (comprehensive)")
274
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a location (street address, postal code, or military address).")
275
+ @severity("low")
276
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
277
+ @reject_message("Content blocked: street address or location patterns detected.")
278
+ forbid (
279
+ principal,
280
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
281
+ resource
282
+ )
283
+ when {
284
+ context has pii_types &&
285
+ (
286
+ context.pii_types.contains("street_address") ||
287
+ context.pii_types.contains("zip_code") ||
288
+ context.pii_types.contains("military_address") ||
289
+ context.pii_types.contains("LOCATION")
290
+ )
291
+ };
292
+
293
+ @id("privacy.block-pii-organization-all")
294
+ @name("Block organization names (comprehensive)")
295
+ @description("Blocks prompts, tool calls, and file reads/writes that contain an organization name.")
296
+ @severity("low")
297
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
298
+ @reject_message("Content blocked: organization name patterns detected.")
299
+ forbid (
300
+ principal,
301
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
302
+ resource
303
+ )
304
+ when {
305
+ context has pii_types &&
306
+ (
307
+ context.pii_types.contains("organization") ||
308
+ context.pii_types.contains("ORGANIZATION")
309
+ )
310
+ };
311
+
312
+ @id("privacy.block-pii-occupation-all")
313
+ @name("Block occupations (comprehensive)")
314
+ @description("Blocks prompts, tool calls, and file reads/writes that contain an occupation.")
315
+ @severity("low")
316
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
317
+ @reject_message("Content blocked: occupation patterns detected.")
318
+ forbid (
319
+ principal,
320
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
321
+ resource
322
+ )
323
+ when {
324
+ context has pii_types &&
325
+ (
326
+ context.pii_types.contains("occupation") ||
327
+ context.pii_types.contains("OCCUPATION")
328
+ )
329
+ };
330
+
331
+ @id("privacy.block-pii-username-all")
332
+ @name("Block usernames (comprehensive)")
333
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a username.")
334
+ @severity("low")
335
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
336
+ @reject_message("Content blocked: username patterns detected.")
337
+ forbid (
338
+ principal,
339
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
340
+ resource
341
+ )
342
+ when {
343
+ context has pii_types &&
344
+ (
345
+ context.pii_types.contains("username") ||
346
+ context.pii_types.contains("USERNAME")
347
+ )
348
+ };
349
+
350
+ @id("privacy.block-pii-employee-customer-id-all")
351
+ @name("Block employee or customer IDs (comprehensive)")
352
+ @description("Blocks prompts, tool calls, and file reads/writes that contain an employee or customer ID.")
353
+ @severity("medium")
354
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
355
+ @reject_message("Content blocked: employee or customer identifier patterns detected.")
356
+ forbid (
357
+ principal,
358
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
359
+ resource
360
+ )
361
+ when {
362
+ context has pii_types &&
363
+ (
364
+ context.pii_types.contains("employee_id") ||
365
+ context.pii_types.contains("customer_id") ||
366
+ context.pii_types.contains("EMPLOYEE_ID") ||
367
+ context.pii_types.contains("CUSTOMER_ID")
368
+ )
369
+ };
370
+
371
+ @id("privacy.block-pii-device-id-all")
372
+ @name("Block device and network identifiers (comprehensive)")
373
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a device or network identifier (IP, MAC, IMEI, or UUID).")
374
+ @severity("medium")
375
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
376
+ @reject_message("Content blocked: device or network identifier patterns detected.")
377
+ forbid (
378
+ principal,
379
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
380
+ resource
381
+ )
382
+ when {
383
+ context has pii_types &&
384
+ (
385
+ context.pii_types.contains("device_id") ||
386
+ context.pii_types.contains("ip_address") ||
387
+ context.pii_types.contains("ipv6_address") ||
388
+ context.pii_types.contains("imei") ||
389
+ context.pii_types.contains("device_serial") ||
390
+ context.pii_types.contains("mac_address") ||
391
+ context.pii_types.contains("user_agent") ||
392
+ context.pii_types.contains("serial_number") ||
393
+ context.pii_types.contains("uuid") ||
394
+ context.pii_types.contains("DEVICE_ID")
395
+ )
396
+ };
397
+
398
+ @id("privacy.block-pii-vehicle-all")
399
+ @name("Block vehicle identifiers (comprehensive)")
400
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a vehicle identifier (VIN or license plate).")
401
+ @severity("medium")
402
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
403
+ @reject_message("Content blocked: vehicle identifier (VIN or plate) patterns detected.")
404
+ forbid (
405
+ principal,
406
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
407
+ resource
408
+ )
409
+ when {
410
+ context has pii_types &&
411
+ (
412
+ context.pii_types.contains("vin") ||
413
+ context.pii_types.contains("license_plate") ||
414
+ context.pii_types.contains("VEHICLE_IDENTIFIER")
415
+ )
416
+ };
417
+
418
+ @id("privacy.block-pii-financial-all")
419
+ @name("Block financial amounts (comprehensive)")
420
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a financial amount or transaction ID.")
421
+ @severity("medium")
422
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
423
+ @reject_message("Content blocked: salary or financial amount patterns detected.")
41
424
  forbid (
42
425
  principal,
43
- action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool"],
426
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
44
427
  resource
45
428
  )
46
429
  when {
47
- context has pii_score && context.pii_score >= 80
430
+ context has pii_types &&
431
+ (
432
+ context.pii_types.contains("salary") ||
433
+ context.pii_types.contains("financial_amount") ||
434
+ context.pii_types.contains("transaction_id") ||
435
+ context.pii_types.contains("FINANCIAL")
436
+ )
48
437
  };
49
438
 
50
- @id("privacy.advanced-block-pii-file-ops")
51
- @name("Block PII in file operations")
52
- @description("Blocks read_file and write_file when pii_detected is true.")
439
+ @id("privacy.block-pii-sensitive-attribute-all")
440
+ @name("Block sensitive attributes (comprehensive)")
441
+ @description("Blocks prompts, tool calls, and file reads/writes that contain a sensitive personal attribute (ethnicity, religion, age, etc.).")
53
442
  @severity("high")
54
- @tags("category:privacy,threat:pii,detection:rule,compliance:gdpr")
55
- @reject_message("File operation blocked: personally identifiable information detected in file content.")
443
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
444
+ @reject_message("Content blocked: sensitive attribute (ethnicity, religion, etc.) patterns detected.")
56
445
  forbid (
57
446
  principal,
58
- action in [Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
447
+ action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool", Guardrails::Action::"read_file", Guardrails::Action::"write_file"],
59
448
  resource
60
449
  )
61
450
  when {
62
- context has pii_detected && context.pii_detected == true
451
+ context has pii_types &&
452
+ (
453
+ context.pii_types.contains("ethnicity") ||
454
+ context.pii_types.contains("religion") ||
455
+ context.pii_types.contains("sexual_orientation") ||
456
+ context.pii_types.contains("political_affiliation") ||
457
+ context.pii_types.contains("nationality") ||
458
+ context.pii_types.contains("age") ||
459
+ context.pii_types.contains("gender") ||
460
+ context.pii_types.contains("marital_status") ||
461
+ context.pii_types.contains("education_level") ||
462
+ context.pii_types.contains("employment_status") ||
463
+ context.pii_types.contains("SENSITIVE_ATTRIBUTE")
464
+ )
63
465
  };