@highflame/policy 2.1.23 → 2.1.25
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.
- package/_schemas/ai_gateway/schema.cedarschema +70 -0
- package/_schemas/guardrails/context.json +1 -1
- package/_schemas/guardrails/schema.cedarschema +75 -3
- package/_schemas/mcp_gateway/schema.cedarschema +70 -0
- package/_schemas/sentry/templates/defaults/clipboard.cedar +76 -0
- package/_schemas/sentry/templates/defaults/file_safety.cedar +7 -7
- package/_schemas/sentry/templates/defaults/organization.cedar +10 -159
- package/_schemas/sentry/templates/defaults/pii.cedar +0 -32
- package/_schemas/sentry/templates/defaults/secrets.cedar +155 -0
- package/_schemas/sentry/templates/templates.json +38 -12
- package/dist/engine.d.ts +37 -0
- package/dist/engine.js +56 -0
- package/dist/sentry-defaults.gen.d.ts +1 -1
- package/dist/sentry-defaults.gen.js +284 -188
- package/dist/service-schemas.gen.d.ts +2 -2
- package/dist/service-schemas.gen.js +146 -4
- package/package.json +1 -1
|
@@ -433,6 +433,162 @@ when {
|
|
|
433
433
|
context has hate_speech_score && context.hate_speech_score >= 75
|
|
434
434
|
};
|
|
435
435
|
`;
|
|
436
|
+
const SENTRY_SENTRY_SECRETS_DEFAULT_CEDAR = `// =============================================================================
|
|
437
|
+
// Secrets Detection Policy (Default)
|
|
438
|
+
// =============================================================================
|
|
439
|
+
// Block credential and secret leakage across messages and AI responses.
|
|
440
|
+
// Shield SecretsDetector identifies 18+ secret types via regex.
|
|
441
|
+
//
|
|
442
|
+
// Paste-targeted secret rules live in clipboard.cedar; this file covers
|
|
443
|
+
// non-paste channels (messages, responses, and cross-cutting rules).
|
|
444
|
+
//
|
|
445
|
+
// Category: secrets
|
|
446
|
+
// Namespace: Sentry
|
|
447
|
+
// =============================================================================
|
|
448
|
+
|
|
449
|
+
// Block messages containing secrets
|
|
450
|
+
@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.")
|
|
453
|
+
@severity("critical")
|
|
454
|
+
@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.")
|
|
456
|
+
forbid (
|
|
457
|
+
principal,
|
|
458
|
+
action == Sentry::Action::"send_message",
|
|
459
|
+
resource
|
|
460
|
+
)
|
|
461
|
+
when {
|
|
462
|
+
context has contains_secrets && context.contains_secrets
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// Block high-risk secret types across all actions
|
|
466
|
+
@id("sentry-org-block-high-risk-secrets")
|
|
467
|
+
@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.")
|
|
469
|
+
@severity("critical")
|
|
470
|
+
@tags("secrets,aws,github,ssh,cloud,nist-ia-5,mitre-t1552")
|
|
471
|
+
@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
|
+
forbid (
|
|
473
|
+
principal,
|
|
474
|
+
action,
|
|
475
|
+
resource
|
|
476
|
+
)
|
|
477
|
+
when {
|
|
478
|
+
context has secret_types &&
|
|
479
|
+
(context.secret_types.contains("aws_access_key") ||
|
|
480
|
+
context.secret_types.contains("aws_secret_key") ||
|
|
481
|
+
context.secret_types.contains("gcp_service_account") ||
|
|
482
|
+
context.secret_types.contains("azure_connection_string") ||
|
|
483
|
+
context.secret_types.contains("github_token") ||
|
|
484
|
+
context.secret_types.contains("github_fine_grained") ||
|
|
485
|
+
context.secret_types.contains("private_key"))
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
// Block API keys and tokens across all actions
|
|
489
|
+
@id("sentry-org-block-api-keys")
|
|
490
|
+
@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.")
|
|
492
|
+
@severity("high")
|
|
493
|
+
@tags("secrets,api-key,jwt,oauth,nist-ia-5")
|
|
494
|
+
@reject_message("Content blocked: API keys, JWT tokens, or OAuth credentials detected. These must never be shared with AI services.")
|
|
495
|
+
forbid (
|
|
496
|
+
principal,
|
|
497
|
+
action,
|
|
498
|
+
resource
|
|
499
|
+
)
|
|
500
|
+
when {
|
|
501
|
+
context has secret_types &&
|
|
502
|
+
(context.secret_types.contains("generic_api_key") ||
|
|
503
|
+
context.secret_types.contains("jwt_token") ||
|
|
504
|
+
context.secret_types.contains("openai_key") ||
|
|
505
|
+
context.secret_types.contains("anthropic_key") ||
|
|
506
|
+
context.secret_types.contains("stripe_key"))
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
// Block SSH key exposure across messages, paste, and file uploads
|
|
510
|
+
@id("sentry-secrets-block-ssh-keys")
|
|
511
|
+
@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.")
|
|
513
|
+
@severity("critical")
|
|
514
|
+
@tags("secrets,ssh,credentials,nist-ia-5,mitre-t1552")
|
|
515
|
+
@reject_message("Blocked: SSH private key content or key file path detected. AI chat services must not receive SSH credentials.")
|
|
516
|
+
forbid (
|
|
517
|
+
principal,
|
|
518
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
519
|
+
resource
|
|
520
|
+
)
|
|
521
|
+
when {
|
|
522
|
+
context has secret_types && context.secret_types.contains("ssh_key")
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
// Block PEM/certificate key exposure across messages, paste, and file uploads
|
|
526
|
+
@id("sentry-secrets-block-pem-keys")
|
|
527
|
+
@name("Block PEM/certificate key exposure")
|
|
528
|
+
@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.")
|
|
529
|
+
@severity("critical")
|
|
530
|
+
@tags("secrets,certificates,pem,nist-ia-5,mitre-t1552")
|
|
531
|
+
@reject_message("Blocked: PEM private key or certificate key file detected. AI chat services must not receive certificate credentials.")
|
|
532
|
+
forbid (
|
|
533
|
+
principal,
|
|
534
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
535
|
+
resource
|
|
536
|
+
)
|
|
537
|
+
when {
|
|
538
|
+
context has secret_types && context.secret_types.contains("pem_certificate")
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
// Block bulk secret exposure
|
|
542
|
+
@id("sentry-org-block-bulk-secrets")
|
|
543
|
+
@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.")
|
|
545
|
+
@severity("critical")
|
|
546
|
+
@tags("secrets,bulk,data-exfiltration,nist-sc-28")
|
|
547
|
+
@reject_message("Content blocked: multiple credentials detected (3+). Configuration dumps and credential lists must never be shared with AI services.")
|
|
548
|
+
forbid (
|
|
549
|
+
principal,
|
|
550
|
+
action,
|
|
551
|
+
resource
|
|
552
|
+
)
|
|
553
|
+
when {
|
|
554
|
+
context has secret_count && context.secret_count >= 3
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
// Block detected credential patterns
|
|
558
|
+
@id("sentry-org-block-detected-credentials")
|
|
559
|
+
@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.")
|
|
561
|
+
@severity("critical")
|
|
562
|
+
@tags("secrets,credentials,detection-rules,nist-ia-5")
|
|
563
|
+
@reject_message("Content blocked: detection engines identified credential patterns including secret exposure, API keys, or token leaks.")
|
|
564
|
+
forbid (
|
|
565
|
+
principal,
|
|
566
|
+
action,
|
|
567
|
+
resource
|
|
568
|
+
)
|
|
569
|
+
when {
|
|
570
|
+
context has detected_threats &&
|
|
571
|
+
(context.detected_threats.contains("secret_exposure") ||
|
|
572
|
+
context.detected_threats.contains("credential_leak") ||
|
|
573
|
+
context.detected_threats.contains("api_key_exposure"))
|
|
574
|
+
};
|
|
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
|
const SENTRY_SENTRY_PII_DEFAULT_CEDAR = `// =============================================================================
|
|
437
593
|
// PII Detection Policy (Default)
|
|
438
594
|
// =============================================================================
|
|
@@ -481,38 +637,6 @@ when {
|
|
|
481
637
|
context has pii_detected && context.pii_detected
|
|
482
638
|
};
|
|
483
639
|
|
|
484
|
-
// Block pasted content containing PII
|
|
485
|
-
@id("sentry-pii-block-paste")
|
|
486
|
-
@name("Block paste with PII")
|
|
487
|
-
@description("Block paste operations when PII is detected in pasted content. Prevents data leakage when employees paste content from emails, spreadsheets, or documents containing personal data into AI chats.")
|
|
488
|
-
@severity("critical")
|
|
489
|
-
@tags("pii,paste-safety,data-leakage,gdpr-art-32")
|
|
490
|
-
@reject_message("Paste blocked: personally identifiable information detected in pasted content. Remove PII before pasting into AI services.")
|
|
491
|
-
forbid (
|
|
492
|
-
principal,
|
|
493
|
-
action == Sentry::Action::"paste_content",
|
|
494
|
-
resource
|
|
495
|
-
)
|
|
496
|
-
when {
|
|
497
|
-
context has pii_detected && context.pii_detected
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
// Block file uploads containing PII
|
|
501
|
-
@id("sentry-pii-block-uploads")
|
|
502
|
-
@name("Block file uploads with PII")
|
|
503
|
-
@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.")
|
|
504
|
-
@severity("critical")
|
|
505
|
-
@tags("pii,file-upload,data-protection,gdpr-art-32")
|
|
506
|
-
@reject_message("File upload blocked: personally identifiable information detected in the document. Files containing PII must not be shared with AI services.")
|
|
507
|
-
forbid (
|
|
508
|
-
principal,
|
|
509
|
-
action == Sentry::Action::"upload_file",
|
|
510
|
-
resource
|
|
511
|
-
)
|
|
512
|
-
when {
|
|
513
|
-
context has pii_detected && context.pii_detected
|
|
514
|
-
};
|
|
515
|
-
|
|
516
640
|
// ---------------------------------------------------------------------------
|
|
517
641
|
// Section 2: Granular PII Type Blocking
|
|
518
642
|
// Blocks specific PII types based on regulatory requirements.
|
|
@@ -762,20 +886,20 @@ when {
|
|
|
762
886
|
context has contains_secrets && context.contains_secrets
|
|
763
887
|
};
|
|
764
888
|
|
|
765
|
-
// Block
|
|
766
|
-
@id("sentry-
|
|
767
|
-
@name("Block
|
|
768
|
-
@description("Block file uploads
|
|
889
|
+
// Block file uploads containing PII
|
|
890
|
+
@id("sentry-pii-block-uploads")
|
|
891
|
+
@name("Block file uploads with PII")
|
|
892
|
+
@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.")
|
|
769
893
|
@severity("critical")
|
|
770
|
-
@tags("pii,file-upload,
|
|
771
|
-
@reject_message("
|
|
894
|
+
@tags("pii,file-upload,data-protection,gdpr-art-32")
|
|
895
|
+
@reject_message("File upload blocked: personally identifiable information detected in the document. Files containing PII must not be shared with AI services.")
|
|
772
896
|
forbid (
|
|
773
897
|
principal,
|
|
774
898
|
action == Sentry::Action::"upload_file",
|
|
775
899
|
resource
|
|
776
900
|
)
|
|
777
901
|
when {
|
|
778
|
-
context has
|
|
902
|
+
context has pii_detected && context.pii_detected
|
|
779
903
|
};
|
|
780
904
|
|
|
781
905
|
// Block files with phishing links
|
|
@@ -838,42 +962,33 @@ when {
|
|
|
838
962
|
context has code_ratio && context.code_ratio > 80
|
|
839
963
|
};
|
|
840
964
|
`;
|
|
841
|
-
const
|
|
842
|
-
//
|
|
965
|
+
const SENTRY_SENTRY_CLIPBOARD_DEFAULT_CEDAR = `// =============================================================================
|
|
966
|
+
// Clipboard Policy (Default)
|
|
843
967
|
// =============================================================================
|
|
844
|
-
//
|
|
845
|
-
// -
|
|
846
|
-
// -
|
|
847
|
-
// -
|
|
968
|
+
// Controls over paste operations into AI chat services. Covers:
|
|
969
|
+
// - Blanket paste blocking (admin-configurable)
|
|
970
|
+
// - Paste-with-secrets blocking
|
|
971
|
+
// - Paste-with-source-code blocking
|
|
848
972
|
//
|
|
849
|
-
//
|
|
850
|
-
//
|
|
973
|
+
// Cross-cutting secret rules (e.g. high-risk credential types) are defined
|
|
974
|
+
// in secrets.cedar and apply to paste content as well.
|
|
851
975
|
//
|
|
852
|
-
// Category:
|
|
976
|
+
// Category: clipboard
|
|
853
977
|
// Namespace: Sentry
|
|
854
978
|
// =============================================================================
|
|
855
979
|
|
|
856
|
-
//
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
@id("sentry-org-block-secrets-messages")
|
|
864
|
-
@name("Block messages with secrets")
|
|
865
|
-
@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.")
|
|
866
|
-
@severity("critical")
|
|
867
|
-
@tags("secrets,credentials,messages,nist-sc-28,nist-ia-5")
|
|
868
|
-
@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.")
|
|
980
|
+
// Block all paste operations
|
|
981
|
+
@id("sentry-org-block-all-paste")
|
|
982
|
+
@name("Block all paste operations")
|
|
983
|
+
@description("Unconditionally block all paste operations into AI chat services. Enable this rule to prevent any content from being pasted into AI chats regardless of content. Disable to allow paste (subject to other policy rules).")
|
|
984
|
+
@severity("high")
|
|
985
|
+
@tags("paste,clipboard,data-protection,organization")
|
|
986
|
+
@reject_message("Paste blocked: your organization does not allow pasting content into AI services. Type your message directly or contact your administrator.")
|
|
869
987
|
forbid (
|
|
870
988
|
principal,
|
|
871
|
-
action == Sentry::Action::"
|
|
989
|
+
action == Sentry::Action::"paste_content",
|
|
872
990
|
resource
|
|
873
|
-
)
|
|
874
|
-
when {
|
|
875
|
-
context has contains_secrets && context.contains_secrets
|
|
876
|
-
};
|
|
991
|
+
);
|
|
877
992
|
|
|
878
993
|
// Block pasted content containing secrets
|
|
879
994
|
@id("sentry-org-block-secrets-paste")
|
|
@@ -891,88 +1006,58 @@ when {
|
|
|
891
1006
|
context has contains_secrets && context.contains_secrets
|
|
892
1007
|
};
|
|
893
1008
|
|
|
894
|
-
// Block
|
|
895
|
-
@id("sentry-
|
|
896
|
-
@name("Block
|
|
897
|
-
@description("Block
|
|
1009
|
+
// Block pasted content containing PII
|
|
1010
|
+
@id("sentry-pii-block-paste")
|
|
1011
|
+
@name("Block paste with PII")
|
|
1012
|
+
@description("Block paste operations when PII is detected in pasted content. Prevents data leakage when employees paste content from emails, spreadsheets, or documents containing personal data into AI chats.")
|
|
898
1013
|
@severity("critical")
|
|
899
|
-
@tags("
|
|
900
|
-
@reject_message("
|
|
1014
|
+
@tags("pii,paste-safety,data-leakage,gdpr-art-32")
|
|
1015
|
+
@reject_message("Paste blocked: personally identifiable information detected in pasted content. Remove PII before pasting into AI services.")
|
|
901
1016
|
forbid (
|
|
902
1017
|
principal,
|
|
903
|
-
action,
|
|
1018
|
+
action == Sentry::Action::"paste_content",
|
|
904
1019
|
resource
|
|
905
1020
|
)
|
|
906
1021
|
when {
|
|
907
|
-
context has
|
|
908
|
-
(context.secret_types.contains("aws_access_key") ||
|
|
909
|
-
context.secret_types.contains("aws_secret_key") ||
|
|
910
|
-
context.secret_types.contains("gcp_service_account") ||
|
|
911
|
-
context.secret_types.contains("azure_connection_string") ||
|
|
912
|
-
context.secret_types.contains("github_token") ||
|
|
913
|
-
context.secret_types.contains("github_fine_grained") ||
|
|
914
|
-
context.secret_types.contains("private_key"))
|
|
1022
|
+
context has pii_detected && context.pii_detected
|
|
915
1023
|
};
|
|
916
1024
|
|
|
917
|
-
// Block
|
|
918
|
-
@id("sentry-org-block-
|
|
919
|
-
@name("Block
|
|
920
|
-
@description("Block
|
|
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.")
|
|
921
1029
|
@severity("high")
|
|
922
|
-
@tags("
|
|
923
|
-
@reject_message("
|
|
924
|
-
forbid (
|
|
925
|
-
principal,
|
|
926
|
-
action,
|
|
927
|
-
resource
|
|
928
|
-
)
|
|
929
|
-
when {
|
|
930
|
-
context has secret_types &&
|
|
931
|
-
(context.secret_types.contains("generic_api_key") ||
|
|
932
|
-
context.secret_types.contains("jwt_token") ||
|
|
933
|
-
context.secret_types.contains("openai_key") ||
|
|
934
|
-
context.secret_types.contains("anthropic_key") ||
|
|
935
|
-
context.secret_types.contains("stripe_key"))
|
|
936
|
-
};
|
|
937
|
-
|
|
938
|
-
// Block bulk secret exposure
|
|
939
|
-
@id("sentry-org-block-bulk-secrets")
|
|
940
|
-
@name("Block bulk secret exposure")
|
|
941
|
-
@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.")
|
|
942
|
-
@severity("critical")
|
|
943
|
-
@tags("secrets,bulk,data-exfiltration,nist-sc-28")
|
|
944
|
-
@reject_message("Content blocked: multiple credentials detected (3+). Configuration dumps and credential lists must never be shared with AI services.")
|
|
945
|
-
forbid (
|
|
946
|
-
principal,
|
|
947
|
-
action,
|
|
948
|
-
resource
|
|
949
|
-
)
|
|
950
|
-
when {
|
|
951
|
-
context has secret_count && context.secret_count >= 3
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
// Block detected credential patterns
|
|
955
|
-
@id("sentry-org-block-detected-credentials")
|
|
956
|
-
@name("Block detected credential patterns")
|
|
957
|
-
@description("Block content flagged by detection engine rules for credential exposure, API key leaks, and token exposure. Defense-in-depth behind contains_secrets.")
|
|
958
|
-
@severity("critical")
|
|
959
|
-
@tags("secrets,credentials,detection-rules,nist-ia-5")
|
|
960
|
-
@reject_message("Content blocked: detection engines identified credential patterns including secret exposure, API keys, or token leaks.")
|
|
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.")
|
|
961
1032
|
forbid (
|
|
962
1033
|
principal,
|
|
963
|
-
action,
|
|
1034
|
+
action == Sentry::Action::"paste_content",
|
|
964
1035
|
resource
|
|
965
1036
|
)
|
|
966
1037
|
when {
|
|
967
|
-
context has
|
|
968
|
-
|
|
969
|
-
context.detected_threats.contains("credential_leak") ||
|
|
970
|
-
context.detected_threats.contains("api_key_exposure"))
|
|
1038
|
+
context has contains_code && context.contains_code &&
|
|
1039
|
+
context has code_ratio && context.code_ratio > 80
|
|
971
1040
|
};
|
|
1041
|
+
`;
|
|
1042
|
+
const SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR = `// =============================================================================
|
|
1043
|
+
// Organization Rules Policy (Default)
|
|
1044
|
+
// =============================================================================
|
|
1045
|
+
// Cross-cutting organization-wide rules that don't fit other categories.
|
|
1046
|
+
// Secret/credential rules live in secrets.cedar; paste/clipboard rules live
|
|
1047
|
+
// in clipboard.cedar.
|
|
1048
|
+
//
|
|
1049
|
+
// This template covers:
|
|
1050
|
+
// - Source code protection in messages (non-paste channels)
|
|
1051
|
+
// - Session-aware threat escalation
|
|
1052
|
+
//
|
|
1053
|
+
// Category: organization
|
|
1054
|
+
// Namespace: Sentry
|
|
1055
|
+
// =============================================================================
|
|
972
1056
|
|
|
973
1057
|
// ---------------------------------------------------------------------------
|
|
974
|
-
// Section
|
|
975
|
-
// Prevent bulk source code from being shared
|
|
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.
|
|
976
1061
|
// ---------------------------------------------------------------------------
|
|
977
1062
|
|
|
978
1063
|
// Block messages with high code content
|
|
@@ -992,25 +1077,8 @@ when {
|
|
|
992
1077
|
context has code_ratio && context.code_ratio > 80
|
|
993
1078
|
};
|
|
994
1079
|
|
|
995
|
-
// Block pasted source code
|
|
996
|
-
@id("sentry-org-block-code-paste")
|
|
997
|
-
@name("Block pasted source code")
|
|
998
|
-
@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.")
|
|
999
|
-
@severity("high")
|
|
1000
|
-
@tags("source-code,paste-safety,ip-protection,data-leakage")
|
|
1001
|
-
@reject_message("Paste blocked: the content appears to be primarily source code (>80%). Pasting bulk source code into AI services risks intellectual property exposure.")
|
|
1002
|
-
forbid (
|
|
1003
|
-
principal,
|
|
1004
|
-
action == Sentry::Action::"paste_content",
|
|
1005
|
-
resource
|
|
1006
|
-
)
|
|
1007
|
-
when {
|
|
1008
|
-
context has contains_code && context.contains_code &&
|
|
1009
|
-
context has code_ratio && context.code_ratio > 80
|
|
1010
|
-
};
|
|
1011
|
-
|
|
1012
1080
|
// ---------------------------------------------------------------------------
|
|
1013
|
-
// Section
|
|
1081
|
+
// Section 2: Session-Aware Escalation
|
|
1014
1082
|
// Escalate protections when threats are detected across the session.
|
|
1015
1083
|
// ---------------------------------------------------------------------------
|
|
1016
1084
|
|
|
@@ -1029,32 +1097,18 @@ forbid (
|
|
|
1029
1097
|
when {
|
|
1030
1098
|
context has session_threat_turns && context.session_threat_turns >= 3
|
|
1031
1099
|
};
|
|
1032
|
-
|
|
1033
|
-
// Block AI responses when session has leaked secrets
|
|
1034
|
-
@id("sentry-org-session-secrets-response")
|
|
1035
|
-
@name("Block responses after secret detection")
|
|
1036
|
-
@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.")
|
|
1037
|
-
@severity("high")
|
|
1038
|
-
@tags("session,secrets,response-safety,defense-in-depth")
|
|
1039
|
-
@reject_message("AI response blocked: secrets were detected in an earlier message in this session. Responses may contain or reference the exposed credentials.")
|
|
1040
|
-
forbid (
|
|
1041
|
-
principal,
|
|
1042
|
-
action == Sentry::Action::"receive_response",
|
|
1043
|
-
resource
|
|
1044
|
-
)
|
|
1045
|
-
when {
|
|
1046
|
-
context has session_secrets_detected && context.session_secrets_detected
|
|
1047
|
-
};
|
|
1048
1100
|
`;
|
|
1049
1101
|
// =============================================================================
|
|
1050
1102
|
// CATEGORIES
|
|
1051
1103
|
// =============================================================================
|
|
1052
1104
|
export const SENTRY_CATEGORIES = [
|
|
1105
|
+
{ id: 'secrets', name: 'Secrets Detection', description: 'Detect and block secrets, API keys, tokens, and other credentials in messages and AI responses' },
|
|
1053
1106
|
{ 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' },
|
|
1054
1107
|
{ 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' },
|
|
1055
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' },
|
|
1056
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' },
|
|
1057
|
-
{ id: '
|
|
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' },
|
|
1058
1112
|
];
|
|
1059
1113
|
// =============================================================================
|
|
1060
1114
|
// DEFAULT POLICIES
|
|
@@ -1070,6 +1124,11 @@ export const SENTRY_DEFAULTS = [
|
|
|
1070
1124
|
tags: ['baseline', 'permit-default', 'organization'],
|
|
1071
1125
|
isActive: true,
|
|
1072
1126
|
},
|
|
1127
|
+
];
|
|
1128
|
+
// =============================================================================
|
|
1129
|
+
// ALL TEMPLATES
|
|
1130
|
+
// =============================================================================
|
|
1131
|
+
export const SENTRY_TEMPLATES = [
|
|
1073
1132
|
{
|
|
1074
1133
|
id: 'sentry-semantic-default',
|
|
1075
1134
|
name: 'Semantic Threat Detection',
|
|
@@ -1078,7 +1137,6 @@ export const SENTRY_DEFAULTS = [
|
|
|
1078
1137
|
cedarText: SENTRY_SENTRY_SEMANTIC_DEFAULT_CEDAR,
|
|
1079
1138
|
severity: 'critical',
|
|
1080
1139
|
tags: ['injection', 'jailbreak', 'owasp-llm01', 'owasp-llm02', 'baseline'],
|
|
1081
|
-
isActive: true,
|
|
1082
1140
|
},
|
|
1083
1141
|
{
|
|
1084
1142
|
id: 'sentry-content-safety-default',
|
|
@@ -1088,13 +1146,16 @@ export const SENTRY_DEFAULTS = [
|
|
|
1088
1146
|
cedarText: SENTRY_SENTRY_CONTENT_SAFETY_DEFAULT_CEDAR,
|
|
1089
1147
|
severity: 'critical',
|
|
1090
1148
|
tags: ['violence', 'hate-speech', 'sexual', 'profanity', 'content-safety', 'paste-safety', 'baseline'],
|
|
1091
|
-
isActive: true,
|
|
1092
1149
|
},
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1150
|
+
{
|
|
1151
|
+
id: 'sentry-secrets-default',
|
|
1152
|
+
name: 'Secrets Detection',
|
|
1153
|
+
description: 'Block secrets, API keys, tokens, and credential leakage in messages and AI responses across all interactions',
|
|
1154
|
+
category: 'secrets',
|
|
1155
|
+
cedarText: SENTRY_SENTRY_SECRETS_DEFAULT_CEDAR,
|
|
1156
|
+
severity: 'critical',
|
|
1157
|
+
tags: ['secrets', 'credentials', 'api-keys', 'data-protection'],
|
|
1158
|
+
},
|
|
1098
1159
|
{
|
|
1099
1160
|
id: 'sentry-pii-default',
|
|
1100
1161
|
name: 'PII Detection',
|
|
@@ -1113,14 +1174,23 @@ export const SENTRY_TEMPLATES = [
|
|
|
1113
1174
|
severity: 'critical',
|
|
1114
1175
|
tags: ['mip', 'document-sensitivity', 'file-upload', 'dlp', 'compliance'],
|
|
1115
1176
|
},
|
|
1177
|
+
{
|
|
1178
|
+
id: 'sentry-clipboard-default',
|
|
1179
|
+
name: 'Clipboard Policy',
|
|
1180
|
+
description: 'Control paste into AI chat services: blanket paste blocking, secrets-in-paste blocking, and source-code-in-paste blocking',
|
|
1181
|
+
category: 'clipboard',
|
|
1182
|
+
cedarText: SENTRY_SENTRY_CLIPBOARD_DEFAULT_CEDAR,
|
|
1183
|
+
severity: 'high',
|
|
1184
|
+
tags: ['paste', 'clipboard', 'data-protection', 'source-code', 'secrets'],
|
|
1185
|
+
},
|
|
1116
1186
|
{
|
|
1117
1187
|
id: 'sentry-organization-default',
|
|
1118
1188
|
name: 'Organization Rules',
|
|
1119
|
-
description: '
|
|
1189
|
+
description: 'Cross-cutting organization-wide policies: source code protection in messages and session-aware threat escalation',
|
|
1120
1190
|
category: 'organization',
|
|
1121
1191
|
cedarText: SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR,
|
|
1122
|
-
severity: '
|
|
1123
|
-
tags: ['
|
|
1192
|
+
severity: 'high',
|
|
1193
|
+
tags: ['source-code', 'session', 'escalation', 'organization'],
|
|
1124
1194
|
},
|
|
1125
1195
|
];
|
|
1126
1196
|
// =============================================================================
|
|
@@ -1132,6 +1202,11 @@ export const SENTRY_TEMPLATES_JSON = `{
|
|
|
1132
1202
|
"version": "1.0.0",
|
|
1133
1203
|
"description": "Sentry policy templates for browser AI security",
|
|
1134
1204
|
"categories": [
|
|
1205
|
+
{
|
|
1206
|
+
"id": "secrets",
|
|
1207
|
+
"name": "Secrets Detection",
|
|
1208
|
+
"description": "Detect and block secrets, API keys, tokens, and other credentials in messages and AI responses"
|
|
1209
|
+
},
|
|
1135
1210
|
{
|
|
1136
1211
|
"id": "pii",
|
|
1137
1212
|
"name": "PII Detection",
|
|
@@ -1152,10 +1227,15 @@ export const SENTRY_TEMPLATES_JSON = `{
|
|
|
1152
1227
|
"name": "File & Attachment Safety",
|
|
1153
1228
|
"description": "Enforce document sensitivity controls (MIP labels), block sensitive file uploads, detect secrets and PII in uploaded documents"
|
|
1154
1229
|
},
|
|
1230
|
+
{
|
|
1231
|
+
"id": "clipboard",
|
|
1232
|
+
"name": "Clipboard Policy",
|
|
1233
|
+
"description": "Control paste operations into AI chat services — block paste outright, block when secrets or source code are detected"
|
|
1234
|
+
},
|
|
1155
1235
|
{
|
|
1156
1236
|
"id": "organization",
|
|
1157
1237
|
"name": "Organization Rules",
|
|
1158
|
-
"description": "
|
|
1238
|
+
"description": "Cross-cutting organization-wide rules: source code protection in messages and session-aware threat escalation"
|
|
1159
1239
|
}
|
|
1160
1240
|
],
|
|
1161
1241
|
"defaults": [
|
|
@@ -1168,7 +1248,9 @@ export const SENTRY_TEMPLATES_JSON = `{
|
|
|
1168
1248
|
"severity": "low",
|
|
1169
1249
|
"tags": ["baseline", "permit-default", "organization"],
|
|
1170
1250
|
"is_active": true
|
|
1171
|
-
}
|
|
1251
|
+
}
|
|
1252
|
+
],
|
|
1253
|
+
"templates": [
|
|
1172
1254
|
{
|
|
1173
1255
|
"id": "sentry-semantic-default",
|
|
1174
1256
|
"name": "Semantic Threat Detection",
|
|
@@ -1176,8 +1258,7 @@ export const SENTRY_TEMPLATES_JSON = `{
|
|
|
1176
1258
|
"category": "semantic",
|
|
1177
1259
|
"file": "defaults/semantic.cedar",
|
|
1178
1260
|
"severity": "critical",
|
|
1179
|
-
"tags": ["injection", "jailbreak", "owasp-llm01", "owasp-llm02", "baseline"]
|
|
1180
|
-
"is_active": true
|
|
1261
|
+
"tags": ["injection", "jailbreak", "owasp-llm01", "owasp-llm02", "baseline"]
|
|
1181
1262
|
},
|
|
1182
1263
|
{
|
|
1183
1264
|
"id": "sentry-content-safety-default",
|
|
@@ -1186,11 +1267,17 @@ export const SENTRY_TEMPLATES_JSON = `{
|
|
|
1186
1267
|
"category": "content_safety",
|
|
1187
1268
|
"file": "defaults/content_safety.cedar",
|
|
1188
1269
|
"severity": "critical",
|
|
1189
|
-
"tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "paste-safety", "baseline"]
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1270
|
+
"tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "paste-safety", "baseline"]
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
"id": "sentry-secrets-default",
|
|
1274
|
+
"name": "Secrets Detection",
|
|
1275
|
+
"description": "Block secrets, API keys, tokens, and credential leakage in messages and AI responses across all interactions",
|
|
1276
|
+
"category": "secrets",
|
|
1277
|
+
"file": "defaults/secrets.cedar",
|
|
1278
|
+
"severity": "critical",
|
|
1279
|
+
"tags": ["secrets", "credentials", "api-keys", "data-protection"]
|
|
1280
|
+
},
|
|
1194
1281
|
{
|
|
1195
1282
|
"id": "sentry-pii-default",
|
|
1196
1283
|
"name": "PII Detection",
|
|
@@ -1209,14 +1296,23 @@ export const SENTRY_TEMPLATES_JSON = `{
|
|
|
1209
1296
|
"severity": "critical",
|
|
1210
1297
|
"tags": ["mip", "document-sensitivity", "file-upload", "dlp", "compliance"]
|
|
1211
1298
|
},
|
|
1299
|
+
{
|
|
1300
|
+
"id": "sentry-clipboard-default",
|
|
1301
|
+
"name": "Clipboard Policy",
|
|
1302
|
+
"description": "Control paste into AI chat services: blanket paste blocking, secrets-in-paste blocking, and source-code-in-paste blocking",
|
|
1303
|
+
"category": "clipboard",
|
|
1304
|
+
"file": "defaults/clipboard.cedar",
|
|
1305
|
+
"severity": "high",
|
|
1306
|
+
"tags": ["paste", "clipboard", "data-protection", "source-code", "secrets"]
|
|
1307
|
+
},
|
|
1212
1308
|
{
|
|
1213
1309
|
"id": "sentry-organization-default",
|
|
1214
1310
|
"name": "Organization Rules",
|
|
1215
|
-
"description": "
|
|
1311
|
+
"description": "Cross-cutting organization-wide policies: source code protection in messages and session-aware threat escalation",
|
|
1216
1312
|
"category": "organization",
|
|
1217
1313
|
"file": "defaults/organization.cedar",
|
|
1218
|
-
"severity": "
|
|
1219
|
-
"tags": ["
|
|
1314
|
+
"severity": "high",
|
|
1315
|
+
"tags": ["source-code", "session", "escalation", "organization"]
|
|
1220
1316
|
}
|
|
1221
1317
|
]
|
|
1222
1318
|
}
|