@highflame/policy 2.2.3 → 2.2.5

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 (27) 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/ai_gateway-detectors.gen.js +18 -4
  19. package/dist/guardrails-defaults.gen.js +834 -226
  20. package/dist/overwatch-defaults.gen.js +703 -114
  21. package/dist/overwatch-detectors.gen.js +31 -1
  22. package/dist/sentry-defaults.gen.js +746 -138
  23. package/dist/sentry-detectors.gen.js +109 -2
  24. package/package.json +1 -1
  25. package/_schemas/ai_gateway/templates/pii_redaction.cedar +0 -94
  26. package/_schemas/guardrails/templates/profiles/chat_assistant/privacy.cedar +0 -35
  27. package/_schemas/guardrails/templates/profiles/data_pipeline/privacy.cedar +0 -63
@@ -0,0 +1,465 @@
1
+ // =============================================================================
2
+ // Comprehensive PII (Tier 3)
3
+ // =============================================================================
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.
5
+ //
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.
9
+ //
10
+ // Context keys consumed:
11
+ // - pii_types: Set<String> (union of structural lowercase + contextual uppercase types)
12
+ //
13
+ // Category: privacy
14
+ // Namespace: Sentry
15
+ // =============================================================================
16
+
17
+ @id("privacy.block-pii-national-id-all")
18
+ @name("Block national ID numbers (comprehensive)")
19
+ @description("Blocks prompts, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads that contain a credit card number.")
42
+ @severity("critical")
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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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.")
110
+ forbid (
111
+ principal,
112
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
113
+ resource
114
+ )
115
+ when {
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
+ )
122
+ };
123
+
124
+ @id("privacy.block-pii-credential-all")
125
+ @name("Block credentials (comprehensive)")
126
+ @description("Blocks prompts, pastes, and file uploads that contain a credential or secret (API key, token, password hash, or private key).")
127
+ @severity("critical")
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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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 [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_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, pastes, and file uploads 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.")
424
+ forbid (
425
+ principal,
426
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
427
+ resource
428
+ )
429
+ when {
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
+ )
437
+ };
438
+
439
+ @id("privacy.block-pii-sensitive-attribute-all")
440
+ @name("Block sensitive attributes (comprehensive)")
441
+ @description("Blocks prompts, pastes, and file uploads that contain a sensitive personal attribute (ethnicity, religion, age, etc.).")
442
+ @severity("high")
443
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
444
+ @reject_message("Content blocked: sensitive attribute (ethnicity, religion, etc.) patterns detected.")
445
+ forbid (
446
+ principal,
447
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
448
+ resource
449
+ )
450
+ when {
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
+ )
465
+ };
@@ -0,0 +1,90 @@
1
+ // =============================================================================
2
+ // Contextual PII (Tier 2)
3
+ // =============================================================================
4
+ // Blocks the same high-sensitivity identifier groups inferred from surrounding context by the ML PII model — catches unstructured or novel PII the structural patterns miss (higher recall). Requires the pii_model detector.
5
+ //
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.
9
+ //
10
+ // Context keys consumed:
11
+ // - pii_types: Set<String> (union of structural lowercase + contextual uppercase types)
12
+ //
13
+ // Category: privacy
14
+ // Namespace: Sentry
15
+ // =============================================================================
16
+
17
+ @id("privacy.block-pii-national-id-model")
18
+ @name("Block national ID numbers (contextual)")
19
+ @description("Blocks prompts, pastes, and file uploads that contain a national ID (SSN, passport, or driver's license).")
20
+ @severity("high")
21
+ @tags("category:privacy,threat:pii,detection:ml,owasp:llm06")
22
+ @reject_message("Content blocked: national identifier (SSN, passport, or driver's license) patterns detected.")
23
+ forbid (
24
+ principal,
25
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
26
+ resource
27
+ )
28
+ when {
29
+ context has pii_types && context.pii_types.contains("NATIONAL_ID")
30
+ };
31
+
32
+ @id("privacy.block-pii-credit-card-model")
33
+ @name("Block credit card numbers (contextual)")
34
+ @description("Blocks prompts, pastes, and file uploads that contain a credit card number.")
35
+ @severity("critical")
36
+ @tags("category:privacy,threat:pii,detection:ml,compliance:pci-dss,owasp:llm06")
37
+ @reject_message("Content blocked: credit card number patterns detected.")
38
+ forbid (
39
+ principal,
40
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
41
+ resource
42
+ )
43
+ when {
44
+ context has pii_types && context.pii_types.contains("CREDIT_CARD")
45
+ };
46
+
47
+ @id("privacy.block-pii-bank-account-model")
48
+ @name("Block bank account numbers (contextual)")
49
+ @description("Blocks prompts, pastes, and file uploads that contain a bank account number (IBAN, SWIFT/BIC, or routing number).")
50
+ @severity("critical")
51
+ @tags("category:privacy,threat:pii,detection:ml,owasp:llm06")
52
+ @reject_message("Content blocked: bank account (IBAN) number patterns detected.")
53
+ forbid (
54
+ principal,
55
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
56
+ resource
57
+ )
58
+ when {
59
+ context has pii_types && context.pii_types.contains("ACCOUNT_NUMBER")
60
+ };
61
+
62
+ @id("privacy.block-pii-medical-model")
63
+ @name("Block medical identifiers (contextual)")
64
+ @description("Blocks prompts, pastes, and file uploads that contain medical data (record number, MBI, NPI, or blood type).")
65
+ @severity("medium")
66
+ @tags("category:privacy,threat:pii,detection:ml,compliance:hipaa,owasp:llm06")
67
+ @reject_message("Content blocked: medical record identifier patterns detected.")
68
+ forbid (
69
+ principal,
70
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
71
+ resource
72
+ )
73
+ when {
74
+ context has pii_types && context.pii_types.contains("MEDICAL")
75
+ };
76
+
77
+ @id("privacy.block-pii-credential-model")
78
+ @name("Block credentials (contextual)")
79
+ @description("Blocks prompts, pastes, and file uploads that contain a credential or secret (API key, token, password hash, or private key).")
80
+ @severity("critical")
81
+ @tags("category:privacy,threat:pii,detection:ml,owasp:llm06")
82
+ @reject_message("Content blocked: credential or API key patterns detected.")
83
+ forbid (
84
+ principal,
85
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
86
+ resource
87
+ )
88
+ when {
89
+ context has pii_types && context.pii_types.contains("CREDENTIAL")
90
+ };
@@ -69,7 +69,13 @@
69
69
  "category": "semantic",
70
70
  "file": "defaults/semantic.cedar",
71
71
  "severity": "critical",
72
- "tags": ["category:semantic", "threat:injection", "threat:jailbreak", "owasp:llm01", "owasp:llm02"]
72
+ "tags": [
73
+ "category:semantic",
74
+ "threat:injection",
75
+ "threat:jailbreak",
76
+ "owasp:llm01",
77
+ "owasp:llm02"
78
+ ]
73
79
  },
74
80
  {
75
81
  "id": "trust-safety.defaults",
@@ -78,7 +84,13 @@
78
84
  "category": "trust-safety",
79
85
  "file": "defaults/content_safety.cedar",
80
86
  "severity": "critical",
81
- "tags": ["category:trust-safety", "threat:harmful", "threat:hate-speech", "compliance:eu-ai-act", "compliance:iso-42001"]
87
+ "tags": [
88
+ "category:trust-safety",
89
+ "threat:harmful",
90
+ "threat:hate-speech",
91
+ "compliance:eu-ai-act",
92
+ "compliance:iso-42001"
93
+ ]
82
94
  },
83
95
  {
84
96
  "id": "data-protection.defaults",
@@ -91,30 +103,71 @@
91
103
  },
92
104
  {
93
105
  "id": "privacy.defaults",
94
- "name": "PII Detection",
95
- "description": "Block credit card numbers, SSNs, passport/IBAN, and other PII across messages and file uploads.",
106
+ "name": "Structural PII",
107
+ "description": "Block well-formatted sensitive identifiers — SSNs, credit cards, IBANs, API keys — via fast deterministic pattern matching. High precision, low latency, few false positives; use as the always-on baseline.",
96
108
  "category": "privacy",
97
109
  "file": "defaults/pii.cedar",
98
110
  "severity": "critical",
99
- "tags": ["category:privacy", "threat:pii", "compliance:pci-dss", "compliance:gdpr", "compliance:hipaa"]
111
+ "tags": [
112
+ "category:privacy",
113
+ "threat:pii",
114
+ "detection:pattern",
115
+ "compliance:pci-dss",
116
+ "compliance:hipaa"
117
+ ]
118
+ },
119
+ {
120
+ "id": "privacy.pii-model",
121
+ "name": "Contextual PII",
122
+ "description": "Block the same sensitive identifiers when the ML model infers them from surrounding context — catches unstructured or novel PII the structural patterns miss. Higher recall; requires the pii_model detector.",
123
+ "category": "privacy",
124
+ "file": "defaults/pii_model.cedar",
125
+ "severity": "critical",
126
+ "tags": [
127
+ "category:privacy",
128
+ "threat:pii",
129
+ "detection:ml",
130
+ "compliance:pci-dss",
131
+ "compliance:hipaa"
132
+ ]
133
+ },
134
+ {
135
+ "id": "privacy.advanced-pii",
136
+ "name": "Comprehensive PII",
137
+ "description": "Block every PII type — structural and contextual, sensitive and situational. Situational entities (names, locations, dates, etc.) are real PII but appear in ordinary text, so this tier flags often; one forbid rule per entity lets you disable the ones you don't need. Opt-in for strict environments.",
138
+ "category": "privacy",
139
+ "file": "defaults/pii_advanced.cedar",
140
+ "severity": "critical",
141
+ "tags": [
142
+ "category:privacy",
143
+ "threat:pii",
144
+ "detection:pattern",
145
+ "compliance:pci-dss",
146
+ "compliance:hipaa"
147
+ ]
100
148
  },
101
149
  {
102
- "id": "file-safety.defaults",
150
+ "id": "file-safety.block-upload-secrets",
103
151
  "name": "File & Attachment Safety",
104
- "description": "Block file uploads containing secrets or PII in document content.",
152
+ "description": "Block file uploads containing secrets in document content.",
105
153
  "category": "file-safety",
106
154
  "file": "defaults/file_safety.cedar",
107
155
  "severity": "critical",
108
- "tags": ["category:file-safety", "threat:secrets", "threat:pii"]
156
+ "tags": ["category:file-safety", "threat:secrets"]
109
157
  },
110
158
  {
111
159
  "id": "clipboard.defaults",
112
160
  "name": "Clipboard Policy",
113
- "description": "Block all-paste, paste-with-secrets, paste-with-PII, encoded payload pastes, and pastes with invisible characters.",
161
+ "description": "Block all-paste, paste-with-secrets, encoded payload pastes, and pastes with invisible characters. PII pastes are handled by the privacy.* templates.",
114
162
  "category": "clipboard",
115
163
  "file": "defaults/clipboard.cedar",
116
164
  "severity": "critical",
117
- "tags": ["category:clipboard", "threat:secrets", "threat:pii", "threat:encoded-payload", "threat:invisible-chars"]
165
+ "tags": [
166
+ "category:clipboard",
167
+ "threat:secrets",
168
+ "threat:encoded-payload",
169
+ "threat:invisible-chars"
170
+ ]
118
171
  },
119
172
  {
120
173
  "id": "organization.block-session-threat-escalation",
@@ -123,7 +176,11 @@
123
176
  "category": "organization",
124
177
  "file": "defaults/organization.cedar",
125
178
  "severity": "high",
126
- "tags": ["category:organization", "detection:aggregate", "posture:catch-all"]
179
+ "tags": [
180
+ "category:organization",
181
+ "detection:aggregate",
182
+ "posture:catch-all"
183
+ ]
127
184
  }
128
185
  ]
129
186
  }
@@ -2,7 +2,7 @@
2
2
  * AiGateway policy category identifiers.
3
3
  * Maps to UI tab names in Studio.
4
4
  */
5
- export type AiGatewayCategory = 'semantic' | 'tools' | 'agent-security' | 'data-protection' | 'organization';
5
+ export type AiGatewayCategory = 'semantic' | 'tools' | 'agent-security' | 'data-protection' | 'privacy' | 'organization';
6
6
  /**
7
7
  * Category metadata for UI display.
8
8
  */