@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
@@ -389,173 +389,736 @@ when {
389
389
  };
390
390
  `;
391
391
  const SENTRY_PRIVACY_DEFAULTS_CEDAR = `// =============================================================================
392
- // PII Detection (Default)
392
+ // Structural PII (Tier 1)
393
393
  // =============================================================================
394
- // Blocks personally identifiable information across messages and file uploads
395
- // using multi-layered detection: detector boolean, granular PII type
396
- // matching, ML classifier confidence, threat category aggregation, and bulk
397
- // exposure thresholds.
394
+ // Blocks high-sensitivity identifiers that have a deterministic structure (SSNs, credit cards, IBANs, API keys) using fast regex pattern matching — high precision, low latency, few false positives. One forbid rule per identifier group.
398
395
  //
399
- // Paste-targeted PII rules live in clipboard.cedar.
396
+ // Sensitivity tiers and the structural (regex) / contextual (model) type
397
+ // vocabulary are defined canonically in schemas/_shared/pii_taxonomy.json and
398
+ // enforced by tools/lint-templates.
400
399
  //
401
400
  // Context keys consumed:
402
- // - pii_detected: Bool
403
- // - pii_types: Set<String>
404
- // - pii_count: Long
405
- // - pii_score: Long (0-100)
406
- // - detected_threats: Set<String>
407
- // - threat_categories: Set<String>
408
- //
409
- // Compliance:
410
- // - PCI DSS 3.4/4.1, GDPR Art. 32, HIPAA §164.312, CCPA §1798.150
401
+ // - pii_types: Set<String> (union of structural lowercase + contextual uppercase types)
411
402
  //
412
403
  // Category: privacy
413
404
  // Namespace: Sentry
414
405
  // =============================================================================
415
406
 
416
- // ---------------------------------------------------------------------------
417
- // Section 1: Primary PII detection
418
- // ---------------------------------------------------------------------------
407
+ @id("privacy.block-pii-national-id")
408
+ @name("Block national ID numbers (structural)")
409
+ @description("Blocks prompts, pastes, and file uploads that contain a national ID (SSN, passport, or driver's license).")
410
+ @severity("high")
411
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
412
+ @reject_message("Content blocked: national identifier (SSN, passport, or driver's license) patterns detected.")
413
+ forbid (
414
+ principal,
415
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
416
+ resource
417
+ )
418
+ when {
419
+ context has pii_types &&
420
+ (
421
+ context.pii_types.contains("ssn") ||
422
+ context.pii_types.contains("passport") ||
423
+ context.pii_types.contains("national_id") ||
424
+ context.pii_types.contains("drivers_license")
425
+ )
426
+ };
427
+
428
+ @id("privacy.block-pii-credit-card")
429
+ @name("Block credit card numbers (structural)")
430
+ @description("Blocks prompts, pastes, and file uploads that contain a credit card number.")
431
+ @severity("critical")
432
+ @tags("category:privacy,threat:pii,detection:pattern,compliance:pci-dss,owasp:llm06")
433
+ @reject_message("Content blocked: credit card number patterns detected.")
434
+ forbid (
435
+ principal,
436
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
437
+ resource
438
+ )
439
+ when {
440
+ context has pii_types && context.pii_types.contains("credit_card")
441
+ };
419
442
 
420
- @id("privacy.block-pii")
421
- @name("Block messages and uploads with PII")
422
- @description("Blocks process_prompt and upload_file when pii_detected is true.")
443
+ @id("privacy.block-pii-bank-account")
444
+ @name("Block bank account numbers (structural)")
445
+ @description("Blocks prompts, pastes, and file uploads that contain a bank account number (IBAN, SWIFT/BIC, or routing number).")
423
446
  @severity("critical")
424
- @tags("category:privacy,threat:pii,detection:rule,compliance:gdpr,owasp:llm06")
425
- @reject_message("Content blocked: personally identifiable information detected remove before sending to AI services.")
447
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
448
+ @reject_message("Content blocked: bank account (IBAN) number patterns detected.")
426
449
  forbid (
427
450
  principal,
428
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
451
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
429
452
  resource
430
453
  )
431
454
  when {
432
- context has pii_detected && context.pii_detected == true
455
+ context has pii_types &&
456
+ (
457
+ context.pii_types.contains("iban") ||
458
+ context.pii_types.contains("bank_account") ||
459
+ context.pii_types.contains("swift_bic") ||
460
+ context.pii_types.contains("aba_routing")
461
+ )
433
462
  };
434
463
 
435
- // ---------------------------------------------------------------------------
436
- // Section 2: Granular PII type blocking
437
- // ---------------------------------------------------------------------------
464
+ @id("privacy.block-pii-medical")
465
+ @name("Block medical identifiers (structural)")
466
+ @description("Blocks prompts, pastes, and file uploads that contain medical data (record number, MBI, NPI, or blood type).")
467
+ @severity("medium")
468
+ @tags("category:privacy,threat:pii,detection:pattern,compliance:hipaa,owasp:llm06")
469
+ @reject_message("Content blocked: medical record identifier patterns detected.")
470
+ forbid (
471
+ principal,
472
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
473
+ resource
474
+ )
475
+ when {
476
+ context has pii_types &&
477
+ (
478
+ context.pii_types.contains("medical_record") ||
479
+ context.pii_types.contains("patient_record") ||
480
+ context.pii_types.contains("medicare_beneficiary_id") ||
481
+ context.pii_types.contains("npi") ||
482
+ context.pii_types.contains("medical_term") ||
483
+ context.pii_types.contains("blood_type")
484
+ )
485
+ };
438
486
 
439
- @id("privacy.block-credit-card")
440
- @name("Block credit card numbers")
441
- @description("Blocks process_prompt and upload_file when pii_types or detected_threats contains \\"credit_card\\".")
487
+ @id("privacy.block-pii-tax-id")
488
+ @name("Block tax identifiers (structural)")
489
+ @description("Blocks prompts, pastes, and file uploads that contain a tax ID (ITIN, EIN, or PTIN).")
490
+ @severity("high")
491
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
492
+ @reject_message("Content blocked: tax identifier (ITIN or EIN) patterns detected.")
493
+ forbid (
494
+ principal,
495
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
496
+ resource
497
+ )
498
+ when {
499
+ context has pii_types &&
500
+ (
501
+ context.pii_types.contains("itin") ||
502
+ context.pii_types.contains("ein") ||
503
+ context.pii_types.contains("ptin")
504
+ )
505
+ };
506
+
507
+ @id("privacy.block-pii-credential")
508
+ @name("Block credentials (structural)")
509
+ @description("Blocks prompts, pastes, and file uploads that contain a credential or secret (API key, token, password hash, or private key).")
442
510
  @severity("critical")
443
- @tags("category:privacy,threat:pii,detection:pattern,compliance:pci-dss")
444
- @reject_message("Content blocked: credit card number patterns detected — PCI DSS prohibits raw PAN handling.")
511
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
512
+ @reject_message("Content blocked: credential or API key patterns detected.")
445
513
  forbid (
446
514
  principal,
447
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
515
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
448
516
  resource
449
517
  )
450
518
  when {
451
- (context has pii_types && context.pii_types.contains("credit_card")) ||
452
- (context has detected_threats && context.detected_threats.contains("credit_card"))
519
+ context has pii_types &&
520
+ (
521
+ context.pii_types.contains("aws_access_key") ||
522
+ context.pii_types.contains("api_key") ||
523
+ context.pii_types.contains("jwt_token") ||
524
+ context.pii_types.contains("encryption_key") ||
525
+ context.pii_types.contains("http_basic_auth") ||
526
+ context.pii_types.contains("gcp_credential") ||
527
+ context.pii_types.contains("gcp_api_key") ||
528
+ context.pii_types.contains("gcp_signed_policy") ||
529
+ context.pii_types.contains("session_cookie") ||
530
+ context.pii_types.contains("oauth_token") ||
531
+ context.pii_types.contains("tls_certificate") ||
532
+ context.pii_types.contains("password_hash") ||
533
+ context.pii_types.contains("csrf_token")
534
+ )
453
535
  };
454
536
 
455
- @id("privacy.block-ssn")
456
- @name("Block Social Security Numbers")
457
- @description("Blocks process_prompt and upload_file when pii_types or detected_threats contains \\"ssn\\".")
537
+ @id("privacy.block-pii-crypto")
538
+ @name("Block cryptocurrency addresses (structural)")
539
+ @description("Blocks prompts, pastes, and file uploads that contain a cryptocurrency wallet address.")
540
+ @severity("high")
541
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
542
+ @reject_message("Content blocked: cryptocurrency wallet address patterns detected.")
543
+ forbid (
544
+ principal,
545
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
546
+ resource
547
+ )
548
+ when {
549
+ context has pii_types &&
550
+ (
551
+ context.pii_types.contains("bitcoin_address") ||
552
+ context.pii_types.contains("ethereum_address")
553
+ )
554
+ };
555
+ `;
556
+ const SENTRY_PRIVACY_PII_MODEL_CEDAR = `// =============================================================================
557
+ // Contextual PII (Tier 2)
558
+ // =============================================================================
559
+ // 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.
560
+ //
561
+ // Sensitivity tiers and the structural (regex) / contextual (model) type
562
+ // vocabulary are defined canonically in schemas/_shared/pii_taxonomy.json and
563
+ // enforced by tools/lint-templates.
564
+ //
565
+ // Context keys consumed:
566
+ // - pii_types: Set<String> (union of structural lowercase + contextual uppercase types)
567
+ //
568
+ // Category: privacy
569
+ // Namespace: Sentry
570
+ // =============================================================================
571
+
572
+ @id("privacy.block-pii-national-id-model")
573
+ @name("Block national ID numbers (contextual)")
574
+ @description("Blocks prompts, pastes, and file uploads that contain a national ID (SSN, passport, or driver's license).")
575
+ @severity("high")
576
+ @tags("category:privacy,threat:pii,detection:ml,owasp:llm06")
577
+ @reject_message("Content blocked: national identifier (SSN, passport, or driver's license) patterns detected.")
578
+ forbid (
579
+ principal,
580
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
581
+ resource
582
+ )
583
+ when {
584
+ context has pii_types && context.pii_types.contains("NATIONAL_ID")
585
+ };
586
+
587
+ @id("privacy.block-pii-credit-card-model")
588
+ @name("Block credit card numbers (contextual)")
589
+ @description("Blocks prompts, pastes, and file uploads that contain a credit card number.")
458
590
  @severity("critical")
459
- @tags("category:privacy,threat:pii,detection:pattern,compliance:gdpr")
460
- @reject_message("Content blocked: Social Security Number patterns detected.")
591
+ @tags("category:privacy,threat:pii,detection:ml,compliance:pci-dss,owasp:llm06")
592
+ @reject_message("Content blocked: credit card number patterns detected.")
461
593
  forbid (
462
594
  principal,
463
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
595
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
464
596
  resource
465
597
  )
466
598
  when {
467
- (context has pii_types && context.pii_types.contains("ssn")) ||
468
- (context has detected_threats && context.detected_threats.contains("ssn"))
599
+ context has pii_types && context.pii_types.contains("CREDIT_CARD")
469
600
  };
470
601
 
471
- @id("privacy.block-passport")
472
- @name("Block passport numbers")
473
- @description("Blocks process_prompt and upload_file when pii_types contains \\"passport\\".")
602
+ @id("privacy.block-pii-bank-account-model")
603
+ @name("Block bank account numbers (contextual)")
604
+ @description("Blocks prompts, pastes, and file uploads that contain a bank account number (IBAN, SWIFT/BIC, or routing number).")
474
605
  @severity("critical")
475
- @tags("category:privacy,threat:pii,detection:pattern,compliance:gdpr")
476
- @reject_message("Content blocked: passport number patterns detected.")
606
+ @tags("category:privacy,threat:pii,detection:ml,owasp:llm06")
607
+ @reject_message("Content blocked: bank account (IBAN) number patterns detected.")
477
608
  forbid (
478
609
  principal,
479
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
610
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
480
611
  resource
481
612
  )
482
613
  when {
483
- context has pii_types && context.pii_types.contains("passport")
614
+ context has pii_types && context.pii_types.contains("ACCOUNT_NUMBER")
484
615
  };
485
616
 
486
- @id("privacy.block-iban")
487
- @name("Block bank account numbers")
488
- @description("Blocks process_prompt and upload_file when pii_types contains \\"iban\\".")
617
+ @id("privacy.block-pii-medical-model")
618
+ @name("Block medical identifiers (contextual)")
619
+ @description("Blocks prompts, pastes, and file uploads that contain medical data (record number, MBI, NPI, or blood type).")
620
+ @severity("medium")
621
+ @tags("category:privacy,threat:pii,detection:ml,compliance:hipaa,owasp:llm06")
622
+ @reject_message("Content blocked: medical record identifier patterns detected.")
623
+ forbid (
624
+ principal,
625
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
626
+ resource
627
+ )
628
+ when {
629
+ context has pii_types && context.pii_types.contains("MEDICAL")
630
+ };
631
+
632
+ @id("privacy.block-pii-credential-model")
633
+ @name("Block credentials (contextual)")
634
+ @description("Blocks prompts, pastes, and file uploads that contain a credential or secret (API key, token, password hash, or private key).")
489
635
  @severity("critical")
490
- @tags("category:privacy,threat:pii,detection:pattern,compliance:gdpr,compliance:pci-dss")
491
- @reject_message("Content blocked: bank account number (IBAN) patterns detected.")
636
+ @tags("category:privacy,threat:pii,detection:ml,owasp:llm06")
637
+ @reject_message("Content blocked: credential or API key patterns detected.")
492
638
  forbid (
493
639
  principal,
494
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
640
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
495
641
  resource
496
642
  )
497
643
  when {
498
- context has pii_types && context.pii_types.contains("iban")
644
+ context has pii_types && context.pii_types.contains("CREDENTIAL")
499
645
  };
646
+ `;
647
+ const SENTRY_PRIVACY_ADVANCED_PII_CEDAR = `// =============================================================================
648
+ // Comprehensive PII (Tier 3)
649
+ // =============================================================================
650
+ // 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.
651
+ //
652
+ // Sensitivity tiers and the structural (regex) / contextual (model) type
653
+ // vocabulary are defined canonically in schemas/_shared/pii_taxonomy.json and
654
+ // enforced by tools/lint-templates.
655
+ //
656
+ // Context keys consumed:
657
+ // - pii_types: Set<String> (union of structural lowercase + contextual uppercase types)
658
+ //
659
+ // Category: privacy
660
+ // Namespace: Sentry
661
+ // =============================================================================
500
662
 
501
- @id("privacy.block-pii-bulk")
502
- @name("Block bulk PII exposure")
503
- @description("Blocks process_prompt and upload_file when pii_count >= 3.")
663
+ @id("privacy.block-pii-national-id-all")
664
+ @name("Block national ID numbers (comprehensive)")
665
+ @description("Blocks prompts, pastes, and file uploads that contain a national ID (SSN, passport, or driver's license).")
666
+ @severity("high")
667
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
668
+ @reject_message("Content blocked: national identifier (SSN, passport, or driver's license) patterns detected.")
669
+ forbid (
670
+ principal,
671
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
672
+ resource
673
+ )
674
+ when {
675
+ context has pii_types &&
676
+ (
677
+ context.pii_types.contains("ssn") ||
678
+ context.pii_types.contains("passport") ||
679
+ context.pii_types.contains("national_id") ||
680
+ context.pii_types.contains("drivers_license") ||
681
+ context.pii_types.contains("NATIONAL_ID")
682
+ )
683
+ };
684
+
685
+ @id("privacy.block-pii-credit-card-all")
686
+ @name("Block credit card numbers (comprehensive)")
687
+ @description("Blocks prompts, pastes, and file uploads that contain a credit card number.")
504
688
  @severity("critical")
505
- @tags("category:privacy,threat:pii,threat:exfiltration,detection:aggregate,compliance:gdpr")
506
- @reject_message("Content blocked: 3+ PII items detected — bulk personal data must not be shared with AI services.")
689
+ @tags("category:privacy,threat:pii,detection:pattern,compliance:pci-dss,owasp:llm06")
690
+ @reject_message("Content blocked: credit card number patterns detected.")
507
691
  forbid (
508
692
  principal,
509
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
693
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
694
+ resource
695
+ )
696
+ when {
697
+ context has pii_types &&
698
+ (
699
+ context.pii_types.contains("credit_card") ||
700
+ context.pii_types.contains("CREDIT_CARD")
701
+ )
702
+ };
703
+
704
+ @id("privacy.block-pii-bank-account-all")
705
+ @name("Block bank account numbers (comprehensive)")
706
+ @description("Blocks prompts, pastes, and file uploads that contain a bank account number (IBAN, SWIFT/BIC, or routing number).")
707
+ @severity("critical")
708
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
709
+ @reject_message("Content blocked: bank account (IBAN) number patterns detected.")
710
+ forbid (
711
+ principal,
712
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
713
+ resource
714
+ )
715
+ when {
716
+ context has pii_types &&
717
+ (
718
+ context.pii_types.contains("iban") ||
719
+ context.pii_types.contains("bank_account") ||
720
+ context.pii_types.contains("swift_bic") ||
721
+ context.pii_types.contains("aba_routing") ||
722
+ context.pii_types.contains("ACCOUNT_NUMBER")
723
+ )
724
+ };
725
+
726
+ @id("privacy.block-pii-medical-all")
727
+ @name("Block medical identifiers (comprehensive)")
728
+ @description("Blocks prompts, pastes, and file uploads that contain medical data (record number, MBI, NPI, or blood type).")
729
+ @severity("medium")
730
+ @tags("category:privacy,threat:pii,detection:pattern,compliance:hipaa,owasp:llm06")
731
+ @reject_message("Content blocked: medical record identifier patterns detected.")
732
+ forbid (
733
+ principal,
734
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
510
735
  resource
511
736
  )
512
737
  when {
513
- context has pii_count && context.pii_count >= 3
738
+ context has pii_types &&
739
+ (
740
+ context.pii_types.contains("medical_record") ||
741
+ context.pii_types.contains("patient_record") ||
742
+ context.pii_types.contains("medicare_beneficiary_id") ||
743
+ context.pii_types.contains("npi") ||
744
+ context.pii_types.contains("medical_term") ||
745
+ context.pii_types.contains("blood_type") ||
746
+ context.pii_types.contains("MEDICAL")
747
+ )
514
748
  };
515
749
 
516
- // ---------------------------------------------------------------------------
517
- // Section 3: ML classifier and aggregation
518
- // ---------------------------------------------------------------------------
750
+ @id("privacy.block-pii-tax-id-all")
751
+ @name("Block tax identifiers (comprehensive)")
752
+ @description("Blocks prompts, pastes, and file uploads that contain a tax ID (ITIN, EIN, or PTIN).")
753
+ @severity("high")
754
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
755
+ @reject_message("Content blocked: tax identifier (ITIN or EIN) patterns detected.")
756
+ forbid (
757
+ principal,
758
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
759
+ resource
760
+ )
761
+ when {
762
+ context has pii_types &&
763
+ (
764
+ context.pii_types.contains("itin") ||
765
+ context.pii_types.contains("ein") ||
766
+ context.pii_types.contains("ptin")
767
+ )
768
+ };
519
769
 
520
- @id("privacy.block-pii-ml")
521
- @name("Block high-confidence PII (ML)")
522
- @description("Blocks process_prompt and upload_file when pii_score >= 80.")
770
+ @id("privacy.block-pii-credential-all")
771
+ @name("Block credentials (comprehensive)")
772
+ @description("Blocks prompts, pastes, and file uploads that contain a credential or secret (API key, token, password hash, or private key).")
523
773
  @severity("critical")
524
- @tags("category:privacy,threat:pii,detection:ml,compliance:gdpr,compliance:hipaa")
525
- @reject_message("Content blocked: the ML classifier detected personally identifiable information with high confidence.")
774
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
775
+ @reject_message("Content blocked: credential or API key patterns detected.")
526
776
  forbid (
527
777
  principal,
528
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
778
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
529
779
  resource
530
780
  )
531
781
  when {
532
- context has pii_score && context.pii_score >= 80
782
+ context has pii_types &&
783
+ (
784
+ context.pii_types.contains("aws_access_key") ||
785
+ context.pii_types.contains("api_key") ||
786
+ context.pii_types.contains("jwt_token") ||
787
+ context.pii_types.contains("encryption_key") ||
788
+ context.pii_types.contains("http_basic_auth") ||
789
+ context.pii_types.contains("gcp_credential") ||
790
+ context.pii_types.contains("gcp_api_key") ||
791
+ context.pii_types.contains("gcp_signed_policy") ||
792
+ context.pii_types.contains("session_cookie") ||
793
+ context.pii_types.contains("oauth_token") ||
794
+ context.pii_types.contains("tls_certificate") ||
795
+ context.pii_types.contains("password_hash") ||
796
+ context.pii_types.contains("csrf_token") ||
797
+ context.pii_types.contains("CREDENTIAL")
798
+ )
533
799
  };
534
800
 
535
- @id("privacy.block-pii-category")
536
- @name("Block PII threat category")
537
- @description("Blocks process_prompt and upload_file when threat_categories contains \\"pii\\".")
801
+ @id("privacy.block-pii-crypto-all")
802
+ @name("Block cryptocurrency addresses (comprehensive)")
803
+ @description("Blocks prompts, pastes, and file uploads that contain a cryptocurrency wallet address.")
538
804
  @severity("high")
539
- @tags("category:privacy,threat:pii,detection:aggregate,compliance:gdpr")
540
- @reject_message("Content blocked: threat scanners aggregated a PII threat category.")
805
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
806
+ @reject_message("Content blocked: cryptocurrency wallet address patterns detected.")
541
807
  forbid (
542
808
  principal,
543
- action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
809
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
810
+ resource
811
+ )
812
+ when {
813
+ context has pii_types &&
814
+ (
815
+ context.pii_types.contains("bitcoin_address") ||
816
+ context.pii_types.contains("ethereum_address")
817
+ )
818
+ };
819
+
820
+ @id("privacy.block-pii-names-all")
821
+ @name("Block personal names (comprehensive)")
822
+ @description("Blocks prompts, pastes, and file uploads that contain a personal name.")
823
+ @severity("low")
824
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
825
+ @reject_message("Content blocked: personal name patterns detected.")
826
+ forbid (
827
+ principal,
828
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
829
+ resource
830
+ )
831
+ when {
832
+ context has pii_types &&
833
+ (
834
+ context.pii_types.contains("person_name") ||
835
+ context.pii_types.contains("PERSON")
836
+ )
837
+ };
838
+
839
+ @id("privacy.block-pii-email-all")
840
+ @name("Block email addresses (comprehensive)")
841
+ @description("Blocks prompts, pastes, and file uploads that contain an email address.")
842
+ @severity("medium")
843
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
844
+ @reject_message("Content blocked: email address patterns detected.")
845
+ forbid (
846
+ principal,
847
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
544
848
  resource
545
849
  )
546
850
  when {
547
- context has threat_categories && context.threat_categories.contains("pii")
851
+ context has pii_types &&
852
+ (
853
+ context.pii_types.contains("email") ||
854
+ context.pii_types.contains("EMAIL_ADDRESS")
855
+ )
856
+ };
857
+
858
+ @id("privacy.block-pii-phone-all")
859
+ @name("Block phone numbers (comprehensive)")
860
+ @description("Blocks prompts, pastes, and file uploads that contain a phone number.")
861
+ @severity("medium")
862
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
863
+ @reject_message("Content blocked: phone number patterns detected.")
864
+ forbid (
865
+ principal,
866
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
867
+ resource
868
+ )
869
+ when {
870
+ context has pii_types &&
871
+ (
872
+ context.pii_types.contains("phone") ||
873
+ context.pii_types.contains("PHONE_NUMBER")
874
+ )
875
+ };
876
+
877
+ @id("privacy.block-pii-datetime-all")
878
+ @name("Block dates and times (comprehensive)")
879
+ @description("Blocks prompts, pastes, and file uploads that contain a date or time (date of birth, timestamp, or card expiry).")
880
+ @severity("medium")
881
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
882
+ @reject_message("Content blocked: date or time patterns detected.")
883
+ forbid (
884
+ principal,
885
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
886
+ resource
887
+ )
888
+ when {
889
+ context has pii_types &&
890
+ (
891
+ context.pii_types.contains("date_of_birth") ||
892
+ context.pii_types.contains("date_time") ||
893
+ context.pii_types.contains("time") ||
894
+ context.pii_types.contains("card_expiry") ||
895
+ context.pii_types.contains("DATE_TIME")
896
+ )
897
+ };
898
+
899
+ @id("privacy.block-pii-url-all")
900
+ @name("Block URLs (comprehensive)")
901
+ @description("Blocks prompts, pastes, and file uploads that contain a URL.")
902
+ @severity("low")
903
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
904
+ @reject_message("Content blocked: URL patterns detected.")
905
+ forbid (
906
+ principal,
907
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
908
+ resource
909
+ )
910
+ when {
911
+ context has pii_types &&
912
+ (
913
+ context.pii_types.contains("url") ||
914
+ context.pii_types.contains("URL")
915
+ )
916
+ };
917
+
918
+ @id("privacy.block-pii-location-all")
919
+ @name("Block locations (comprehensive)")
920
+ @description("Blocks prompts, pastes, and file uploads that contain a location (street address, postal code, or military address).")
921
+ @severity("low")
922
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
923
+ @reject_message("Content blocked: street address or location patterns detected.")
924
+ forbid (
925
+ principal,
926
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
927
+ resource
928
+ )
929
+ when {
930
+ context has pii_types &&
931
+ (
932
+ context.pii_types.contains("street_address") ||
933
+ context.pii_types.contains("zip_code") ||
934
+ context.pii_types.contains("military_address") ||
935
+ context.pii_types.contains("LOCATION")
936
+ )
937
+ };
938
+
939
+ @id("privacy.block-pii-organization-all")
940
+ @name("Block organization names (comprehensive)")
941
+ @description("Blocks prompts, pastes, and file uploads that contain an organization name.")
942
+ @severity("low")
943
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
944
+ @reject_message("Content blocked: organization name patterns detected.")
945
+ forbid (
946
+ principal,
947
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
948
+ resource
949
+ )
950
+ when {
951
+ context has pii_types &&
952
+ (
953
+ context.pii_types.contains("organization") ||
954
+ context.pii_types.contains("ORGANIZATION")
955
+ )
956
+ };
957
+
958
+ @id("privacy.block-pii-occupation-all")
959
+ @name("Block occupations (comprehensive)")
960
+ @description("Blocks prompts, pastes, and file uploads that contain an occupation.")
961
+ @severity("low")
962
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
963
+ @reject_message("Content blocked: occupation patterns detected.")
964
+ forbid (
965
+ principal,
966
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
967
+ resource
968
+ )
969
+ when {
970
+ context has pii_types &&
971
+ (
972
+ context.pii_types.contains("occupation") ||
973
+ context.pii_types.contains("OCCUPATION")
974
+ )
975
+ };
976
+
977
+ @id("privacy.block-pii-username-all")
978
+ @name("Block usernames (comprehensive)")
979
+ @description("Blocks prompts, pastes, and file uploads that contain a username.")
980
+ @severity("low")
981
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
982
+ @reject_message("Content blocked: username patterns detected.")
983
+ forbid (
984
+ principal,
985
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
986
+ resource
987
+ )
988
+ when {
989
+ context has pii_types &&
990
+ (
991
+ context.pii_types.contains("username") ||
992
+ context.pii_types.contains("USERNAME")
993
+ )
994
+ };
995
+
996
+ @id("privacy.block-pii-employee-customer-id-all")
997
+ @name("Block employee or customer IDs (comprehensive)")
998
+ @description("Blocks prompts, pastes, and file uploads that contain an employee or customer ID.")
999
+ @severity("medium")
1000
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
1001
+ @reject_message("Content blocked: employee or customer identifier patterns detected.")
1002
+ forbid (
1003
+ principal,
1004
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
1005
+ resource
1006
+ )
1007
+ when {
1008
+ context has pii_types &&
1009
+ (
1010
+ context.pii_types.contains("employee_id") ||
1011
+ context.pii_types.contains("customer_id") ||
1012
+ context.pii_types.contains("EMPLOYEE_ID") ||
1013
+ context.pii_types.contains("CUSTOMER_ID")
1014
+ )
1015
+ };
1016
+
1017
+ @id("privacy.block-pii-device-id-all")
1018
+ @name("Block device and network identifiers (comprehensive)")
1019
+ @description("Blocks prompts, pastes, and file uploads that contain a device or network identifier (IP, MAC, IMEI, or UUID).")
1020
+ @severity("medium")
1021
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
1022
+ @reject_message("Content blocked: device or network identifier patterns detected.")
1023
+ forbid (
1024
+ principal,
1025
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
1026
+ resource
1027
+ )
1028
+ when {
1029
+ context has pii_types &&
1030
+ (
1031
+ context.pii_types.contains("device_id") ||
1032
+ context.pii_types.contains("ip_address") ||
1033
+ context.pii_types.contains("ipv6_address") ||
1034
+ context.pii_types.contains("imei") ||
1035
+ context.pii_types.contains("device_serial") ||
1036
+ context.pii_types.contains("mac_address") ||
1037
+ context.pii_types.contains("user_agent") ||
1038
+ context.pii_types.contains("serial_number") ||
1039
+ context.pii_types.contains("uuid") ||
1040
+ context.pii_types.contains("DEVICE_ID")
1041
+ )
1042
+ };
1043
+
1044
+ @id("privacy.block-pii-vehicle-all")
1045
+ @name("Block vehicle identifiers (comprehensive)")
1046
+ @description("Blocks prompts, pastes, and file uploads that contain a vehicle identifier (VIN or license plate).")
1047
+ @severity("medium")
1048
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
1049
+ @reject_message("Content blocked: vehicle identifier (VIN or plate) patterns detected.")
1050
+ forbid (
1051
+ principal,
1052
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
1053
+ resource
1054
+ )
1055
+ when {
1056
+ context has pii_types &&
1057
+ (
1058
+ context.pii_types.contains("vin") ||
1059
+ context.pii_types.contains("license_plate") ||
1060
+ context.pii_types.contains("VEHICLE_IDENTIFIER")
1061
+ )
1062
+ };
1063
+
1064
+ @id("privacy.block-pii-financial-all")
1065
+ @name("Block financial amounts (comprehensive)")
1066
+ @description("Blocks prompts, pastes, and file uploads that contain a financial amount or transaction ID.")
1067
+ @severity("medium")
1068
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
1069
+ @reject_message("Content blocked: salary or financial amount patterns detected.")
1070
+ forbid (
1071
+ principal,
1072
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
1073
+ resource
1074
+ )
1075
+ when {
1076
+ context has pii_types &&
1077
+ (
1078
+ context.pii_types.contains("salary") ||
1079
+ context.pii_types.contains("financial_amount") ||
1080
+ context.pii_types.contains("transaction_id") ||
1081
+ context.pii_types.contains("FINANCIAL")
1082
+ )
1083
+ };
1084
+
1085
+ @id("privacy.block-pii-sensitive-attribute-all")
1086
+ @name("Block sensitive attributes (comprehensive)")
1087
+ @description("Blocks prompts, pastes, and file uploads that contain a sensitive personal attribute (ethnicity, religion, age, etc.).")
1088
+ @severity("high")
1089
+ @tags("category:privacy,threat:pii,detection:pattern,owasp:llm06")
1090
+ @reject_message("Content blocked: sensitive attribute (ethnicity, religion, etc.) patterns detected.")
1091
+ forbid (
1092
+ principal,
1093
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
1094
+ resource
1095
+ )
1096
+ when {
1097
+ context has pii_types &&
1098
+ (
1099
+ context.pii_types.contains("ethnicity") ||
1100
+ context.pii_types.contains("religion") ||
1101
+ context.pii_types.contains("sexual_orientation") ||
1102
+ context.pii_types.contains("political_affiliation") ||
1103
+ context.pii_types.contains("nationality") ||
1104
+ context.pii_types.contains("age") ||
1105
+ context.pii_types.contains("gender") ||
1106
+ context.pii_types.contains("marital_status") ||
1107
+ context.pii_types.contains("education_level") ||
1108
+ context.pii_types.contains("employment_status") ||
1109
+ context.pii_types.contains("SENSITIVE_ATTRIBUTE")
1110
+ )
548
1111
  };
549
1112
  `;
550
- const SENTRY_FILE_SAFETY_DEFAULTS_CEDAR = `// =============================================================================
1113
+ const SENTRY_FILE_SAFETY_BLOCK_UPLOAD_SECRETS_CEDAR = `// =============================================================================
551
1114
  // File & Attachment Safety (Default)
552
1115
  // =============================================================================
553
1116
  // Blocks file uploads to AI chat services when document content contains
554
- // secrets or PII.
1117
+ // secrets. PII in uploads is handled by the canonical privacy.* templates
1118
+ // (defaults/pii*.cedar), which scope to upload_file.
555
1119
  //
556
1120
  // Context keys consumed:
557
1121
  // - secrets_detected: Bool
558
- // - pii_detected: Bool
559
1122
  //
560
1123
  // Compliance:
561
1124
  // - NIST 800-53 SC-28; GDPR Art. 32
@@ -578,28 +1141,14 @@ forbid (
578
1141
  when {
579
1142
  context has secrets_detected && context.secrets_detected == true
580
1143
  };
581
-
582
- @id("file-safety.block-upload-pii")
583
- @name("Block file uploads with PII")
584
- @description("Blocks upload_file when pii_detected is true.")
585
- @severity("critical")
586
- @tags("category:file-safety,threat:pii,detection:rule,surface:upload-file,compliance:gdpr")
587
- @reject_message("File upload blocked: personally identifiable information detected in document content.")
588
- forbid (
589
- principal,
590
- action == Sentry::Action::"upload_file",
591
- resource
592
- )
593
- when {
594
- context has pii_detected && context.pii_detected == true
595
- };
596
1144
  `;
597
1145
  const SENTRY_CLIPBOARD_DEFAULTS_CEDAR = `// =============================================================================
598
1146
  // Clipboard Policy (Default)
599
1147
  // =============================================================================
600
1148
  // Controls paste operations into AI chat services. Covers blanket paste
601
- // blocking, paste-with-secrets, paste-with-PII, encoded payload pastes, and
602
- // pastes containing invisible Unicode characters.
1149
+ // blocking, paste-with-secrets, encoded payload pastes, and pastes containing
1150
+ // invisible Unicode characters. PII pastes are handled by the canonical
1151
+ // privacy.* templates (defaults/pii*.cedar), which scope to paste_content.
603
1152
  //
604
1153
  // All rules scope to action == "paste_content". Other templates
605
1154
  // (semantic, content_safety, pii, secrets) cover process_prompt and
@@ -607,7 +1156,6 @@ const SENTRY_CLIPBOARD_DEFAULTS_CEDAR = `// ====================================
607
1156
  //
608
1157
  // Context keys consumed:
609
1158
  // - secrets_detected: Bool
610
- // - pii_detected: Bool
611
1159
  // - encoded_content_detected: Bool
612
1160
  // - encoded_score: Long (0-100)
613
1161
  // - invisible_chars_detected: Bool
@@ -647,21 +1195,6 @@ when {
647
1195
  context has secrets_detected && context.secrets_detected == true
648
1196
  };
649
1197
 
650
- @id("clipboard.block-paste-pii")
651
- @name("Block paste with PII")
652
- @description("Blocks paste_content when pii_detected is true.")
653
- @severity("critical")
654
- @tags("category:clipboard,threat:pii,detection:rule,compliance:gdpr")
655
- @reject_message("Paste blocked: personally identifiable information detected in pasted content.")
656
- forbid (
657
- principal,
658
- action == Sentry::Action::"paste_content",
659
- resource
660
- )
661
- when {
662
- context has pii_detected && context.pii_detected == true
663
- };
664
-
665
1198
  @id("clipboard.block-paste-encoded")
666
1199
  @name("Block paste with encoded payloads")
667
1200
  @description("Blocks paste_content when encoded_content_detected is true and encoded_score >= 60.")
@@ -792,30 +1325,48 @@ export const SENTRY_TEMPLATES = [
792
1325
  },
793
1326
  {
794
1327
  id: 'privacy.defaults',
795
- name: 'PII Detection',
796
- description: 'Block credit card numbers, SSNs, passport/IBAN, and other PII across messages and file uploads.',
1328
+ name: 'Structural PII',
1329
+ 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.',
797
1330
  category: 'privacy',
798
1331
  cedarText: SENTRY_PRIVACY_DEFAULTS_CEDAR,
799
1332
  severity: 'critical',
800
- tags: ['category:privacy', 'threat:pii', 'compliance:pci-dss', 'compliance:gdpr', 'compliance:hipaa'],
1333
+ tags: ['category:privacy', 'threat:pii', 'detection:pattern', 'compliance:pci-dss', 'compliance:hipaa'],
1334
+ },
1335
+ {
1336
+ id: 'privacy.pii-model',
1337
+ name: 'Contextual PII',
1338
+ 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.',
1339
+ category: 'privacy',
1340
+ cedarText: SENTRY_PRIVACY_PII_MODEL_CEDAR,
1341
+ severity: 'critical',
1342
+ tags: ['category:privacy', 'threat:pii', 'detection:ml', 'compliance:pci-dss', 'compliance:hipaa'],
1343
+ },
1344
+ {
1345
+ id: 'privacy.advanced-pii',
1346
+ name: 'Comprehensive PII',
1347
+ 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.',
1348
+ category: 'privacy',
1349
+ cedarText: SENTRY_PRIVACY_ADVANCED_PII_CEDAR,
1350
+ severity: 'critical',
1351
+ tags: ['category:privacy', 'threat:pii', 'detection:pattern', 'compliance:pci-dss', 'compliance:hipaa'],
801
1352
  },
802
1353
  {
803
- id: 'file-safety.defaults',
1354
+ id: 'file-safety.block-upload-secrets',
804
1355
  name: 'File & Attachment Safety',
805
- description: 'Block file uploads containing secrets or PII in document content.',
1356
+ description: 'Block file uploads containing secrets in document content.',
806
1357
  category: 'file-safety',
807
- cedarText: SENTRY_FILE_SAFETY_DEFAULTS_CEDAR,
1358
+ cedarText: SENTRY_FILE_SAFETY_BLOCK_UPLOAD_SECRETS_CEDAR,
808
1359
  severity: 'critical',
809
- tags: ['category:file-safety', 'threat:secrets', 'threat:pii'],
1360
+ tags: ['category:file-safety', 'threat:secrets'],
810
1361
  },
811
1362
  {
812
1363
  id: 'clipboard.defaults',
813
1364
  name: 'Clipboard Policy',
814
- description: 'Block all-paste, paste-with-secrets, paste-with-PII, encoded payload pastes, and pastes with invisible characters.',
1365
+ description: 'Block all-paste, paste-with-secrets, encoded payload pastes, and pastes with invisible characters. PII pastes are handled by the privacy.* templates.',
815
1366
  category: 'clipboard',
816
1367
  cedarText: SENTRY_CLIPBOARD_DEFAULTS_CEDAR,
817
1368
  severity: 'critical',
818
- tags: ['category:clipboard', 'threat:secrets', 'threat:pii', 'threat:encoded-payload', 'threat:invisible-chars'],
1369
+ tags: ['category:clipboard', 'threat:secrets', 'threat:encoded-payload', 'threat:invisible-chars'],
819
1370
  },
820
1371
  {
821
1372
  id: 'organization.block-session-threat-escalation',
@@ -902,7 +1453,13 @@ export const SENTRY_TEMPLATES_JSON = `{
902
1453
  "category": "semantic",
903
1454
  "file": "defaults/semantic.cedar",
904
1455
  "severity": "critical",
905
- "tags": ["category:semantic", "threat:injection", "threat:jailbreak", "owasp:llm01", "owasp:llm02"]
1456
+ "tags": [
1457
+ "category:semantic",
1458
+ "threat:injection",
1459
+ "threat:jailbreak",
1460
+ "owasp:llm01",
1461
+ "owasp:llm02"
1462
+ ]
906
1463
  },
907
1464
  {
908
1465
  "id": "trust-safety.defaults",
@@ -911,7 +1468,13 @@ export const SENTRY_TEMPLATES_JSON = `{
911
1468
  "category": "trust-safety",
912
1469
  "file": "defaults/content_safety.cedar",
913
1470
  "severity": "critical",
914
- "tags": ["category:trust-safety", "threat:harmful", "threat:hate-speech", "compliance:eu-ai-act", "compliance:iso-42001"]
1471
+ "tags": [
1472
+ "category:trust-safety",
1473
+ "threat:harmful",
1474
+ "threat:hate-speech",
1475
+ "compliance:eu-ai-act",
1476
+ "compliance:iso-42001"
1477
+ ]
915
1478
  },
916
1479
  {
917
1480
  "id": "data-protection.defaults",
@@ -924,30 +1487,71 @@ export const SENTRY_TEMPLATES_JSON = `{
924
1487
  },
925
1488
  {
926
1489
  "id": "privacy.defaults",
927
- "name": "PII Detection",
928
- "description": "Block credit card numbers, SSNs, passport/IBAN, and other PII across messages and file uploads.",
1490
+ "name": "Structural PII",
1491
+ "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.",
929
1492
  "category": "privacy",
930
1493
  "file": "defaults/pii.cedar",
931
1494
  "severity": "critical",
932
- "tags": ["category:privacy", "threat:pii", "compliance:pci-dss", "compliance:gdpr", "compliance:hipaa"]
1495
+ "tags": [
1496
+ "category:privacy",
1497
+ "threat:pii",
1498
+ "detection:pattern",
1499
+ "compliance:pci-dss",
1500
+ "compliance:hipaa"
1501
+ ]
1502
+ },
1503
+ {
1504
+ "id": "privacy.pii-model",
1505
+ "name": "Contextual PII",
1506
+ "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.",
1507
+ "category": "privacy",
1508
+ "file": "defaults/pii_model.cedar",
1509
+ "severity": "critical",
1510
+ "tags": [
1511
+ "category:privacy",
1512
+ "threat:pii",
1513
+ "detection:ml",
1514
+ "compliance:pci-dss",
1515
+ "compliance:hipaa"
1516
+ ]
1517
+ },
1518
+ {
1519
+ "id": "privacy.advanced-pii",
1520
+ "name": "Comprehensive PII",
1521
+ "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.",
1522
+ "category": "privacy",
1523
+ "file": "defaults/pii_advanced.cedar",
1524
+ "severity": "critical",
1525
+ "tags": [
1526
+ "category:privacy",
1527
+ "threat:pii",
1528
+ "detection:pattern",
1529
+ "compliance:pci-dss",
1530
+ "compliance:hipaa"
1531
+ ]
933
1532
  },
934
1533
  {
935
- "id": "file-safety.defaults",
1534
+ "id": "file-safety.block-upload-secrets",
936
1535
  "name": "File & Attachment Safety",
937
- "description": "Block file uploads containing secrets or PII in document content.",
1536
+ "description": "Block file uploads containing secrets in document content.",
938
1537
  "category": "file-safety",
939
1538
  "file": "defaults/file_safety.cedar",
940
1539
  "severity": "critical",
941
- "tags": ["category:file-safety", "threat:secrets", "threat:pii"]
1540
+ "tags": ["category:file-safety", "threat:secrets"]
942
1541
  },
943
1542
  {
944
1543
  "id": "clipboard.defaults",
945
1544
  "name": "Clipboard Policy",
946
- "description": "Block all-paste, paste-with-secrets, paste-with-PII, encoded payload pastes, and pastes with invisible characters.",
1545
+ "description": "Block all-paste, paste-with-secrets, encoded payload pastes, and pastes with invisible characters. PII pastes are handled by the privacy.* templates.",
947
1546
  "category": "clipboard",
948
1547
  "file": "defaults/clipboard.cedar",
949
1548
  "severity": "critical",
950
- "tags": ["category:clipboard", "threat:secrets", "threat:pii", "threat:encoded-payload", "threat:invisible-chars"]
1549
+ "tags": [
1550
+ "category:clipboard",
1551
+ "threat:secrets",
1552
+ "threat:encoded-payload",
1553
+ "threat:invisible-chars"
1554
+ ]
951
1555
  },
952
1556
  {
953
1557
  "id": "organization.block-session-threat-escalation",
@@ -956,7 +1560,11 @@ export const SENTRY_TEMPLATES_JSON = `{
956
1560
  "category": "organization",
957
1561
  "file": "defaults/organization.cedar",
958
1562
  "severity": "high",
959
- "tags": ["category:organization", "detection:aggregate", "posture:catch-all"]
1563
+ "tags": [
1564
+ "category:organization",
1565
+ "detection:aggregate",
1566
+ "posture:catch-all"
1567
+ ]
960
1568
  }
961
1569
  ]
962
1570
  }