@highflame/policy 2.1.23 → 2.1.24

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.
@@ -29,7 +29,7 @@
29
29
  "key": "content_type",
30
30
  "type": "string",
31
31
  "required": true,
32
- "description": "Type of content being analyzed: 'prompt', 'response', 'tool_call', or 'file'"
32
+ "description": "Type of content being analyzed: 'prompt', 'response', 'tool_call', 'file', or 'clipboard'"
33
33
  },
34
34
  {
35
35
  "key": "detector_count",
@@ -0,0 +1,76 @@
1
+ // =============================================================================
2
+ // Clipboard Policy (Default)
3
+ // =============================================================================
4
+ // Controls over paste operations into AI chat services. Covers:
5
+ // - Blanket paste blocking (admin-configurable)
6
+ // - Paste-with-secrets blocking
7
+ // - Paste-with-source-code blocking
8
+ //
9
+ // Cross-cutting secret rules (e.g. high-risk credential types) are defined
10
+ // in secrets.cedar and apply to paste content as well.
11
+ //
12
+ // Category: clipboard
13
+ // Namespace: Sentry
14
+ // =============================================================================
15
+
16
+ // Block all paste operations
17
+ @id("sentry-org-block-all-paste")
18
+ @name("Block all paste operations")
19
+ @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).")
20
+ @severity("high")
21
+ @tags("paste,clipboard,data-protection,organization")
22
+ @reject_message("Paste blocked: your organization does not allow pasting content into AI services. Type your message directly or contact your administrator.")
23
+ forbid (
24
+ principal,
25
+ action == Sentry::Action::"paste_content",
26
+ resource
27
+ );
28
+
29
+ // Block pasted content containing secrets
30
+ @id("sentry-org-block-secrets-paste")
31
+ @name("Block paste with secrets")
32
+ @description("Block paste operations when secrets are detected. Prevents credential leakage when users paste from terminals, config files, or code editors into AI chats.")
33
+ @severity("critical")
34
+ @tags("secrets,paste-safety,credentials,nist-sc-28")
35
+ @reject_message("Paste blocked: secrets or credentials detected in pasted content. Remove API keys, tokens, and passwords before pasting into AI services.")
36
+ forbid (
37
+ principal,
38
+ action == Sentry::Action::"paste_content",
39
+ resource
40
+ )
41
+ when {
42
+ context has contains_secrets && context.contains_secrets
43
+ };
44
+
45
+ // Block pasted content containing PII
46
+ @id("sentry-pii-block-paste")
47
+ @name("Block paste with PII")
48
+ @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.")
49
+ @severity("critical")
50
+ @tags("pii,paste-safety,data-leakage,gdpr-art-32")
51
+ @reject_message("Paste blocked: personally identifiable information detected in pasted content. Remove PII before pasting into AI services.")
52
+ forbid (
53
+ principal,
54
+ action == Sentry::Action::"paste_content",
55
+ resource
56
+ )
57
+ when {
58
+ context has pii_detected && context.pii_detected
59
+ };
60
+
61
+ // Block pasted source code
62
+ @id("sentry-org-block-code-paste")
63
+ @name("Block pasted source code")
64
+ @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.")
65
+ @severity("high")
66
+ @tags("source-code,paste-safety,ip-protection,data-leakage")
67
+ @reject_message("Paste blocked: the content appears to be primarily source code (>80%). Pasting bulk source code into AI services risks intellectual property exposure.")
68
+ forbid (
69
+ principal,
70
+ action == Sentry::Action::"paste_content",
71
+ resource
72
+ )
73
+ when {
74
+ context has contains_code && context.contains_code &&
75
+ context has code_ratio && context.code_ratio > 80
76
+ };
@@ -97,20 +97,20 @@ when {
97
97
  context has contains_secrets && context.contains_secrets
98
98
  };
99
99
 
100
- // Block files with bulk PII
101
- @id("sentry-file-block-bulk-pii")
102
- @name("Block files with bulk PII")
103
- @description("Block file uploads containing 3 or more PII matches. Files with bulk PII likely contain customer lists, employee records, or patient data that must not be shared with AI services.")
100
+ // Block file uploads containing PII
101
+ @id("sentry-pii-block-uploads")
102
+ @name("Block file uploads with PII")
103
+ @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.")
104
104
  @severity("critical")
105
- @tags("pii,file-upload,bulk,gdpr-art-32")
106
- @reject_message("Upload blocked: multiple PII items detected in the file (3+). Documents containing bulk personal data must not be shared with AI services.")
105
+ @tags("pii,file-upload,data-protection,gdpr-art-32")
106
+ @reject_message("File upload blocked: personally identifiable information detected in the document. Files containing PII must not be shared with AI services.")
107
107
  forbid (
108
108
  principal,
109
109
  action == Sentry::Action::"upload_file",
110
110
  resource
111
111
  )
112
112
  when {
113
- context has pii_count && context.pii_count >= 3
113
+ context has pii_detected && context.pii_detected
114
114
  };
115
115
 
116
116
  // Block files with phishing links
@@ -1,138 +1,22 @@
1
1
  // =============================================================================
2
2
  // Organization Rules Policy (Default)
3
3
  // =============================================================================
4
- // Organization-wide security policies for browser AI interactions:
5
- // - Credential/secret leakage prevention across all channels
6
- // - Source code protection
7
- // - Session-aware escalation
4
+ // Cross-cutting organization-wide rules that don't fit other categories.
5
+ // Secret/credential rules live in secrets.cedar; paste/clipboard rules live
6
+ // in clipboard.cedar.
8
7
  //
9
- // These rules complement category-specific policies (PII, Content Safety,
10
- // File Safety) with cross-cutting organizational controls.
8
+ // This template covers:
9
+ // - Source code protection in messages (non-paste channels)
10
+ // - Session-aware threat escalation
11
11
  //
12
12
  // Category: organization
13
13
  // Namespace: Sentry
14
14
  // =============================================================================
15
15
 
16
16
  // ---------------------------------------------------------------------------
17
- // Section 1: Credential & Secret Leakage Prevention
18
- // Block secrets/credentials across messages, pastes, and file uploads.
19
- // Shield SecretsDetector identifies 18+ secret types via regex.
20
- // ---------------------------------------------------------------------------
21
-
22
- // Block messages containing secrets
23
- @id("sentry-org-block-secrets-messages")
24
- @name("Block messages with secrets")
25
- @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.")
26
- @severity("critical")
27
- @tags("secrets,credentials,messages,nist-sc-28,nist-ia-5")
28
- @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.")
29
- forbid (
30
- principal,
31
- action == Sentry::Action::"send_message",
32
- resource
33
- )
34
- when {
35
- context has contains_secrets && context.contains_secrets
36
- };
37
-
38
- // Block pasted content containing secrets
39
- @id("sentry-org-block-secrets-paste")
40
- @name("Block paste with secrets")
41
- @description("Block paste operations when secrets are detected. Prevents credential leakage when users paste from terminals, config files, or code editors into AI chats.")
42
- @severity("critical")
43
- @tags("secrets,paste-safety,credentials,nist-sc-28")
44
- @reject_message("Paste blocked: secrets or credentials detected in pasted content. Remove API keys, tokens, and passwords before pasting into AI services.")
45
- forbid (
46
- principal,
47
- action == Sentry::Action::"paste_content",
48
- resource
49
- )
50
- when {
51
- context has contains_secrets && context.contains_secrets
52
- };
53
-
54
- // Block high-risk secret types across all actions
55
- @id("sentry-org-block-high-risk-secrets")
56
- @name("Block high-risk credential types")
57
- @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.")
58
- @severity("critical")
59
- @tags("secrets,aws,github,ssh,cloud,nist-ia-5,mitre-t1552")
60
- @reject_message("Content blocked: high-risk credentials detected (cloud keys, GitHub tokens, SSH keys). Use a secrets manager — never share credentials with AI services.")
61
- forbid (
62
- principal,
63
- action,
64
- resource
65
- )
66
- when {
67
- context has secret_types &&
68
- (context.secret_types.contains("aws_access_key") ||
69
- context.secret_types.contains("aws_secret_key") ||
70
- context.secret_types.contains("gcp_service_account") ||
71
- context.secret_types.contains("azure_connection_string") ||
72
- context.secret_types.contains("github_token") ||
73
- context.secret_types.contains("github_fine_grained") ||
74
- context.secret_types.contains("private_key"))
75
- };
76
-
77
- // Block API keys and tokens across all actions
78
- @id("sentry-org-block-api-keys")
79
- @name("Block API keys and tokens")
80
- @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.")
81
- @severity("high")
82
- @tags("secrets,api-key,jwt,oauth,nist-ia-5")
83
- @reject_message("Content blocked: API keys, JWT tokens, or OAuth credentials detected. These must never be shared with AI services.")
84
- forbid (
85
- principal,
86
- action,
87
- resource
88
- )
89
- when {
90
- context has secret_types &&
91
- (context.secret_types.contains("generic_api_key") ||
92
- context.secret_types.contains("jwt_token") ||
93
- context.secret_types.contains("openai_key") ||
94
- context.secret_types.contains("anthropic_key") ||
95
- context.secret_types.contains("stripe_key"))
96
- };
97
-
98
- // Block bulk secret exposure
99
- @id("sentry-org-block-bulk-secrets")
100
- @name("Block bulk secret exposure")
101
- @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.")
102
- @severity("critical")
103
- @tags("secrets,bulk,data-exfiltration,nist-sc-28")
104
- @reject_message("Content blocked: multiple credentials detected (3+). Configuration dumps and credential lists must never be shared with AI services.")
105
- forbid (
106
- principal,
107
- action,
108
- resource
109
- )
110
- when {
111
- context has secret_count && context.secret_count >= 3
112
- };
113
-
114
- // Block detected credential patterns
115
- @id("sentry-org-block-detected-credentials")
116
- @name("Block detected credential patterns")
117
- @description("Block content flagged by detection engine rules for credential exposure, API key leaks, and token exposure. Defense-in-depth behind contains_secrets.")
118
- @severity("critical")
119
- @tags("secrets,credentials,detection-rules,nist-ia-5")
120
- @reject_message("Content blocked: detection engines identified credential patterns including secret exposure, API keys, or token leaks.")
121
- forbid (
122
- principal,
123
- action,
124
- resource
125
- )
126
- when {
127
- context has detected_threats &&
128
- (context.detected_threats.contains("secret_exposure") ||
129
- context.detected_threats.contains("credential_leak") ||
130
- context.detected_threats.contains("api_key_exposure"))
131
- };
132
-
133
- // ---------------------------------------------------------------------------
134
- // Section 2: Source Code Protection
135
- // Prevent bulk source code from being shared with AI services.
17
+ // Section 1: Source Code Protection (Messages)
18
+ // Prevent bulk source code from being shared via messages.
19
+ // Paste-targeted code protection is in clipboard.cedar.
136
20
  // ---------------------------------------------------------------------------
137
21
 
138
22
  // Block messages with high code content
@@ -152,25 +36,8 @@ when {
152
36
  context has code_ratio && context.code_ratio > 80
153
37
  };
154
38
 
155
- // Block pasted source code
156
- @id("sentry-org-block-code-paste")
157
- @name("Block pasted source code")
158
- @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.")
159
- @severity("high")
160
- @tags("source-code,paste-safety,ip-protection,data-leakage")
161
- @reject_message("Paste blocked: the content appears to be primarily source code (>80%). Pasting bulk source code into AI services risks intellectual property exposure.")
162
- forbid (
163
- principal,
164
- action == Sentry::Action::"paste_content",
165
- resource
166
- )
167
- when {
168
- context has contains_code && context.contains_code &&
169
- context has code_ratio && context.code_ratio > 80
170
- };
171
-
172
39
  // ---------------------------------------------------------------------------
173
- // Section 3: Session-Aware Escalation
40
+ // Section 2: Session-Aware Escalation
174
41
  // Escalate protections when threats are detected across the session.
175
42
  // ---------------------------------------------------------------------------
176
43
 
@@ -189,19 +56,3 @@ forbid (
189
56
  when {
190
57
  context has session_threat_turns && context.session_threat_turns >= 3
191
58
  };
192
-
193
- // Block AI responses when session has leaked secrets
194
- @id("sentry-org-session-secrets-response")
195
- @name("Block responses after secret detection")
196
- @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.")
197
- @severity("high")
198
- @tags("session,secrets,response-safety,defense-in-depth")
199
- @reject_message("AI response blocked: secrets were detected in an earlier message in this session. Responses may contain or reference the exposed credentials.")
200
- forbid (
201
- principal,
202
- action == Sentry::Action::"receive_response",
203
- resource
204
- )
205
- when {
206
- context has session_secrets_detected && context.session_secrets_detected
207
- };
@@ -46,38 +46,6 @@ when {
46
46
  context has pii_detected && context.pii_detected
47
47
  };
48
48
 
49
- // Block pasted content containing PII
50
- @id("sentry-pii-block-paste")
51
- @name("Block paste with PII")
52
- @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.")
53
- @severity("critical")
54
- @tags("pii,paste-safety,data-leakage,gdpr-art-32")
55
- @reject_message("Paste blocked: personally identifiable information detected in pasted content. Remove PII before pasting into AI services.")
56
- forbid (
57
- principal,
58
- action == Sentry::Action::"paste_content",
59
- resource
60
- )
61
- when {
62
- context has pii_detected && context.pii_detected
63
- };
64
-
65
- // Block file uploads containing PII
66
- @id("sentry-pii-block-uploads")
67
- @name("Block file uploads with PII")
68
- @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.")
69
- @severity("critical")
70
- @tags("pii,file-upload,data-protection,gdpr-art-32")
71
- @reject_message("File upload blocked: personally identifiable information detected in the document. Files containing PII must not be shared with AI services.")
72
- forbid (
73
- principal,
74
- action == Sentry::Action::"upload_file",
75
- resource
76
- )
77
- when {
78
- context has pii_detected && context.pii_detected
79
- };
80
-
81
49
  // ---------------------------------------------------------------------------
82
50
  // Section 2: Granular PII Type Blocking
83
51
  // Blocks specific PII types based on regulatory requirements.
@@ -0,0 +1,155 @@
1
+ // =============================================================================
2
+ // Secrets Detection Policy (Default)
3
+ // =============================================================================
4
+ // Block credential and secret leakage across messages and AI responses.
5
+ // Shield SecretsDetector identifies 18+ secret types via regex.
6
+ //
7
+ // Paste-targeted secret rules live in clipboard.cedar; this file covers
8
+ // non-paste channels (messages, responses, and cross-cutting rules).
9
+ //
10
+ // Category: secrets
11
+ // Namespace: Sentry
12
+ // =============================================================================
13
+
14
+ // Block messages containing secrets
15
+ @id("sentry-org-block-secrets-messages")
16
+ @name("Block messages with secrets")
17
+ @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.")
18
+ @severity("critical")
19
+ @tags("secrets,credentials,messages,nist-sc-28,nist-ia-5")
20
+ @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.")
21
+ forbid (
22
+ principal,
23
+ action == Sentry::Action::"send_message",
24
+ resource
25
+ )
26
+ when {
27
+ context has contains_secrets && context.contains_secrets
28
+ };
29
+
30
+ // Block high-risk secret types across all actions
31
+ @id("sentry-org-block-high-risk-secrets")
32
+ @name("Block high-risk credential types")
33
+ @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.")
34
+ @severity("critical")
35
+ @tags("secrets,aws,github,ssh,cloud,nist-ia-5,mitre-t1552")
36
+ @reject_message("Content blocked: high-risk credentials detected (cloud keys, GitHub tokens, SSH keys). Use a secrets manager — never share credentials with AI services.")
37
+ forbid (
38
+ principal,
39
+ action,
40
+ resource
41
+ )
42
+ when {
43
+ context has secret_types &&
44
+ (context.secret_types.contains("aws_access_key") ||
45
+ context.secret_types.contains("aws_secret_key") ||
46
+ context.secret_types.contains("gcp_service_account") ||
47
+ context.secret_types.contains("azure_connection_string") ||
48
+ context.secret_types.contains("github_token") ||
49
+ context.secret_types.contains("github_fine_grained") ||
50
+ context.secret_types.contains("private_key"))
51
+ };
52
+
53
+ // Block API keys and tokens across all actions
54
+ @id("sentry-org-block-api-keys")
55
+ @name("Block API keys and tokens")
56
+ @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.")
57
+ @severity("high")
58
+ @tags("secrets,api-key,jwt,oauth,nist-ia-5")
59
+ @reject_message("Content blocked: API keys, JWT tokens, or OAuth credentials detected. These must never be shared with AI services.")
60
+ forbid (
61
+ principal,
62
+ action,
63
+ resource
64
+ )
65
+ when {
66
+ context has secret_types &&
67
+ (context.secret_types.contains("generic_api_key") ||
68
+ context.secret_types.contains("jwt_token") ||
69
+ context.secret_types.contains("openai_key") ||
70
+ context.secret_types.contains("anthropic_key") ||
71
+ context.secret_types.contains("stripe_key"))
72
+ };
73
+
74
+ // Block SSH key exposure across messages, paste, and file uploads
75
+ @id("sentry-secrets-block-ssh-keys")
76
+ @name("Block SSH key exposure")
77
+ @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.")
78
+ @severity("critical")
79
+ @tags("secrets,ssh,credentials,nist-ia-5,mitre-t1552")
80
+ @reject_message("Blocked: SSH private key content or key file path detected. AI chat services must not receive SSH credentials.")
81
+ forbid (
82
+ principal,
83
+ action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
84
+ resource
85
+ )
86
+ when {
87
+ context has secret_types && context.secret_types.contains("ssh_key")
88
+ };
89
+
90
+ // Block PEM/certificate key exposure across messages, paste, and file uploads
91
+ @id("sentry-secrets-block-pem-keys")
92
+ @name("Block PEM/certificate key exposure")
93
+ @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.")
94
+ @severity("critical")
95
+ @tags("secrets,certificates,pem,nist-ia-5,mitre-t1552")
96
+ @reject_message("Blocked: PEM private key or certificate key file detected. AI chat services must not receive certificate credentials.")
97
+ forbid (
98
+ principal,
99
+ action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
100
+ resource
101
+ )
102
+ when {
103
+ context has secret_types && context.secret_types.contains("pem_certificate")
104
+ };
105
+
106
+ // Block bulk secret exposure
107
+ @id("sentry-org-block-bulk-secrets")
108
+ @name("Block bulk secret exposure")
109
+ @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.")
110
+ @severity("critical")
111
+ @tags("secrets,bulk,data-exfiltration,nist-sc-28")
112
+ @reject_message("Content blocked: multiple credentials detected (3+). Configuration dumps and credential lists must never be shared with AI services.")
113
+ forbid (
114
+ principal,
115
+ action,
116
+ resource
117
+ )
118
+ when {
119
+ context has secret_count && context.secret_count >= 3
120
+ };
121
+
122
+ // Block detected credential patterns
123
+ @id("sentry-org-block-detected-credentials")
124
+ @name("Block detected credential patterns")
125
+ @description("Block content flagged by detection engine rules for credential exposure, API key leaks, and token exposure. Defense-in-depth behind contains_secrets.")
126
+ @severity("critical")
127
+ @tags("secrets,credentials,detection-rules,nist-ia-5")
128
+ @reject_message("Content blocked: detection engines identified credential patterns including secret exposure, API keys, or token leaks.")
129
+ forbid (
130
+ principal,
131
+ action,
132
+ resource
133
+ )
134
+ when {
135
+ context has detected_threats &&
136
+ (context.detected_threats.contains("secret_exposure") ||
137
+ context.detected_threats.contains("credential_leak") ||
138
+ context.detected_threats.contains("api_key_exposure"))
139
+ };
140
+
141
+ // Block AI responses when session has leaked secrets
142
+ @id("sentry-org-session-secrets-response")
143
+ @name("Block responses after secret detection")
144
+ @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.")
145
+ @severity("high")
146
+ @tags("session,secrets,response-safety,defense-in-depth")
147
+ @reject_message("AI response blocked: secrets were detected in an earlier message in this session. Responses may contain or reference the exposed credentials.")
148
+ forbid (
149
+ principal,
150
+ action == Sentry::Action::"receive_response",
151
+ resource
152
+ )
153
+ when {
154
+ context has session_secrets_detected && context.session_secrets_detected
155
+ };
@@ -3,6 +3,11 @@
3
3
  "version": "1.0.0",
4
4
  "description": "Sentry policy templates for browser AI security",
5
5
  "categories": [
6
+ {
7
+ "id": "secrets",
8
+ "name": "Secrets Detection",
9
+ "description": "Detect and block secrets, API keys, tokens, and other credentials in messages and AI responses"
10
+ },
6
11
  {
7
12
  "id": "pii",
8
13
  "name": "PII Detection",
@@ -23,10 +28,15 @@
23
28
  "name": "File & Attachment Safety",
24
29
  "description": "Enforce document sensitivity controls (MIP labels), block sensitive file uploads, detect secrets and PII in uploaded documents"
25
30
  },
31
+ {
32
+ "id": "clipboard",
33
+ "name": "Clipboard Policy",
34
+ "description": "Control paste operations into AI chat services — block paste outright, block when secrets or source code are detected"
35
+ },
26
36
  {
27
37
  "id": "organization",
28
38
  "name": "Organization Rules",
29
- "description": "Organization-wide baselines, AI service allowlists, credential leakage prevention, and source code protection"
39
+ "description": "Cross-cutting organization-wide rules: source code protection in messages and session-aware threat escalation"
30
40
  }
31
41
  ],
32
42
  "defaults": [
@@ -39,7 +49,9 @@
39
49
  "severity": "low",
40
50
  "tags": ["baseline", "permit-default", "organization"],
41
51
  "is_active": true
42
- },
52
+ }
53
+ ],
54
+ "templates": [
43
55
  {
44
56
  "id": "sentry-semantic-default",
45
57
  "name": "Semantic Threat Detection",
@@ -47,8 +59,7 @@
47
59
  "category": "semantic",
48
60
  "file": "defaults/semantic.cedar",
49
61
  "severity": "critical",
50
- "tags": ["injection", "jailbreak", "owasp-llm01", "owasp-llm02", "baseline"],
51
- "is_active": true
62
+ "tags": ["injection", "jailbreak", "owasp-llm01", "owasp-llm02", "baseline"]
52
63
  },
53
64
  {
54
65
  "id": "sentry-content-safety-default",
@@ -57,11 +68,17 @@
57
68
  "category": "content_safety",
58
69
  "file": "defaults/content_safety.cedar",
59
70
  "severity": "critical",
60
- "tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "paste-safety", "baseline"],
61
- "is_active": true
62
- }
63
- ],
64
- "templates": [
71
+ "tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "paste-safety", "baseline"]
72
+ },
73
+ {
74
+ "id": "sentry-secrets-default",
75
+ "name": "Secrets Detection",
76
+ "description": "Block secrets, API keys, tokens, and credential leakage in messages and AI responses across all interactions",
77
+ "category": "secrets",
78
+ "file": "defaults/secrets.cedar",
79
+ "severity": "critical",
80
+ "tags": ["secrets", "credentials", "api-keys", "data-protection"]
81
+ },
65
82
  {
66
83
  "id": "sentry-pii-default",
67
84
  "name": "PII Detection",
@@ -80,14 +97,23 @@
80
97
  "severity": "critical",
81
98
  "tags": ["mip", "document-sensitivity", "file-upload", "dlp", "compliance"]
82
99
  },
100
+ {
101
+ "id": "sentry-clipboard-default",
102
+ "name": "Clipboard Policy",
103
+ "description": "Control paste into AI chat services: blanket paste blocking, secrets-in-paste blocking, and source-code-in-paste blocking",
104
+ "category": "clipboard",
105
+ "file": "defaults/clipboard.cedar",
106
+ "severity": "high",
107
+ "tags": ["paste", "clipboard", "data-protection", "source-code", "secrets"]
108
+ },
83
109
  {
84
110
  "id": "sentry-organization-default",
85
111
  "name": "Organization Rules",
86
- "description": "Organization-wide policies: credential leakage prevention, source code protection, and secrets blocking across all interactions",
112
+ "description": "Cross-cutting organization-wide policies: source code protection in messages and session-aware threat escalation",
87
113
  "category": "organization",
88
114
  "file": "defaults/organization.cedar",
89
- "severity": "critical",
90
- "tags": ["secrets", "credentials", "source-code", "data-protection", "organization"]
115
+ "severity": "high",
116
+ "tags": ["source-code", "session", "escalation", "organization"]
91
117
  }
92
118
  ]
93
119
  }
@@ -2,7 +2,7 @@
2
2
  * Sentry policy category identifiers.
3
3
  * Maps to UI tab names in Studio.
4
4
  */
5
- export type SentryCategory = 'pii' | 'semantic' | 'content_safety' | 'file_safety' | 'organization';
5
+ export type SentryCategory = 'secrets' | 'pii' | 'semantic' | 'content_safety' | 'file_safety' | 'clipboard' | 'organization';
6
6
  /**
7
7
  * Category metadata for UI display.
8
8
  */
@@ -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 files with bulk PII
766
- @id("sentry-file-block-bulk-pii")
767
- @name("Block files with bulk PII")
768
- @description("Block file uploads containing 3 or more PII matches. Files with bulk PII likely contain customer lists, employee records, or patient data that must not be shared with AI services.")
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,bulk,gdpr-art-32")
771
- @reject_message("Upload blocked: multiple PII items detected in the file (3+). Documents containing bulk personal data must not be shared with AI services.")
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 pii_count && context.pii_count >= 3
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 SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR = `// =============================================================================
842
- // Organization Rules Policy (Default)
965
+ const SENTRY_SENTRY_CLIPBOARD_DEFAULT_CEDAR = `// =============================================================================
966
+ // Clipboard Policy (Default)
843
967
  // =============================================================================
844
- // Organization-wide security policies for browser AI interactions:
845
- // - Credential/secret leakage prevention across all channels
846
- // - Source code protection
847
- // - Session-aware escalation
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
- // These rules complement category-specific policies (PII, Content Safety,
850
- // File Safety) with cross-cutting organizational controls.
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: organization
976
+ // Category: clipboard
853
977
  // Namespace: Sentry
854
978
  // =============================================================================
855
979
 
856
- // ---------------------------------------------------------------------------
857
- // Section 1: Credential & Secret Leakage Prevention
858
- // Block secrets/credentials across messages, pastes, and file uploads.
859
- // Shield SecretsDetector identifies 18+ secret types via regex.
860
- // ---------------------------------------------------------------------------
861
-
862
- // Block messages containing secrets
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::"send_message",
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 high-risk secret types across all actions
895
- @id("sentry-org-block-high-risk-secrets")
896
- @name("Block high-risk credential types")
897
- @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.")
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("secrets,aws,github,ssh,cloud,nist-ia-5,mitre-t1552")
900
- @reject_message("Content blocked: high-risk credentials detected (cloud keys, GitHub tokens, SSH keys). Use a secrets manager never share credentials with AI services.")
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 secret_types &&
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 API keys and tokens across all actions
918
- @id("sentry-org-block-api-keys")
919
- @name("Block API keys and tokens")
920
- @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.")
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("secrets,api-key,jwt,oauth,nist-ia-5")
923
- @reject_message("Content blocked: API keys, JWT tokens, or OAuth credentials detected. These must never be shared with AI services.")
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 detected_threats &&
968
- (context.detected_threats.contains("secret_exposure") ||
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 2: Source Code Protection
975
- // Prevent bulk source code from being shared with AI services.
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 3: Session-Aware Escalation
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: 'organization', name: 'Organization Rules', description: 'Organization-wide baselines, AI service allowlists, credential leakage prevention, and source code protection' },
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
- // ALL TEMPLATES
1096
- // =============================================================================
1097
- export const SENTRY_TEMPLATES = [
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: 'Organization-wide policies: credential leakage prevention, source code protection, and secrets blocking across all interactions',
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: 'critical',
1123
- tags: ['secrets', 'credentials', 'source-code', 'data-protection', 'organization'],
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": "Organization-wide baselines, AI service allowlists, credential leakage prevention, and source code protection"
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
- "is_active": true
1191
- }
1192
- ],
1193
- "templates": [
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": "Organization-wide policies: credential leakage prevention, source code protection, and secrets blocking across all interactions",
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": "critical",
1219
- "tags": ["secrets", "credentials", "source-code", "data-protection", "organization"]
1314
+ "severity": "high",
1315
+ "tags": ["source-code", "session", "escalation", "organization"]
1220
1316
  }
1221
1317
  ]
1222
1318
  }
@@ -1941,7 +1941,7 @@ export const GUARDRAILS_CONTEXT = {
1941
1941
  { "key": "request_id", "type": "string", "required": true, "description": "Unique identifier for this request, useful for audit trails and debugging" },
1942
1942
  { "key": "timestamp", "type": "number", "required": true, "description": "Unix timestamp in milliseconds when the request was processed" },
1943
1943
  { "key": "direction", "type": "string", "required": true, "description": "Content flow direction: \'input\' for user prompts, \'output\' for AI responses. Use this to apply different policies to inputs vs outputs (e.g., block PII only in outputs)" },
1944
- { "key": "content_type", "type": "string", "required": true, "description": "Type of content being analyzed: \'prompt\', \'response\', \'tool_call\', or \'file\'" },
1944
+ { "key": "content_type", "type": "string", "required": true, "description": "Type of content being analyzed: \'prompt\', \'response\', \'tool_call\', \'file\', or \'clipboard\'" },
1945
1945
  { "key": "detector_count", "type": "number", "required": true, "description": "Number of detectors that were executed for this request" },
1946
1946
  { "key": "injection_confidence", "type": "number", "required": false, "description": "Combined prompt injection confidence (0-100). MAX of all detector scores (Pulse + DeepContext). Use injection_pulse_score / injection_deep_context_score for individual detector control" },
1947
1947
  { "key": "jailbreak_confidence", "type": "number", "required": false, "description": "Combined jailbreak detection confidence (0-100). MAX of all detector scores (Pulse + DeepContext). Use jailbreak_pulse_score / jailbreak_deep_context_score for individual detector control" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highflame/policy",
3
- "version": "2.1.23",
3
+ "version": "2.1.24",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },