@highflame/policy 2.1.32 → 2.1.34

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.
@@ -36,7 +36,8 @@ const SENTRY_SENTRY_SEMANTIC_DEFAULT_CEDAR = `// ===============================
36
36
  // Semantic Threat Detection Policy (Default)
37
37
  // =============================================================================
38
38
  // Detects and blocks prompt injection, jailbreak attempts, and high-severity
39
- // threats across all browser AI interactions: messages, paste, file uploads.
39
+ // threats across browser AI interactions: messages and file uploads.
40
+ // Paste-targeted semantic rules live in clipboard.cedar.
40
41
  //
41
42
  // Uses multi-layered detection from Shield:
42
43
  // 1. ML classifier scores (injection_score, jailbreak_score)
@@ -56,20 +57,20 @@ const SENTRY_SENTRY_SEMANTIC_DEFAULT_CEDAR = `// ===============================
56
57
 
57
58
  // ---------------------------------------------------------------------------
58
59
  // Section 1: Prompt Injection Detection
59
- // Blocks injection attempts in messages, pasted content, and uploaded files.
60
- // Users may inadvertently paste injection payloads from compromised sources.
60
+ // Blocks injection attempts in messages and uploaded files.
61
+ // Paste-targeted injection rules live in clipboard.cedar.
61
62
  // ---------------------------------------------------------------------------
62
63
 
63
- // Block messages and pastes with prompt injection patterns
64
+ // Block messages with prompt injection patterns
64
65
  @id("sentry-semantic-block-injection")
65
66
  @name("Block prompt injection")
66
- @description("Block messages and pasted content when detection engine rules identify prompt injection patterns. Catches instruction override, role assumption, and manipulation techniques in user input and pasted content (OWASP LLM01).")
67
+ @description("Block messages when detection engine rules identify prompt injection patterns. Catches instruction override, role assumption, and manipulation techniques in user input (OWASP LLM01).")
67
68
  @severity("critical")
68
69
  @tags("injection,security,owasp-llm01,mitre-aml-t0051,baseline")
69
- @reject_message("Content was blocked because prompt injection patterns were detected. This prevents manipulation of AI agent behavior. Remove adversarial instructions and try again.")
70
+ @reject_message("Content blocked: prompt injection patterns were detected. This prevents manipulation of AI agent behavior. Remove adversarial instructions and try again.")
70
71
  forbid (
71
72
  principal,
72
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
73
+ action == Sentry::Action::"process_prompt",
73
74
  resource
74
75
  )
75
76
  when {
@@ -82,32 +83,16 @@ when {
82
83
  @description("Block content when the ML injection classifier confidence exceeds threshold (75/100). Catches novel injection techniques including polymorphic payloads, encoding tricks, and obfuscated instructions.")
83
84
  @severity("critical")
84
85
  @tags("injection,ml-classifier,security,owasp-llm01")
85
- @reject_message("Your content was blocked because the ML classifier detected prompt injection with high confidence.")
86
+ @reject_message("Content blocked: the ML classifier detected prompt injection with high confidence.")
86
87
  forbid (
87
88
  principal,
88
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
89
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
89
90
  resource
90
91
  )
91
92
  when {
92
93
  context has injection_score && context.injection_score >= 75
93
94
  };
94
95
 
95
- // Block injection payloads hidden in uploaded documents
96
- @id("sentry-semantic-block-file-injection")
97
- @name("Block injection in uploaded files")
98
- @description("Block file uploads when prompt injection patterns are detected in the document content. Attackers embed injection payloads in PDFs, documents, and spreadsheets to hijack AI behavior via RAG or file analysis.")
99
- @severity("critical")
100
- @tags("injection,file-upload,security,owasp-llm01")
101
- @reject_message("File upload was blocked because prompt injection patterns were detected in the document. Files containing adversarial instructions cannot be shared with AI services.")
102
- forbid (
103
- principal,
104
- action == Sentry::Action::"upload_file",
105
- resource
106
- )
107
- when {
108
- context has detected_threats && context.detected_threats.contains("prompt_injection")
109
- };
110
-
111
96
  // ---------------------------------------------------------------------------
112
97
  // Section 2: Jailbreak Detection
113
98
  // Blocks jailbreak attempts in messages sent to AI services.
@@ -119,10 +104,10 @@ when {
119
104
  @description("Block messages when detection engine rules identify jailbreak patterns: DAN-style prompts, role-play exploits, safety bypass instructions, and constraint removal attempts (OWASP LLM02).")
120
105
  @severity("critical")
121
106
  @tags("jailbreak,bypass,security,owasp-llm02,mitre-aml-t0054,baseline")
122
- @reject_message("Your message was blocked because jailbreak patterns were detected. This prevents circumvention of AI safety controls.")
107
+ @reject_message("Content blocked: jailbreak patterns were detected. This prevents circumvention of AI safety controls.")
123
108
  forbid (
124
109
  principal,
125
- action == Sentry::Action::"send_message",
110
+ action == Sentry::Action::"process_prompt",
126
111
  resource
127
112
  )
128
113
  when {
@@ -135,10 +120,10 @@ when {
135
120
  @description("Block content when the ML jailbreak classifier exceeds threshold (75/100). Catches sophisticated jailbreak techniques including multi-turn manipulation and encoded payloads.")
136
121
  @severity("critical")
137
122
  @tags("jailbreak,ml-classifier,security,owasp-llm02")
138
- @reject_message("Your content was blocked because the ML classifier detected a jailbreak attempt with high confidence.")
123
+ @reject_message("Content blocked: the ML classifier detected a jailbreak attempt with high confidence.")
139
124
  forbid (
140
125
  principal,
141
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
126
+ action == Sentry::Action::"process_prompt",
142
127
  resource
143
128
  )
144
129
  when {
@@ -153,59 +138,28 @@ when {
153
138
  // Block any content with critical severity threats
154
139
  @id("sentry-semantic-block-critical")
155
140
  @name("Block critical threats")
156
- @description("Block all content when any detection engine reports critical severity. This is the ultimate catch-all for critical-severity threats regardless of type or source.")
141
+ @description("Block messages and file uploads when any detection engine reports critical severity. This is the ultimate catch-all for critical-severity threats regardless of type or source.")
157
142
  @severity("critical")
158
143
  @tags("critical,baseline,security,catch-all")
159
- @reject_message("Your content was blocked because security scanners detected a critical-severity threat. This content cannot be processed by AI services.")
144
+ @reject_message("Content blocked: security scanners detected a critical-severity threat. This content cannot be processed by AI services.")
160
145
  forbid (
161
146
  principal,
162
- action,
147
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
163
148
  resource
164
149
  )
165
150
  when {
166
151
  context has highest_severity && context.highest_severity == "critical"
167
152
  };
168
153
 
169
- // Block messages with high severity semantic threats
170
- @id("sentry-semantic-block-high-severity")
171
- @name("Block high severity threats")
172
- @description("Block messages when threat detection reports high severity (>= 3) in semantic categories. Catches threats that individually are below critical but collectively indicate adversarial intent.")
173
- @severity("high")
174
- @tags("semantic,severity,security,defense-in-depth")
175
- @reject_message("Your message was blocked because security scanners detected high severity issues. Review your content for manipulative or adversarial patterns.")
176
- forbid (
177
- principal,
178
- action == Sentry::Action::"send_message",
179
- resource
180
- )
181
- when {
182
- context has threat_categories && context has max_threat_severity &&
183
- context.threat_categories.contains("injection") &&
184
- context.max_threat_severity >= 3
185
- };
186
-
187
- // Block content with multiple concurrent threats
188
- @id("sentry-semantic-block-multi-threat")
189
- @name("Block multi-threat content")
190
- @description("Block content when multiple distinct threats are detected simultaneously (3+). Multiple concurrent threats strongly indicate an adversarial attack chain or compromised content.")
191
- @severity("high")
192
- @tags("multi-threat,security,defense-in-depth")
193
- @reject_message("Content was blocked because multiple security threats were detected simultaneously. This pattern indicates potentially adversarial content.")
194
- forbid (
195
- principal,
196
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
197
- resource
198
- )
199
- when {
200
- context has threat_count && context.threat_count >= 3
201
- };
202
154
  `;
203
155
  const SENTRY_SENTRY_CONTENT_SAFETY_DEFAULT_CEDAR = `// =============================================================================
204
156
  // Content Safety Policy (Default)
205
157
  // =============================================================================
206
158
  // Detects and blocks violent, harmful, hateful, sexual, and profane content
207
- // in AI chat interactions. Includes cut-and-paste safety rules to prevent
208
- // unsafe content from being transferred into AI services.
159
+ // in AI chat interactions across messages and file uploads.
160
+ //
161
+ // Paste-specific content safety rules live in clipboard.cedar — see
162
+ // "Clipboard Policy".
209
163
  //
210
164
  // The detection engine runs ML classifiers (toxicity, content safety) and
211
165
  // produces normalized scores (0-100) for each category.
@@ -223,19 +177,19 @@ const SENTRY_SENTRY_CONTENT_SAFETY_DEFAULT_CEDAR = `// =========================
223
177
  // ---------------------------------------------------------------------------
224
178
  // Section 1: Violence & Weapons
225
179
  // Blocks content promoting, describing, or instructing violence and weapons.
226
- // Applies to messages, paste, and file uploads.
180
+ // Applies to messages and file uploads.
227
181
  // ---------------------------------------------------------------------------
228
182
 
229
183
  // Block violent content across all input channels
230
184
  @id("sentry-cs-block-violence")
231
185
  @name("Block violent content")
232
- @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.")
186
+ @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.")
233
187
  @severity("critical")
234
188
  @tags("violence,content-safety,trust-safety,nist-si-4,iso-42001")
235
189
  @reject_message("Content blocked: violent content detected. AI services must not process violent content in enterprise environments. Please rephrase without violence-related language.")
236
190
  forbid (
237
191
  principal,
238
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
192
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
239
193
  resource
240
194
  )
241
195
  when {
@@ -251,7 +205,7 @@ when {
251
205
  @reject_message("Content blocked: weapons-related content detected. AI services must not process weapons manufacturing, procurement, or specification content.")
252
206
  forbid (
253
207
  principal,
254
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
208
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
255
209
  resource
256
210
  )
257
211
  when {
@@ -272,7 +226,7 @@ when {
272
226
  @reject_message("Content blocked: hate speech or discriminatory content detected. AI services must not process hateful, discriminatory, or dehumanizing content.")
273
227
  forbid (
274
228
  principal,
275
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
229
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
276
230
  resource
277
231
  )
278
232
  when {
@@ -292,7 +246,7 @@ when {
292
246
  @reject_message("Content blocked: criminal activity content detected. AI services must not process content related to illegal activities or fraud.")
293
247
  forbid (
294
248
  principal,
295
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
249
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
296
250
  resource
297
251
  )
298
252
  when {
@@ -312,7 +266,7 @@ when {
312
266
  @reject_message("Content blocked: sexual content detected. AI services must not process sexually explicit material in enterprise environments.")
313
267
  forbid (
314
268
  principal,
315
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
269
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
316
270
  resource
317
271
  )
318
272
  when {
@@ -333,145 +287,52 @@ when {
333
287
  @reject_message("Content blocked: excessive profanity detected. Please rephrase in a professional manner.")
334
288
  forbid (
335
289
  principal,
336
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
290
+ action == Sentry::Action::"process_prompt",
337
291
  resource
338
292
  )
339
293
  when {
340
294
  context has profanity_score && context.profanity_score >= 90
341
295
  };
342
296
 
343
- // ---------------------------------------------------------------------------
344
- // Section 6: Cut & Paste Safety
345
- // Specific rules for content pasted from external sources into AI chats.
346
- // Paste operations are a primary vector for data leakage.
347
- // ---------------------------------------------------------------------------
348
-
349
- // Block large pastes with any detected threats
350
- @id("sentry-cs-block-large-paste-threats")
351
- @name("Block large pastes with threats")
352
- @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.")
353
- @severity("high")
354
- @tags("paste-safety,data-leakage,content-safety")
355
- @reject_message("Large paste operation blocked: security threats were detected in the pasted content. Large data transfers to AI services require threat-free content.")
356
- forbid (
357
- principal,
358
- action == Sentry::Action::"paste_content",
359
- resource
360
- )
361
- when {
362
- context has paste_length && context has threat_count &&
363
- context.paste_length > 5000 && context.threat_count >= 1
364
- };
365
-
366
- // Block pastes containing encoded injection payloads
367
- @id("sentry-cs-block-paste-encoded")
368
- @name("Block encoded paste content")
369
- @description("Block paste operations when encoded injection payloads (base64, hex, unicode) are detected. Attackers use encoding to smuggle injection payloads via clipboard transfer.")
370
- @severity("high")
371
- @tags("paste-safety,encoding,injection,content-safety")
372
- @reject_message("Paste blocked: encoded injection payloads detected in pasted content. Content with hidden encoded instructions cannot be shared with AI services.")
373
- forbid (
374
- principal,
375
- action == Sentry::Action::"paste_content",
376
- resource
377
- )
378
- when {
379
- context has encoded_content_detected && context.encoded_content_detected &&
380
- context has encoded_score && context.encoded_score >= 60
381
- };
382
-
383
- // Block pastes with invisible characters
384
- @id("sentry-cs-block-paste-invisible")
385
- @name("Block paste with invisible characters")
386
- @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.")
387
- @severity("high")
388
- @tags("paste-safety,unicode,invisible-chars,content-safety")
389
- @reject_message("Paste blocked: invisible Unicode characters detected. Hidden characters can disguise malicious instructions that AI models process but users cannot see.")
390
- forbid (
391
- principal,
392
- action == Sentry::Action::"paste_content",
393
- resource
394
- )
395
- when {
396
- context has contains_invisible_chars && context.contains_invisible_chars &&
397
- context has invisible_chars_score && context.invisible_chars_score >= 50
398
- };
399
-
400
- // ---------------------------------------------------------------------------
401
- // Section 7: AI Response Safety
402
- // Block harmful content in AI responses before user sees it.
403
- // ---------------------------------------------------------------------------
404
-
405
- // Block violent/harmful AI responses
406
- @id("sentry-cs-block-response-safety")
407
- @name("Block harmful AI responses")
408
- @description("Block AI responses containing high-severity violent, hateful, or criminal content. Prevents harmful AI-generated content from reaching users in enterprise environments.")
409
- @severity("critical")
410
- @tags("response-safety,content-safety,owasp-llm02")
411
- @reject_message("AI response blocked: harmful content detected in the response. The AI service generated content that violates enterprise content safety policies.")
412
- forbid (
413
- principal,
414
- action == Sentry::Action::"receive_response",
415
- resource
416
- )
417
- when {
418
- context has violence_score && context.violence_score >= 80
419
- };
420
-
421
- @id("sentry-cs-block-response-hate")
422
- @name("Block hateful AI responses")
423
- @description("Block AI responses with hate speech or discriminatory content.")
424
- @severity("critical")
425
- @tags("response-safety,hate-speech,content-safety,owasp-llm02")
426
- @reject_message("AI response blocked: hate speech or discriminatory content detected in the response.")
427
- forbid (
428
- principal,
429
- action == Sentry::Action::"receive_response",
430
- resource
431
- )
432
- when {
433
- context has hate_speech_score && context.hate_speech_score >= 75
434
- };
435
297
  `;
436
298
  const SENTRY_SENTRY_SECRETS_DEFAULT_CEDAR = `// =============================================================================
437
299
  // Secrets Detection Policy (Default)
438
300
  // =============================================================================
439
- // Block credential and secret leakage across messages and AI responses.
301
+ // Block credential and secret leakage across messages and file uploads.
440
302
  // Shield SecretsDetector identifies 18+ secret types via regex.
441
303
  //
442
- // Paste-targeted secret rules live in clipboard.cedar; this file covers
443
- // non-paste channels (messages, responses, and cross-cutting rules).
304
+ // Paste-targeted secret rules live in clipboard.cedar.
444
305
  //
445
306
  // Category: secrets
446
307
  // Namespace: Sentry
447
308
  // =============================================================================
448
309
 
449
- // Block messages containing secrets
310
+ // Block messages and uploads containing secrets
450
311
  @id("sentry-org-block-secrets-messages")
451
- @name("Block messages with secrets")
452
- @description("Block messages when detection engines identify API keys, tokens, or credential patterns. First line of defense against accidental credential exposure in AI chat interactions.")
312
+ @name("Block messages and uploads with secrets")
313
+ @description("Block messages and file uploads when detection engines identify API keys, tokens, or credential patterns. First line of defense against accidental credential exposure in AI chat interactions.")
453
314
  @severity("critical")
454
315
  @tags("secrets,credentials,messages,nist-sc-28,nist-ia-5")
455
- @reject_message("Your message was blocked because it contains detected secrets such as API keys, tokens, or credentials. Remove all secrets before sending to AI services.")
316
+ @reject_message("Content blocked: detected secrets such as API keys, tokens, or credentials. Remove all secrets before sending to AI services.")
456
317
  forbid (
457
318
  principal,
458
- action == Sentry::Action::"send_message",
319
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
459
320
  resource
460
321
  )
461
322
  when {
462
323
  context has contains_secrets && context.contains_secrets
463
324
  };
464
325
 
465
- // Block high-risk secret types across all actions
326
+ // Block high-risk secret types across messages and file uploads
466
327
  @id("sentry-org-block-high-risk-secrets")
467
328
  @name("Block high-risk credential types")
468
- @description("Block content containing cloud provider keys (AWS, GCP, Azure), GitHub tokens, SSH private keys, or database connection strings across all actions. These credential types pose the highest exfiltration risk.")
329
+ @description("Block messages and file uploads containing cloud provider keys (AWS, GCP, Azure), GitHub tokens, SSH private keys, or database connection strings. These credential types pose the highest exfiltration risk.")
469
330
  @severity("critical")
470
331
  @tags("secrets,aws,github,ssh,cloud,nist-ia-5,mitre-t1552")
471
332
  @reject_message("Content blocked: high-risk credentials detected (cloud keys, GitHub tokens, SSH keys). Use a secrets manager — never share credentials with AI services.")
472
333
  forbid (
473
334
  principal,
474
- action,
335
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
475
336
  resource
476
337
  )
477
338
  when {
@@ -485,16 +346,16 @@ when {
485
346
  context.secret_types.contains("private_key"))
486
347
  };
487
348
 
488
- // Block API keys and tokens across all actions
349
+ // Block API keys and tokens across messages and file uploads
489
350
  @id("sentry-org-block-api-keys")
490
351
  @name("Block API keys and tokens")
491
- @description("Block content containing generic API keys, JWT tokens, and OAuth credentials. These are the most commonly leaked credential types when users interact with AI services.")
352
+ @description("Block messages and file uploads containing generic API keys, JWT tokens, and OAuth credentials. These are the most commonly leaked credential types when users interact with AI services.")
492
353
  @severity("high")
493
354
  @tags("secrets,api-key,jwt,oauth,nist-ia-5")
494
355
  @reject_message("Content blocked: API keys, JWT tokens, or OAuth credentials detected. These must never be shared with AI services.")
495
356
  forbid (
496
357
  principal,
497
- action,
358
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
498
359
  resource
499
360
  )
500
361
  when {
@@ -506,23 +367,23 @@ when {
506
367
  context.secret_types.contains("stripe_key"))
507
368
  };
508
369
 
509
- // Block SSH key exposure across messages, paste, and file uploads
370
+ // Block SSH key exposure across messages and file uploads
510
371
  @id("sentry-secrets-block-ssh-keys")
511
372
  @name("Block SSH key exposure")
512
- @description("Block when SSH private key content or SSH key file paths are detected. Covers messages, paste, and file uploads. AI chat services must not receive SSH credentials.")
373
+ @description("Block when SSH private key content or SSH key file paths are detected. Covers messages and file uploads. AI chat services must not receive SSH credentials.")
513
374
  @severity("critical")
514
375
  @tags("secrets,ssh,credentials,nist-ia-5,mitre-t1552")
515
376
  @reject_message("Blocked: SSH private key content or key file path detected. AI chat services must not receive SSH credentials.")
516
377
  forbid (
517
378
  principal,
518
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
379
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
519
380
  resource
520
381
  )
521
382
  when {
522
383
  context has secret_types && context.secret_types.contains("ssh_key")
523
384
  };
524
385
 
525
- // Block PEM/certificate key exposure across messages, paste, and file uploads
386
+ // Block PEM/certificate key exposure across messages and file uploads
526
387
  @id("sentry-secrets-block-pem-keys")
527
388
  @name("Block PEM/certificate key exposure")
528
389
  @description("Block when PEM private key content or certificate key file paths (.pem, .key, .p12, .pfx) are detected. AI chat services must not receive certificate credentials.")
@@ -531,7 +392,7 @@ when {
531
392
  @reject_message("Blocked: PEM private key or certificate key file detected. AI chat services must not receive certificate credentials.")
532
393
  forbid (
533
394
  principal,
534
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
395
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
535
396
  resource
536
397
  )
537
398
  when {
@@ -541,13 +402,13 @@ when {
541
402
  // Block bulk secret exposure
542
403
  @id("sentry-org-block-bulk-secrets")
543
404
  @name("Block bulk secret exposure")
544
- @description("Block content when 3+ distinct secrets are found. Multiple secrets indicate a configuration dump, .env file paste, or credential harvesting being sent to AI services.")
405
+ @description("Block messages and file uploads when 3+ distinct secrets are found. Multiple secrets indicate a configuration dump, .env file paste, or credential harvesting being sent to AI services.")
545
406
  @severity("critical")
546
407
  @tags("secrets,bulk,data-exfiltration,nist-sc-28")
547
408
  @reject_message("Content blocked: multiple credentials detected (3+). Configuration dumps and credential lists must never be shared with AI services.")
548
409
  forbid (
549
410
  principal,
550
- action,
411
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
551
412
  resource
552
413
  )
553
414
  when {
@@ -557,13 +418,13 @@ when {
557
418
  // Block detected credential patterns
558
419
  @id("sentry-org-block-detected-credentials")
559
420
  @name("Block detected credential patterns")
560
- @description("Block content flagged by detection engine rules for credential exposure, API key leaks, and token exposure. Defense-in-depth behind contains_secrets.")
421
+ @description("Block messages and file uploads flagged by detection engine rules for credential exposure, API key leaks, and token exposure. Defense-in-depth behind contains_secrets.")
561
422
  @severity("critical")
562
423
  @tags("secrets,credentials,detection-rules,nist-ia-5")
563
424
  @reject_message("Content blocked: detection engines identified credential patterns including secret exposure, API keys, or token leaks.")
564
425
  forbid (
565
426
  principal,
566
- action,
427
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
567
428
  resource
568
429
  )
569
430
  when {
@@ -572,28 +433,14 @@ when {
572
433
  context.detected_threats.contains("credential_leak") ||
573
434
  context.detected_threats.contains("api_key_exposure"))
574
435
  };
575
-
576
- // Block AI responses when session has leaked secrets
577
- @id("sentry-org-session-secrets-response")
578
- @name("Block responses after secret detection")
579
- @description("Block AI responses when secrets were detected earlier in the session. If credentials were leaked in a previous turn, the AI service may have processed them and could echo or reference them in responses.")
580
- @severity("high")
581
- @tags("session,secrets,response-safety,defense-in-depth")
582
- @reject_message("AI response blocked: secrets were detected in an earlier message in this session. Responses may contain or reference the exposed credentials.")
583
- forbid (
584
- principal,
585
- action == Sentry::Action::"receive_response",
586
- resource
587
- )
588
- when {
589
- context has session_secrets_detected && context.session_secrets_detected
590
- };
591
436
  `;
592
437
  const SENTRY_SENTRY_PII_DEFAULT_CEDAR = `// =============================================================================
593
438
  // PII Detection Policy (Default)
594
439
  // =============================================================================
595
- // Detects and blocks personally identifiable information across messages,
596
- // pasted content, file uploads, and AI responses. Uses multi-layered detection:
440
+ // Detects and blocks personally identifiable information across messages
441
+ // and file uploads. Uses multi-layered detection:
442
+ //
443
+ // Paste-targeted PII rules live in clipboard.cedar.
597
444
  //
598
445
  // 1. PII boolean flag (pii_detected) — broadest catch from detection engine
599
446
  // 2. Granular PII type matching (pii_types) — type-specific blocking
@@ -621,16 +468,16 @@ const SENTRY_SENTRY_PII_DEFAULT_CEDAR = `// ====================================
621
468
  // Fires when the detection pipeline identifies PII in any content.
622
469
  // ---------------------------------------------------------------------------
623
470
 
624
- // Block messages containing detected PII
471
+ // Block messages and uploads containing detected PII
625
472
  @id("sentry-pii-block-messages")
626
- @name("Block messages with PII")
627
- @description("Block messages when the detection engine identifies any PII patterns. Prevents employees from accidentally sharing personal data with AI chat services.")
473
+ @name("Block messages and uploads with PII")
474
+ @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.")
628
475
  @severity("critical")
629
476
  @tags("pii,privacy,data-protection,gdpr-art-32,owasp-llm06")
630
- @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.")
477
+ @reject_message("Content blocked: personally identifiable information was detected. Remove all PII (names, addresses, SSNs, credit cards, etc.) before sending to AI services.")
631
478
  forbid (
632
479
  principal,
633
- action == Sentry::Action::"send_message",
480
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
634
481
  resource
635
482
  )
636
483
  when {
@@ -645,13 +492,13 @@ when {
645
492
  // Block credit card numbers (PCI DSS compliance)
646
493
  @id("sentry-pii-block-credit-cards")
647
494
  @name("Block credit card numbers")
648
- @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.")
495
+ @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.")
649
496
  @severity("critical")
650
497
  @tags("pci,credit-card,payment,compliance,pci-dss-3.4")
651
498
  @reject_message("Content blocked: credit card number patterns detected. Sharing payment card data with AI services violates PCI DSS. Use tokenized references instead.")
652
499
  forbid (
653
500
  principal,
654
- action,
501
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
655
502
  resource
656
503
  )
657
504
  when {
@@ -662,13 +509,13 @@ when {
662
509
  // Block Social Security Numbers
663
510
  @id("sentry-pii-block-ssn")
664
511
  @name("Block Social Security Numbers")
665
- @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.")
512
+ @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.")
666
513
  @severity("critical")
667
514
  @tags("ssn,identity,privacy,compliance,nist-si-4")
668
515
  @reject_message("Content blocked: Social Security Number patterns detected. SSNs must never be shared with AI services.")
669
516
  forbid (
670
517
  principal,
671
- action,
518
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
672
519
  resource
673
520
  )
674
521
  when {
@@ -679,13 +526,13 @@ when {
679
526
  // Block passport numbers
680
527
  @id("sentry-pii-block-passport")
681
528
  @name("Block passport numbers")
682
- @description("Block content containing passport number patterns. Passport numbers are government-issued identifiers with high identity theft risk.")
529
+ @description("Block messages and file uploads containing passport number patterns. Passport numbers are government-issued identifiers with high identity theft risk.")
683
530
  @severity("critical")
684
531
  @tags("passport,identity,privacy,gdpr")
685
532
  @reject_message("Content blocked: passport number patterns detected. Government-issued identifiers must not be shared with AI services.")
686
533
  forbid (
687
534
  principal,
688
- action,
535
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
689
536
  resource
690
537
  )
691
538
  when {
@@ -695,13 +542,13 @@ when {
695
542
  // Block IBAN (International Bank Account Numbers)
696
543
  @id("sentry-pii-block-iban")
697
544
  @name("Block bank account numbers")
698
- @description("Block content containing IBAN patterns. Bank account numbers are sensitive financial identifiers that must not be exposed to AI services.")
545
+ @description("Block messages and file uploads containing IBAN patterns. Bank account numbers are sensitive financial identifiers that must not be exposed to AI services.")
699
546
  @severity("critical")
700
547
  @tags("iban,financial,privacy,gdpr,pci-dss")
701
548
  @reject_message("Content blocked: bank account number (IBAN) patterns detected. Financial account numbers must not be shared with AI services.")
702
549
  forbid (
703
550
  principal,
704
- action,
551
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
705
552
  resource
706
553
  )
707
554
  when {
@@ -711,13 +558,13 @@ when {
711
558
  // Block bulk PII exposure
712
559
  @id("sentry-pii-block-bulk-exposure")
713
560
  @name("Block bulk PII exposure")
714
- @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.")
561
+ @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.")
715
562
  @severity("critical")
716
563
  @tags("pii,bulk,data-exfiltration,gdpr-art-32,ccpa")
717
564
  @reject_message("Content blocked: multiple PII items detected (3+). Bulk personal data must never be shared with AI services. Use data masking or tokenization.")
718
565
  forbid (
719
566
  principal,
720
- action,
567
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
721
568
  resource
722
569
  )
723
570
  when {
@@ -732,13 +579,13 @@ when {
732
579
  // Block high-confidence PII
733
580
  @id("sentry-pii-block-high-confidence")
734
581
  @name("Block high-confidence PII")
735
- @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.")
582
+ @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.")
736
583
  @severity("critical")
737
584
  @tags("pii,confidence,privacy,compliance,ml-classifier")
738
585
  @reject_message("Content blocked: the ML classifier detected personally identifiable information with high confidence. The content appears to contain personal data.")
739
586
  forbid (
740
587
  principal,
741
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
588
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
742
589
  resource
743
590
  )
744
591
  when {
@@ -753,126 +600,46 @@ when {
753
600
  // Block PII threat category
754
601
  @id("sentry-pii-block-threat-category")
755
602
  @name("Block PII threat category")
756
- @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.")
603
+ @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.")
757
604
  @severity("high")
758
605
  @tags("pii,privacy,data-protection,gdpr")
759
606
  @reject_message("Content blocked: threat scanners detected personally identifiable information. Remove all PII before submitting.")
760
607
  forbid (
761
608
  principal,
762
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
609
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
763
610
  resource
764
611
  )
765
612
  when {
766
613
  context has threat_categories && context.threat_categories.contains("pii")
767
614
  };
768
615
 
769
- // ---------------------------------------------------------------------------
770
- // Section 5: AI Response PII Blocking
771
- // Prevent AI responses containing PII from reaching the user.
772
- // ---------------------------------------------------------------------------
773
-
774
- // Block AI responses containing PII
775
- @id("sentry-pii-block-responses")
776
- @name("Block AI responses with PII")
777
- @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).")
778
- @severity("high")
779
- @tags("pii,response-safety,data-protection,owasp-llm06")
780
- @reject_message("AI response blocked: personally identifiable information detected in the AI response. The AI service generated content containing personal data.")
781
- forbid (
782
- principal,
783
- action == Sentry::Action::"receive_response",
784
- resource
785
- )
786
- when {
787
- context has pii_detected && context.pii_detected
788
- };
789
616
  `;
790
617
  const SENTRY_SENTRY_FILE_SAFETY_DEFAULT_CEDAR = `// =============================================================================
791
618
  // File & Attachment Safety Policy (Default)
792
619
  // =============================================================================
793
- // Enforces document sensitivity controls for files uploaded to AI chat services.
794
- // Integrates with Microsoft Information Protection (MIP) labels to prevent
795
- // confidential and restricted documents from being shared with AI.
620
+ // Blocks file uploads to AI chat services when document content contains
621
+ // secrets or PII.
796
622
  //
797
623
  // Detection layers:
798
- // 1. MIP label enforcementsensitivity_level from document metadata
799
- // 2. PII/secrets in file content — from Shield PIIRegexDetector/SecretsDetector
800
- // 3. Injection payloads in files — from Shield InjectionDetector
801
- // 4. File type restrictions — block dangerous extensions
802
- // 5. Phishing link detection — from CheckPhishDetector
624
+ // 1. Secrets in file content — from Shield SecretsDetector
625
+ // 2. PII in file content — from Shield PIIRegexDetector
803
626
  //
804
627
  // Compliance:
805
- // Microsoft Information Protection (MIP) — label-based access control
806
628
  // NIST 800-53 SC-28 (Protection of Information at Rest)
807
629
  // GDPR Art. 32 (Security of Processing)
808
- // ISO 27001 A.8.2 (Information Classification)
809
630
  //
810
631
  // Category: file_safety
811
632
  // Namespace: Sentry
812
633
  // =============================================================================
813
634
 
814
635
  // ---------------------------------------------------------------------------
815
- // Section 1: MIP Label Enforcement
816
- // Block uploads based on Microsoft Information Protection sensitivity labels.
817
- // Labels are read from document metadata via MIP SDK / Graph API.
636
+ // Section 1: File Content Security
637
+ // Block text files containing secrets or PII.
818
638
  // ---------------------------------------------------------------------------
819
639
 
820
- // Block restricted documents
821
- @id("sentry-file-block-restricted")
822
- @name("Block restricted documents")
823
- @description("Block uploads of documents with 'restricted' sensitivity level. Restricted documents contain the most sensitive data (board materials, M&A, legal privilege) and must never be shared with AI services.")
824
- @severity("critical")
825
- @tags("mip,restricted,classification,compliance,iso-27001")
826
- @reject_message("Upload blocked: this document is classified as RESTRICTED. Restricted documents must never be shared with AI services. Contact your security team if you need to process this content.")
827
- forbid (
828
- principal,
829
- action == Sentry::Action::"upload_file",
830
- resource
831
- )
832
- when {
833
- context has sensitivity_level && context.sensitivity_level == "restricted"
834
- };
835
-
836
- // Block confidential documents
837
- @id("sentry-file-block-confidential")
838
- @name("Block confidential documents")
839
- @description("Block uploads of documents with 'confidential' sensitivity level. Confidential documents (financial reports, customer data, internal strategy) should not be shared with external AI services.")
840
- @severity("critical")
841
- @tags("mip,confidential,classification,compliance,iso-27001")
842
- @reject_message("Upload blocked: this document is classified as CONFIDENTIAL. Confidential documents should not be shared with AI services without explicit authorization.")
843
- forbid (
844
- principal,
845
- action == Sentry::Action::"upload_file",
846
- resource
847
- )
848
- when {
849
- context has sensitivity_level && context.sensitivity_level == "confidential"
850
- };
851
-
852
- // Block rights-managed documents
853
- @id("sentry-file-block-rights-managed")
854
- @name("Block rights-managed documents")
855
- @description("Block uploads of documents with IRM/RMS rights management restrictions. Rights-managed documents have explicit access controls that would be bypassed by sharing with AI services.")
856
- @severity("critical")
857
- @tags("mip,irm,rms,rights-management,compliance")
858
- @reject_message("Upload blocked: this document has rights management restrictions that prohibit sharing with AI services.")
859
- forbid (
860
- principal,
861
- action == Sentry::Action::"upload_file",
862
- resource
863
- )
864
- when {
865
- context has is_rights_managed && context.is_rights_managed
866
- };
867
-
868
- // ---------------------------------------------------------------------------
869
- // Section 2: File Content Security
870
- // Block files containing secrets, PII, or injection payloads.
871
- // ---------------------------------------------------------------------------
872
-
873
- // Block files containing secrets
640
+ // Block text files with secrets
874
641
  @id("sentry-file-block-secrets")
875
- @name("Block files with secrets")
642
+ @name("Block text files with secrets")
876
643
  @description("Block file uploads when secrets or credentials are detected in document content. Prevents uploading configuration files, code, or documents containing API keys, tokens, or passwords to AI services.")
877
644
  @severity("critical")
878
645
  @tags("secrets,file-upload,credentials,nist-sc-28")
@@ -886,9 +653,9 @@ when {
886
653
  context has contains_secrets && context.contains_secrets
887
654
  };
888
655
 
889
- // Block file uploads containing PII
656
+ // Block text files with PII
890
657
  @id("sentry-pii-block-uploads")
891
- @name("Block file uploads with PII")
658
+ @name("Block text files with PII")
892
659
  @description("Block file uploads when PII is detected in document content. Prevents sharing of documents containing personal data (customer lists, HR records, medical files) with AI services.")
893
660
  @severity("critical")
894
661
  @tags("pii,file-upload,data-protection,gdpr-art-32")
@@ -901,66 +668,6 @@ forbid (
901
668
  when {
902
669
  context has pii_detected && context.pii_detected
903
670
  };
904
-
905
- // Block files with phishing links
906
- @id("sentry-file-block-phishing")
907
- @name("Block files with phishing links")
908
- @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.")
909
- @severity("high")
910
- @tags("phishing,file-upload,security")
911
- @reject_message("Upload blocked: phishing URLs detected in the file. Documents containing phishing links cannot be shared with AI services.")
912
- forbid (
913
- principal,
914
- action == Sentry::Action::"upload_file",
915
- resource
916
- )
917
- when {
918
- context has phishing_detected && context.phishing_detected
919
- };
920
-
921
- // ---------------------------------------------------------------------------
922
- // Section 3: File Type & Size Restrictions
923
- // Block potentially dangerous file types and oversized files.
924
- // ---------------------------------------------------------------------------
925
-
926
- // Block large file uploads with any threats
927
- @id("sentry-file-block-large-threats")
928
- @name("Block large files with threats")
929
- @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.")
930
- @severity("high")
931
- @tags("file-upload,size-limit,data-protection")
932
- @reject_message("Upload blocked: security threats detected in a large file. Large data transfers to AI services require threat-free content.")
933
- forbid (
934
- principal,
935
- action == Sentry::Action::"upload_file",
936
- resource
937
- )
938
- when {
939
- context has file_size_bytes && context has threat_count &&
940
- context.file_size_bytes > 10485760 && context.threat_count >= 1
941
- };
942
-
943
- // ---------------------------------------------------------------------------
944
- // Section 4: Source Code Protection
945
- // Block source code uploads to AI services.
946
- // ---------------------------------------------------------------------------
947
-
948
- // Block files with high code content
949
- @id("sentry-file-block-source-code")
950
- @name("Block source code uploads")
951
- @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.")
952
- @severity("high")
953
- @tags("source-code,ip-protection,file-upload,data-leakage")
954
- @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.")
955
- forbid (
956
- principal,
957
- action == Sentry::Action::"upload_file",
958
- resource
959
- )
960
- when {
961
- context has contains_code && context.contains_code &&
962
- context has code_ratio && context.code_ratio > 80
963
- };
964
671
  `;
965
672
  const SENTRY_SENTRY_CLIPBOARD_DEFAULT_CEDAR = `// =============================================================================
966
673
  // Clipboard Policy (Default)
@@ -968,10 +675,15 @@ const SENTRY_SENTRY_CLIPBOARD_DEFAULT_CEDAR = `// ==============================
968
675
  // Controls over paste operations into AI chat services. Covers:
969
676
  // - Blanket paste blocking (admin-configurable)
970
677
  // - Paste-with-secrets blocking
678
+ // - Paste-with-PII blocking
971
679
  // - Paste-with-source-code blocking
680
+ // - Large-paste threat blocking
681
+ // - Paste-with-encoded-payload blocking
682
+ // - Paste-with-invisible-character blocking
972
683
  //
973
- // Cross-cutting secret rules (e.g. high-risk credential types) are defined
974
- // in secrets.cedar and apply to paste content as well.
684
+ // All policies in this file are scoped to action == "paste_content". Other
685
+ // templates (semantic.cedar, content_safety.cedar, pii.cedar, secrets.cedar)
686
+ // cover process_prompt and upload_file for the same threat categories.
975
687
  //
976
688
  // Category: clipboard
977
689
  // Namespace: Sentry
@@ -1022,21 +734,38 @@ when {
1022
734
  context has pii_detected && context.pii_detected
1023
735
  };
1024
736
 
1025
- // Block pasted source code
1026
- @id("sentry-org-block-code-paste")
1027
- @name("Block pasted source code")
1028
- @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.")
737
+ // Block pastes containing encoded injection payloads
738
+ @id("sentry-clipboard-block-paste-encoded")
739
+ @name("Block encoded paste content")
740
+ @description("Block paste operations when encoded injection payloads (base64, hex, unicode) are detected. Attackers use encoding to smuggle injection payloads via clipboard transfer.")
1029
741
  @severity("high")
1030
- @tags("source-code,paste-safety,ip-protection,data-leakage")
1031
- @reject_message("Paste blocked: the content appears to be primarily source code (>80%). Pasting bulk source code into AI services risks intellectual property exposure.")
742
+ @tags("paste-safety,encoding,injection,clipboard")
743
+ @reject_message("Paste blocked: encoded injection payloads detected in pasted content. Content with hidden encoded instructions cannot be shared with AI services.")
1032
744
  forbid (
1033
745
  principal,
1034
746
  action == Sentry::Action::"paste_content",
1035
747
  resource
1036
748
  )
1037
749
  when {
1038
- context has contains_code && context.contains_code &&
1039
- context has code_ratio && context.code_ratio > 80
750
+ context has encoded_content_detected && context.encoded_content_detected &&
751
+ context has encoded_score && context.encoded_score >= 60
752
+ };
753
+
754
+ // Block pastes with invisible characters
755
+ @id("sentry-clipboard-block-paste-invisible")
756
+ @name("Block paste with invisible characters")
757
+ @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.")
758
+ @severity("high")
759
+ @tags("paste-safety,unicode,invisible-chars,clipboard")
760
+ @reject_message("Paste blocked: invisible Unicode characters detected. Hidden characters can disguise malicious instructions that AI models process but users cannot see.")
761
+ forbid (
762
+ principal,
763
+ action == Sentry::Action::"paste_content",
764
+ resource
765
+ )
766
+ when {
767
+ context has contains_invisible_chars && context.contains_invisible_chars &&
768
+ context has invisible_chars_score && context.invisible_chars_score >= 50
1040
769
  };
1041
770
  `;
1042
771
  const SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR = `// =============================================================================
@@ -1047,7 +776,6 @@ const SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR = `// ===========================
1047
776
  // in clipboard.cedar.
1048
777
  //
1049
778
  // This template covers:
1050
- // - Source code protection in messages (non-paste channels)
1051
779
  // - Session-aware threat escalation
1052
780
  //
1053
781
  // Category: organization
@@ -1055,30 +783,7 @@ const SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR = `// ===========================
1055
783
  // =============================================================================
1056
784
 
1057
785
  // ---------------------------------------------------------------------------
1058
- // Section 1: Source Code Protection (Messages)
1059
- // Prevent bulk source code from being shared via messages.
1060
- // Paste-targeted code protection is in clipboard.cedar.
1061
- // ---------------------------------------------------------------------------
1062
-
1063
- // Block messages with high code content
1064
- @id("sentry-org-block-code-messages")
1065
- @name("Block messages with source code")
1066
- @description("Block messages when source code constitutes more than 80% of the content. Prevents bulk source code exfiltration to external AI services.")
1067
- @severity("high")
1068
- @tags("source-code,ip-protection,data-leakage")
1069
- @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.")
1070
- forbid (
1071
- principal,
1072
- action == Sentry::Action::"send_message",
1073
- resource
1074
- )
1075
- when {
1076
- context has contains_code && context.contains_code &&
1077
- context has code_ratio && context.code_ratio > 80
1078
- };
1079
-
1080
- // ---------------------------------------------------------------------------
1081
- // Section 2: Session-Aware Escalation
786
+ // Section 1: Session-Aware Escalation
1082
787
  // Escalate protections when threats are detected across the session.
1083
788
  // ---------------------------------------------------------------------------
1084
789
 
@@ -1105,10 +810,10 @@ export const SENTRY_CATEGORIES = [
1105
810
  { id: 'secrets', name: 'Secrets Detection', description: 'Detect and block secrets, API keys, tokens, and other credentials in messages and AI responses' },
1106
811
  { id: 'pii', name: 'PII Detection', description: 'Detect and block personally identifiable information (PII) such as credit card numbers, SSNs, health data, and other sensitive personal data from being shared with AI chat services' },
1107
812
  { id: 'semantic', name: 'Semantic Threat Detection', description: 'Detect and block prompt injection, jailbreak attempts, and high-severity threats in messages, pasted content, and uploaded files' },
1108
- { id: 'content_safety', name: 'Content Safety', description: 'Detect and block violent, harmful, hateful, sexual, and profane content in AI interactions, including cut-and-paste safety rules' },
1109
- { id: 'file_safety', name: 'File & Attachment Safety', description: 'Enforce document sensitivity controls (MIP labels), block sensitive file uploads, detect secrets and PII in uploaded documents' },
1110
- { id: 'clipboard', name: 'Clipboard Policy', description: 'Control paste operations into AI chat services — block paste outright, block when secrets or source code are detected' },
1111
- { id: 'organization', name: 'Organization Rules', description: 'Cross-cutting organization-wide rules: source code protection in messages and session-aware threat escalation' },
813
+ { id: 'content_safety', name: 'Content Safety', description: 'Detect and block violent, harmful, hateful, sexual, and profane content in AI interactions across messages, paste, and file uploads' },
814
+ { id: 'file_safety', name: 'File & Attachment Safety', description: 'Block file uploads containing secrets or PII in document content' },
815
+ { id: 'clipboard', name: 'Clipboard Policy', description: 'Control paste operations into AI chat services — block paste outright, block when secrets, PII, source code, large threat-laden pastes, encoded payloads, or invisible characters are detected' },
816
+ { id: 'organization', name: 'Organization Rules', description: 'Cross-cutting organization-wide rules: session-aware threat escalation' },
1112
817
  ];
1113
818
  // =============================================================================
1114
819
  // DEFAULT POLICIES
@@ -1141,11 +846,11 @@ export const SENTRY_TEMPLATES = [
1141
846
  {
1142
847
  id: 'sentry-content-safety-default',
1143
848
  name: 'Content Safety',
1144
- description: 'Detect and block violent, harmful, hateful, sexual, and profane content including cut-and-paste safety enforcement',
849
+ description: 'Detect and block violent, harmful, hateful, sexual, and profane content across messages, paste, and file uploads',
1145
850
  category: 'content_safety',
1146
851
  cedarText: SENTRY_SENTRY_CONTENT_SAFETY_DEFAULT_CEDAR,
1147
852
  severity: 'critical',
1148
- tags: ['violence', 'hate-speech', 'sexual', 'profanity', 'content-safety', 'paste-safety', 'baseline'],
853
+ tags: ['violence', 'hate-speech', 'sexual', 'profanity', 'content-safety', 'baseline'],
1149
854
  },
1150
855
  {
1151
856
  id: 'sentry-secrets-default',
@@ -1168,29 +873,29 @@ export const SENTRY_TEMPLATES = [
1168
873
  {
1169
874
  id: 'sentry-file-safety-default',
1170
875
  name: 'File & Attachment Safety',
1171
- description: 'Enforce MIP sensitivity labels, block confidential document uploads, detect secrets and PII in files, and restrict file types',
876
+ description: 'Block file uploads containing secrets or PII in document content',
1172
877
  category: 'file_safety',
1173
878
  cedarText: SENTRY_SENTRY_FILE_SAFETY_DEFAULT_CEDAR,
1174
879
  severity: 'critical',
1175
- tags: ['mip', 'document-sensitivity', 'file-upload', 'dlp', 'compliance'],
880
+ tags: ['file-upload', 'secrets', 'pii', 'dlp'],
1176
881
  },
1177
882
  {
1178
883
  id: 'sentry-clipboard-default',
1179
884
  name: 'Clipboard Policy',
1180
- description: 'Control paste into AI chat services: blanket paste blocking, secrets-in-paste blocking, and source-code-in-paste blocking',
885
+ description: 'Control paste into AI chat services: blanket paste blocking, paste-with-secrets, paste-with-PII, paste-with-source-code, large pastes carrying threats, encoded injection payloads, and invisible-character payloads',
1181
886
  category: 'clipboard',
1182
887
  cedarText: SENTRY_SENTRY_CLIPBOARD_DEFAULT_CEDAR,
1183
888
  severity: 'high',
1184
- tags: ['paste', 'clipboard', 'data-protection', 'source-code', 'secrets'],
889
+ tags: ['paste', 'clipboard', 'data-protection', 'source-code', 'secrets', 'pii', 'encoding', 'invisible-chars'],
1185
890
  },
1186
891
  {
1187
892
  id: 'sentry-organization-default',
1188
893
  name: 'Organization Rules',
1189
- description: 'Cross-cutting organization-wide policies: source code protection in messages and session-aware threat escalation',
894
+ description: 'Cross-cutting organization-wide policies: session-aware threat escalation',
1190
895
  category: 'organization',
1191
896
  cedarText: SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR,
1192
897
  severity: 'high',
1193
- tags: ['source-code', 'session', 'escalation', 'organization'],
898
+ tags: ['session', 'escalation', 'organization'],
1194
899
  },
1195
900
  ];
1196
901
  // =============================================================================
@@ -1199,7 +904,7 @@ export const SENTRY_TEMPLATES = [
1199
904
  /** Raw templates.json metadata for the Sentry service. */
1200
905
  export const SENTRY_TEMPLATES_JSON = `{
1201
906
  "service": "sentry",
1202
- "version": "1.0.0",
907
+ "version": "1.1.0",
1203
908
  "description": "Sentry policy templates for browser AI security",
1204
909
  "categories": [
1205
910
  {
@@ -1220,22 +925,22 @@ export const SENTRY_TEMPLATES_JSON = `{
1220
925
  {
1221
926
  "id": "content_safety",
1222
927
  "name": "Content Safety",
1223
- "description": "Detect and block violent, harmful, hateful, sexual, and profane content in AI interactions, including cut-and-paste safety rules"
928
+ "description": "Detect and block violent, harmful, hateful, sexual, and profane content in AI interactions across messages, paste, and file uploads"
1224
929
  },
1225
930
  {
1226
931
  "id": "file_safety",
1227
932
  "name": "File & Attachment Safety",
1228
- "description": "Enforce document sensitivity controls (MIP labels), block sensitive file uploads, detect secrets and PII in uploaded documents"
933
+ "description": "Block file uploads containing secrets or PII in document content"
1229
934
  },
1230
935
  {
1231
936
  "id": "clipboard",
1232
937
  "name": "Clipboard Policy",
1233
- "description": "Control paste operations into AI chat services — block paste outright, block when secrets or source code are detected"
938
+ "description": "Control paste operations into AI chat services — block paste outright, block when secrets, PII, source code, large threat-laden pastes, encoded payloads, or invisible characters are detected"
1234
939
  },
1235
940
  {
1236
941
  "id": "organization",
1237
942
  "name": "Organization Rules",
1238
- "description": "Cross-cutting organization-wide rules: source code protection in messages and session-aware threat escalation"
943
+ "description": "Cross-cutting organization-wide rules: session-aware threat escalation"
1239
944
  }
1240
945
  ],
1241
946
  "defaults": [
@@ -1263,11 +968,11 @@ export const SENTRY_TEMPLATES_JSON = `{
1263
968
  {
1264
969
  "id": "sentry-content-safety-default",
1265
970
  "name": "Content Safety",
1266
- "description": "Detect and block violent, harmful, hateful, sexual, and profane content including cut-and-paste safety enforcement",
971
+ "description": "Detect and block violent, harmful, hateful, sexual, and profane content across messages, paste, and file uploads",
1267
972
  "category": "content_safety",
1268
973
  "file": "defaults/content_safety.cedar",
1269
974
  "severity": "critical",
1270
- "tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "paste-safety", "baseline"]
975
+ "tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "baseline"]
1271
976
  },
1272
977
  {
1273
978
  "id": "sentry-secrets-default",
@@ -1290,29 +995,29 @@ export const SENTRY_TEMPLATES_JSON = `{
1290
995
  {
1291
996
  "id": "sentry-file-safety-default",
1292
997
  "name": "File & Attachment Safety",
1293
- "description": "Enforce MIP sensitivity labels, block confidential document uploads, detect secrets and PII in files, and restrict file types",
998
+ "description": "Block file uploads containing secrets or PII in document content",
1294
999
  "category": "file_safety",
1295
1000
  "file": "defaults/file_safety.cedar",
1296
1001
  "severity": "critical",
1297
- "tags": ["mip", "document-sensitivity", "file-upload", "dlp", "compliance"]
1002
+ "tags": ["file-upload", "secrets", "pii", "dlp"]
1298
1003
  },
1299
1004
  {
1300
1005
  "id": "sentry-clipboard-default",
1301
1006
  "name": "Clipboard Policy",
1302
- "description": "Control paste into AI chat services: blanket paste blocking, secrets-in-paste blocking, and source-code-in-paste blocking",
1007
+ "description": "Control paste into AI chat services: blanket paste blocking, paste-with-secrets, paste-with-PII, paste-with-source-code, large pastes carrying threats, encoded injection payloads, and invisible-character payloads",
1303
1008
  "category": "clipboard",
1304
1009
  "file": "defaults/clipboard.cedar",
1305
1010
  "severity": "high",
1306
- "tags": ["paste", "clipboard", "data-protection", "source-code", "secrets"]
1011
+ "tags": ["paste", "clipboard", "data-protection", "source-code", "secrets", "pii", "encoding", "invisible-chars"]
1307
1012
  },
1308
1013
  {
1309
1014
  "id": "sentry-organization-default",
1310
1015
  "name": "Organization Rules",
1311
- "description": "Cross-cutting organization-wide policies: source code protection in messages and session-aware threat escalation",
1016
+ "description": "Cross-cutting organization-wide policies: session-aware threat escalation",
1312
1017
  "category": "organization",
1313
1018
  "file": "defaults/organization.cedar",
1314
1019
  "severity": "high",
1315
- "tags": ["source-code", "session", "escalation", "organization"]
1020
+ "tags": ["session", "escalation", "organization"]
1316
1021
  }
1317
1022
  ]
1318
1023
  }