@highflame/policy 2.1.2 → 2.1.4
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/guardrails/context.json +37 -73
- package/_schemas/overwatch/context.json +211 -1
- package/_schemas/palisade/context.json +1 -1
- package/_schemas/sentry/context.json +1165 -0
- package/_schemas/sentry/schema.cedarschema +388 -0
- package/_schemas/sentry/templates/defaults/baseline.cedar +24 -0
- package/_schemas/sentry/templates/defaults/content_safety.cedar +232 -0
- package/_schemas/sentry/templates/defaults/file_safety.cedar +174 -0
- package/_schemas/sentry/templates/defaults/organization.cedar +207 -0
- package/_schemas/sentry/templates/defaults/pii.cedar +229 -0
- package/_schemas/sentry/templates/defaults/semantic.cedar +167 -0
- package/_schemas/sentry/templates/templates.json +93 -0
- package/dist/builder.d.ts +32 -0
- package/dist/builder.js +6 -6
- package/dist/condition-groups.d.ts +69 -0
- package/dist/condition-groups.js +305 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/overwatch-context.gen.d.ts +7 -0
- package/dist/overwatch-context.gen.js +7 -0
- package/dist/overwatch-defaults.gen.js +358 -370
- package/dist/sentry-context.gen.d.ts +76 -0
- package/dist/sentry-context.gen.js +77 -0
- package/dist/sentry-defaults.gen.d.ts +61 -0
- package/dist/sentry-defaults.gen.js +1235 -0
- package/dist/sentry-entities.gen.d.ts +11 -0
- package/dist/sentry-entities.gen.js +33 -0
- package/dist/service-schemas.gen.d.ts +10 -0
- package/dist/service-schemas.gen.js +659 -6
- package/dist/types.d.ts +6 -1
- package/dist/types.js +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1235 @@
|
|
|
1
|
+
// Code generated by highflame-policy-codegen. DO NOT EDIT.
|
|
2
|
+
// Source: schemas/sentry/templates/templates.json
|
|
3
|
+
//
|
|
4
|
+
// Sentry default policies and templates.
|
|
5
|
+
// Cedar text is embedded at build time. PolicyRule[] can be parsed at runtime
|
|
6
|
+
// using parseCedarToRules().
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// EMBEDDED CEDAR POLICY TEXT
|
|
9
|
+
// =============================================================================
|
|
10
|
+
const SENTRY_SENTRY_BASELINE_DEFAULT_CEDAR = `// =============================================================================
|
|
11
|
+
// Baseline Permit Policy (Default)
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Permits all actions by default. Threat-specific forbid policies override
|
|
14
|
+
// this to block when detection engines identify issues.
|
|
15
|
+
//
|
|
16
|
+
// Cedar is default-deny: without at least one permit rule, every request
|
|
17
|
+
// is denied regardless of forbid rules. This baseline ensures the system
|
|
18
|
+
// is "allow unless blocked" rather than "block everything".
|
|
19
|
+
//
|
|
20
|
+
// Category: organization
|
|
21
|
+
// Namespace: Sentry
|
|
22
|
+
// =============================================================================
|
|
23
|
+
|
|
24
|
+
@id("sentry-baseline-permit-all")
|
|
25
|
+
@name("Permit all actions by default")
|
|
26
|
+
@description("Baseline permit for all actions — threat-specific forbid policies override this when threats are detected")
|
|
27
|
+
@severity("low")
|
|
28
|
+
@tags("baseline,permit-default,organization")
|
|
29
|
+
permit (
|
|
30
|
+
principal,
|
|
31
|
+
action,
|
|
32
|
+
resource
|
|
33
|
+
);
|
|
34
|
+
`;
|
|
35
|
+
const SENTRY_SENTRY_SEMANTIC_DEFAULT_CEDAR = `// =============================================================================
|
|
36
|
+
// Semantic Threat Detection Policy (Default)
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// Detects and blocks prompt injection, jailbreak attempts, and high-severity
|
|
39
|
+
// threats across all browser AI interactions: messages, paste, file uploads.
|
|
40
|
+
//
|
|
41
|
+
// Uses multi-layered detection from Shield:
|
|
42
|
+
// 1. ML classifier scores (injection_score, jailbreak_score)
|
|
43
|
+
// 2. Detection engine rule triggers (detected_threats)
|
|
44
|
+
// 3. Threat severity aggregation (max_threat_severity, highest_severity)
|
|
45
|
+
//
|
|
46
|
+
// Compliance:
|
|
47
|
+
// OWASP LLM01 (Prompt Injection) — direct + indirect
|
|
48
|
+
// OWASP LLM02 (Insecure Output Handling)
|
|
49
|
+
// MITRE ATLAS AML.T0051 (LLM Prompt Injection)
|
|
50
|
+
// MITRE ATLAS AML.T0054 (LLM Jailbreak)
|
|
51
|
+
// NIST 800-53 SI-3, SI-4
|
|
52
|
+
//
|
|
53
|
+
// Category: semantic
|
|
54
|
+
// Namespace: Sentry
|
|
55
|
+
// =============================================================================
|
|
56
|
+
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Section 1: Prompt Injection Detection
|
|
59
|
+
// Blocks injection attempts in messages, pasted content, and uploaded files.
|
|
60
|
+
// Users may inadvertently paste injection payloads from compromised sources.
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
// Block messages and pastes with prompt injection patterns
|
|
64
|
+
@id("sentry-semantic-block-injection")
|
|
65
|
+
@name("Block prompt injection")
|
|
66
|
+
@description("Block messages and pasted content when detection engine rules identify prompt injection patterns. Catches instruction override, role assumption, and manipulation techniques in user input and pasted content (OWASP LLM01).")
|
|
67
|
+
@severity("critical")
|
|
68
|
+
@tags("injection,security,owasp-llm01,mitre-aml-t0051,baseline")
|
|
69
|
+
@reject_message("Content was blocked because prompt injection patterns were detected. This prevents manipulation of AI agent behavior. Remove adversarial instructions and try again.")
|
|
70
|
+
forbid (
|
|
71
|
+
principal,
|
|
72
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
|
|
73
|
+
resource
|
|
74
|
+
)
|
|
75
|
+
when {
|
|
76
|
+
context has detected_threats && context.detected_threats.contains("prompt_injection")
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Block content with high ML injection confidence
|
|
80
|
+
@id("sentry-semantic-block-injection-score")
|
|
81
|
+
@name("Block high-confidence injection")
|
|
82
|
+
@description("Block content when the ML injection classifier confidence exceeds threshold (75/100). Catches novel injection techniques including polymorphic payloads, encoding tricks, and obfuscated instructions.")
|
|
83
|
+
@severity("critical")
|
|
84
|
+
@tags("injection,ml-classifier,security,owasp-llm01")
|
|
85
|
+
@reject_message("Your content was blocked because the ML classifier detected prompt injection with high confidence.")
|
|
86
|
+
forbid (
|
|
87
|
+
principal,
|
|
88
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
89
|
+
resource
|
|
90
|
+
)
|
|
91
|
+
when {
|
|
92
|
+
context has injection_score && context.injection_score >= 75
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Block injection payloads hidden in uploaded documents
|
|
96
|
+
@id("sentry-semantic-block-file-injection")
|
|
97
|
+
@name("Block injection in uploaded files")
|
|
98
|
+
@description("Block file uploads when prompt injection patterns are detected in the document content. Attackers embed injection payloads in PDFs, documents, and spreadsheets to hijack AI behavior via RAG or file analysis.")
|
|
99
|
+
@severity("critical")
|
|
100
|
+
@tags("injection,file-upload,security,owasp-llm01")
|
|
101
|
+
@reject_message("File upload was blocked because prompt injection patterns were detected in the document. Files containing adversarial instructions cannot be shared with AI services.")
|
|
102
|
+
forbid (
|
|
103
|
+
principal,
|
|
104
|
+
action == Sentry::Action::"upload_file",
|
|
105
|
+
resource
|
|
106
|
+
)
|
|
107
|
+
when {
|
|
108
|
+
context has detected_threats && context.detected_threats.contains("prompt_injection")
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Section 2: Jailbreak Detection
|
|
113
|
+
// Blocks jailbreak attempts in messages sent to AI services.
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
|
|
116
|
+
// Block messages with jailbreak attempts
|
|
117
|
+
@id("sentry-semantic-block-jailbreak")
|
|
118
|
+
@name("Block jailbreak attempts")
|
|
119
|
+
@description("Block messages when detection engine rules identify jailbreak patterns: DAN-style prompts, role-play exploits, safety bypass instructions, and constraint removal attempts (OWASP LLM02).")
|
|
120
|
+
@severity("critical")
|
|
121
|
+
@tags("jailbreak,bypass,security,owasp-llm02,mitre-aml-t0054,baseline")
|
|
122
|
+
@reject_message("Your message was blocked because jailbreak patterns were detected. This prevents circumvention of AI safety controls.")
|
|
123
|
+
forbid (
|
|
124
|
+
principal,
|
|
125
|
+
action == Sentry::Action::"send_message",
|
|
126
|
+
resource
|
|
127
|
+
)
|
|
128
|
+
when {
|
|
129
|
+
context has detected_threats && context.detected_threats.contains("jailbreak")
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Block content with high ML jailbreak confidence
|
|
133
|
+
@id("sentry-semantic-block-jailbreak-score")
|
|
134
|
+
@name("Block high-confidence jailbreak")
|
|
135
|
+
@description("Block content when the ML jailbreak classifier exceeds threshold (75/100). Catches sophisticated jailbreak techniques including multi-turn manipulation and encoded payloads.")
|
|
136
|
+
@severity("critical")
|
|
137
|
+
@tags("jailbreak,ml-classifier,security,owasp-llm02")
|
|
138
|
+
@reject_message("Your content was blocked because the ML classifier detected a jailbreak attempt with high confidence.")
|
|
139
|
+
forbid (
|
|
140
|
+
principal,
|
|
141
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
|
|
142
|
+
resource
|
|
143
|
+
)
|
|
144
|
+
when {
|
|
145
|
+
context has jailbreak_score && context.jailbreak_score >= 75
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// ---------------------------------------------------------------------------
|
|
149
|
+
// Section 3: Threat Severity Aggregation
|
|
150
|
+
// Catch-all rules based on aggregated threat severity across all detectors.
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
|
|
153
|
+
// Block any content with critical severity threats
|
|
154
|
+
@id("sentry-semantic-block-critical")
|
|
155
|
+
@name("Block critical threats")
|
|
156
|
+
@description("Block all content when any detection engine reports critical severity. This is the ultimate catch-all for critical-severity threats regardless of type or source.")
|
|
157
|
+
@severity("critical")
|
|
158
|
+
@tags("critical,baseline,security,catch-all")
|
|
159
|
+
@reject_message("Your content was blocked because security scanners detected a critical-severity threat. This content cannot be processed by AI services.")
|
|
160
|
+
forbid (
|
|
161
|
+
principal,
|
|
162
|
+
action,
|
|
163
|
+
resource
|
|
164
|
+
)
|
|
165
|
+
when {
|
|
166
|
+
context has highest_severity && context.highest_severity == "critical"
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// Block messages with high severity semantic threats
|
|
170
|
+
@id("sentry-semantic-block-high-severity")
|
|
171
|
+
@name("Block high severity threats")
|
|
172
|
+
@description("Block messages when threat detection reports high severity (>= 3) in semantic categories. Catches threats that individually are below critical but collectively indicate adversarial intent.")
|
|
173
|
+
@severity("high")
|
|
174
|
+
@tags("semantic,severity,security,defense-in-depth")
|
|
175
|
+
@reject_message("Your message was blocked because security scanners detected high severity issues. Review your content for manipulative or adversarial patterns.")
|
|
176
|
+
forbid (
|
|
177
|
+
principal,
|
|
178
|
+
action == Sentry::Action::"send_message",
|
|
179
|
+
resource
|
|
180
|
+
)
|
|
181
|
+
when {
|
|
182
|
+
context has threat_categories && context has max_threat_severity &&
|
|
183
|
+
context.threat_categories.contains("injection") &&
|
|
184
|
+
context.max_threat_severity >= 3
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Block content with multiple concurrent threats
|
|
188
|
+
@id("sentry-semantic-block-multi-threat")
|
|
189
|
+
@name("Block multi-threat content")
|
|
190
|
+
@description("Block content when multiple distinct threats are detected simultaneously (3+). Multiple concurrent threats strongly indicate an adversarial attack chain or compromised content.")
|
|
191
|
+
@severity("high")
|
|
192
|
+
@tags("multi-threat,security,defense-in-depth")
|
|
193
|
+
@reject_message("Content was blocked because multiple security threats were detected simultaneously. This pattern indicates potentially adversarial content.")
|
|
194
|
+
forbid (
|
|
195
|
+
principal,
|
|
196
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
197
|
+
resource
|
|
198
|
+
)
|
|
199
|
+
when {
|
|
200
|
+
context has threat_count && context.threat_count >= 3
|
|
201
|
+
};
|
|
202
|
+
`;
|
|
203
|
+
const SENTRY_SENTRY_CONTENT_SAFETY_DEFAULT_CEDAR = `// =============================================================================
|
|
204
|
+
// Content Safety Policy (Default)
|
|
205
|
+
// =============================================================================
|
|
206
|
+
// Detects and blocks violent, harmful, hateful, sexual, and profane content
|
|
207
|
+
// in AI chat interactions. Includes cut-and-paste safety rules to prevent
|
|
208
|
+
// unsafe content from being transferred into AI services.
|
|
209
|
+
//
|
|
210
|
+
// The detection engine runs ML classifiers (toxicity, content safety) and
|
|
211
|
+
// produces normalized scores (0-100) for each category.
|
|
212
|
+
//
|
|
213
|
+
// Compliance:
|
|
214
|
+
// NIST 800-53 SI-4 (Information System Monitoring)
|
|
215
|
+
// EU AI Act Art. 52 (Transparency for AI Systems)
|
|
216
|
+
// OWASP LLM02 (Insecure Output Handling)
|
|
217
|
+
// ISO 42001 (AI Management System)
|
|
218
|
+
//
|
|
219
|
+
// Category: content_safety
|
|
220
|
+
// Namespace: Sentry
|
|
221
|
+
// =============================================================================
|
|
222
|
+
|
|
223
|
+
// ---------------------------------------------------------------------------
|
|
224
|
+
// Section 1: Violence & Weapons
|
|
225
|
+
// Blocks content promoting, describing, or instructing violence and weapons.
|
|
226
|
+
// Applies to messages, paste, and file uploads.
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
|
|
229
|
+
// Block violent content across all input channels
|
|
230
|
+
@id("sentry-cs-block-violence")
|
|
231
|
+
@name("Block violent content")
|
|
232
|
+
@description("Block content when the ML violence detection score exceeds threshold (80/100). Catches graphic violence descriptions, instructions for causing harm, and violent threat language in messages, pastes, and uploads.")
|
|
233
|
+
@severity("critical")
|
|
234
|
+
@tags("violence,content-safety,trust-safety,nist-si-4,iso-42001")
|
|
235
|
+
@reject_message("Content blocked: violent content detected. AI services must not process violent content in enterprise environments. Please rephrase without violence-related language.")
|
|
236
|
+
forbid (
|
|
237
|
+
principal,
|
|
238
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
239
|
+
resource
|
|
240
|
+
)
|
|
241
|
+
when {
|
|
242
|
+
context has violence_score && context.violence_score >= 80
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// Block weapons content
|
|
246
|
+
@id("sentry-cs-block-weapons")
|
|
247
|
+
@name("Block weapons content")
|
|
248
|
+
@description("Block content when the ML weapons detection score exceeds threshold (80/100). Catches weapon manufacturing instructions, procurement guidance, and detailed specifications.")
|
|
249
|
+
@severity("critical")
|
|
250
|
+
@tags("weapons,content-safety,trust-safety,nist-si-4")
|
|
251
|
+
@reject_message("Content blocked: weapons-related content detected. AI services must not process weapons manufacturing, procurement, or specification content.")
|
|
252
|
+
forbid (
|
|
253
|
+
principal,
|
|
254
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
255
|
+
resource
|
|
256
|
+
)
|
|
257
|
+
when {
|
|
258
|
+
context has weapons_score && context.weapons_score >= 80
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
// Section 2: Hate Speech & Discrimination
|
|
263
|
+
// Lower threshold (75) — enterprises have zero tolerance for hate speech.
|
|
264
|
+
// ---------------------------------------------------------------------------
|
|
265
|
+
|
|
266
|
+
// Block hate speech content
|
|
267
|
+
@id("sentry-cs-block-hate-speech")
|
|
268
|
+
@name("Block hate speech")
|
|
269
|
+
@description("Block content when the ML hate speech score exceeds threshold (75/100). Lower threshold than other categories because enterprises have zero tolerance for discriminatory content. Catches slurs, dehumanizing language, and targeted harassment.")
|
|
270
|
+
@severity("critical")
|
|
271
|
+
@tags("hate-speech,content-safety,trust-safety,nist-si-4,eu-ai-act")
|
|
272
|
+
@reject_message("Content blocked: hate speech or discriminatory content detected. AI services must not process hateful, discriminatory, or dehumanizing content.")
|
|
273
|
+
forbid (
|
|
274
|
+
principal,
|
|
275
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
276
|
+
resource
|
|
277
|
+
)
|
|
278
|
+
when {
|
|
279
|
+
context has hate_speech_score && context.hate_speech_score >= 75
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// ---------------------------------------------------------------------------
|
|
283
|
+
// Section 3: Criminal Content
|
|
284
|
+
// ---------------------------------------------------------------------------
|
|
285
|
+
|
|
286
|
+
// Block criminal content
|
|
287
|
+
@id("sentry-cs-block-crime")
|
|
288
|
+
@name("Block criminal content")
|
|
289
|
+
@description("Block content when the ML criminal activity detection score exceeds threshold (80/100). Catches illegal activity instructions, fraud techniques, and criminal behavior content.")
|
|
290
|
+
@severity("high")
|
|
291
|
+
@tags("crime,content-safety,trust-safety,nist-si-4")
|
|
292
|
+
@reject_message("Content blocked: criminal activity content detected. AI services must not process content related to illegal activities or fraud.")
|
|
293
|
+
forbid (
|
|
294
|
+
principal,
|
|
295
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
296
|
+
resource
|
|
297
|
+
)
|
|
298
|
+
when {
|
|
299
|
+
context has crime_score && context.crime_score >= 80
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
// Section 4: Sexual Content
|
|
304
|
+
// ---------------------------------------------------------------------------
|
|
305
|
+
|
|
306
|
+
// Block sexual content
|
|
307
|
+
@id("sentry-cs-block-sexual")
|
|
308
|
+
@name("Block sexual content")
|
|
309
|
+
@description("Block content when the ML sexual content score exceeds threshold (80/100). Ensures AI services do not process sexually explicit material in enterprise environments.")
|
|
310
|
+
@severity("high")
|
|
311
|
+
@tags("sexual,content-safety,trust-safety,eu-ai-act,iso-42001")
|
|
312
|
+
@reject_message("Content blocked: sexual content detected. AI services must not process sexually explicit material in enterprise environments.")
|
|
313
|
+
forbid (
|
|
314
|
+
principal,
|
|
315
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
316
|
+
resource
|
|
317
|
+
)
|
|
318
|
+
when {
|
|
319
|
+
context has sexual_score && context.sexual_score >= 80
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// ---------------------------------------------------------------------------
|
|
323
|
+
// Section 5: Profanity
|
|
324
|
+
// Higher threshold (90) — allows normal expression while blocking abuse.
|
|
325
|
+
// ---------------------------------------------------------------------------
|
|
326
|
+
|
|
327
|
+
// Block excessive profanity
|
|
328
|
+
@id("sentry-cs-block-profanity")
|
|
329
|
+
@name("Block profanity")
|
|
330
|
+
@description("Block content when the ML profanity detection score exceeds threshold (90/100). Higher threshold allows normal expression while blocking abusive or harassing language patterns.")
|
|
331
|
+
@severity("medium")
|
|
332
|
+
@tags("profanity,content-safety,trust-safety")
|
|
333
|
+
@reject_message("Content blocked: excessive profanity detected. Please rephrase in a professional manner.")
|
|
334
|
+
forbid (
|
|
335
|
+
principal,
|
|
336
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
|
|
337
|
+
resource
|
|
338
|
+
)
|
|
339
|
+
when {
|
|
340
|
+
context has profanity_score && context.profanity_score >= 90
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
// ---------------------------------------------------------------------------
|
|
344
|
+
// Section 6: Cut & Paste Safety
|
|
345
|
+
// Specific rules for content pasted from external sources into AI chats.
|
|
346
|
+
// Paste operations are a primary vector for data leakage.
|
|
347
|
+
// ---------------------------------------------------------------------------
|
|
348
|
+
|
|
349
|
+
// Block large pastes with any detected threats
|
|
350
|
+
@id("sentry-cs-block-large-paste-threats")
|
|
351
|
+
@name("Block large pastes with threats")
|
|
352
|
+
@description("Block large paste operations (>5000 chars) when any threats are detected. Large pastes with threats likely indicate bulk data dumps from emails, documents, or databases being leaked to AI services.")
|
|
353
|
+
@severity("high")
|
|
354
|
+
@tags("paste-safety,data-leakage,content-safety")
|
|
355
|
+
@reject_message("Large paste operation blocked: security threats were detected in the pasted content. Large data transfers to AI services require threat-free content.")
|
|
356
|
+
forbid (
|
|
357
|
+
principal,
|
|
358
|
+
action == Sentry::Action::"paste_content",
|
|
359
|
+
resource
|
|
360
|
+
)
|
|
361
|
+
when {
|
|
362
|
+
context has paste_length && context has threat_count &&
|
|
363
|
+
context.paste_length > 5000 && context.threat_count >= 1
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// Block pastes containing encoded injection payloads
|
|
367
|
+
@id("sentry-cs-block-paste-encoded")
|
|
368
|
+
@name("Block encoded paste content")
|
|
369
|
+
@description("Block paste operations when encoded injection payloads (base64, hex, unicode) are detected. Attackers use encoding to smuggle injection payloads via clipboard transfer.")
|
|
370
|
+
@severity("high")
|
|
371
|
+
@tags("paste-safety,encoding,injection,content-safety")
|
|
372
|
+
@reject_message("Paste blocked: encoded injection payloads detected in pasted content. Content with hidden encoded instructions cannot be shared with AI services.")
|
|
373
|
+
forbid (
|
|
374
|
+
principal,
|
|
375
|
+
action == Sentry::Action::"paste_content",
|
|
376
|
+
resource
|
|
377
|
+
)
|
|
378
|
+
when {
|
|
379
|
+
context has encoded_content_detected && context.encoded_content_detected &&
|
|
380
|
+
context has encoded_score && context.encoded_score >= 60
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// Block pastes with invisible characters
|
|
384
|
+
@id("sentry-cs-block-paste-invisible")
|
|
385
|
+
@name("Block paste with invisible characters")
|
|
386
|
+
@description("Block paste operations containing invisible Unicode characters (zero-width, bidi overrides). These can hide malicious instructions that appear invisible to users but are processed by AI models.")
|
|
387
|
+
@severity("high")
|
|
388
|
+
@tags("paste-safety,unicode,invisible-chars,content-safety")
|
|
389
|
+
@reject_message("Paste blocked: invisible Unicode characters detected. Hidden characters can disguise malicious instructions that AI models process but users cannot see.")
|
|
390
|
+
forbid (
|
|
391
|
+
principal,
|
|
392
|
+
action == Sentry::Action::"paste_content",
|
|
393
|
+
resource
|
|
394
|
+
)
|
|
395
|
+
when {
|
|
396
|
+
context has contains_invisible_chars && context.contains_invisible_chars &&
|
|
397
|
+
context has invisible_chars_score && context.invisible_chars_score >= 50
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// ---------------------------------------------------------------------------
|
|
401
|
+
// Section 7: AI Response Safety
|
|
402
|
+
// Block harmful content in AI responses before user sees it.
|
|
403
|
+
// ---------------------------------------------------------------------------
|
|
404
|
+
|
|
405
|
+
// Block violent/harmful AI responses
|
|
406
|
+
@id("sentry-cs-block-response-safety")
|
|
407
|
+
@name("Block harmful AI responses")
|
|
408
|
+
@description("Block AI responses containing high-severity violent, hateful, or criminal content. Prevents harmful AI-generated content from reaching users in enterprise environments.")
|
|
409
|
+
@severity("critical")
|
|
410
|
+
@tags("response-safety,content-safety,owasp-llm02")
|
|
411
|
+
@reject_message("AI response blocked: harmful content detected in the response. The AI service generated content that violates enterprise content safety policies.")
|
|
412
|
+
forbid (
|
|
413
|
+
principal,
|
|
414
|
+
action == Sentry::Action::"receive_response",
|
|
415
|
+
resource
|
|
416
|
+
)
|
|
417
|
+
when {
|
|
418
|
+
context has violence_score && context.violence_score >= 80
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
@id("sentry-cs-block-response-hate")
|
|
422
|
+
@name("Block hateful AI responses")
|
|
423
|
+
@description("Block AI responses with hate speech or discriminatory content.")
|
|
424
|
+
@severity("critical")
|
|
425
|
+
@tags("response-safety,hate-speech,content-safety,owasp-llm02")
|
|
426
|
+
@reject_message("AI response blocked: hate speech or discriminatory content detected in the response.")
|
|
427
|
+
forbid (
|
|
428
|
+
principal,
|
|
429
|
+
action == Sentry::Action::"receive_response",
|
|
430
|
+
resource
|
|
431
|
+
)
|
|
432
|
+
when {
|
|
433
|
+
context has hate_speech_score && context.hate_speech_score >= 75
|
|
434
|
+
};
|
|
435
|
+
`;
|
|
436
|
+
const SENTRY_SENTRY_PII_DEFAULT_CEDAR = `// =============================================================================
|
|
437
|
+
// PII Detection Policy (Default)
|
|
438
|
+
// =============================================================================
|
|
439
|
+
// Detects and blocks personally identifiable information across messages,
|
|
440
|
+
// pasted content, file uploads, and AI responses. Uses multi-layered detection:
|
|
441
|
+
//
|
|
442
|
+
// 1. PII boolean flag (pii_detected) — broadest catch from detection engine
|
|
443
|
+
// 2. Granular PII type matching (pii_types) — type-specific blocking
|
|
444
|
+
// 3. PII confidence score (pii_confidence) — ML classifier confidence
|
|
445
|
+
// 4. Detection rule triggers (detected_threats) — named rule matches
|
|
446
|
+
// 5. Bulk PII exposure (pii_count) — data dump prevention
|
|
447
|
+
//
|
|
448
|
+
// PII Types Detected by Shield PIIRegexDetector:
|
|
449
|
+
// ssn, credit_card, email, phone_us, ip_address, date_of_birth,
|
|
450
|
+
// passport, iban, aws_key, api_key_generic
|
|
451
|
+
//
|
|
452
|
+
// Compliance:
|
|
453
|
+
// PCI DSS 3.4, 4.1 (Payment Card Data)
|
|
454
|
+
// GDPR Art. 32 (Security of Processing)
|
|
455
|
+
// HIPAA §164.312 (Technical Safeguards)
|
|
456
|
+
// CCPA §1798.150 (Data Protection)
|
|
457
|
+
// OWASP LLM06 (Sensitive Information Disclosure)
|
|
458
|
+
//
|
|
459
|
+
// Category: pii
|
|
460
|
+
// Namespace: Sentry
|
|
461
|
+
// =============================================================================
|
|
462
|
+
|
|
463
|
+
// ---------------------------------------------------------------------------
|
|
464
|
+
// Section 1: Primary PII Detection
|
|
465
|
+
// Fires when the detection pipeline identifies PII in any content.
|
|
466
|
+
// ---------------------------------------------------------------------------
|
|
467
|
+
|
|
468
|
+
// Block messages containing detected PII
|
|
469
|
+
@id("sentry-pii-block-messages")
|
|
470
|
+
@name("Block messages with PII")
|
|
471
|
+
@description("Block messages when the detection engine identifies any PII patterns. Prevents employees from accidentally sharing personal data with AI chat services.")
|
|
472
|
+
@severity("critical")
|
|
473
|
+
@tags("pii,privacy,data-protection,gdpr-art-32,owasp-llm06")
|
|
474
|
+
@reject_message("Your message was blocked because personally identifiable information was detected. Remove all PII (names, addresses, SSNs, credit cards, etc.) before sending to AI services.")
|
|
475
|
+
forbid (
|
|
476
|
+
principal,
|
|
477
|
+
action == Sentry::Action::"send_message",
|
|
478
|
+
resource
|
|
479
|
+
)
|
|
480
|
+
when {
|
|
481
|
+
context has pii_detected && context.pii_detected
|
|
482
|
+
};
|
|
483
|
+
|
|
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
|
+
// ---------------------------------------------------------------------------
|
|
517
|
+
// Section 2: Granular PII Type Blocking
|
|
518
|
+
// Blocks specific PII types based on regulatory requirements.
|
|
519
|
+
// ---------------------------------------------------------------------------
|
|
520
|
+
|
|
521
|
+
// Block credit card numbers (PCI DSS compliance)
|
|
522
|
+
@id("sentry-pii-block-credit-cards")
|
|
523
|
+
@name("Block credit card numbers")
|
|
524
|
+
@description("Block content containing credit card number patterns across all actions. PCI DSS 3.4 requires PANs are rendered unreadable — AI services must never receive raw card numbers.")
|
|
525
|
+
@severity("critical")
|
|
526
|
+
@tags("pci,credit-card,payment,compliance,pci-dss-3.4")
|
|
527
|
+
@reject_message("Content blocked: credit card number patterns detected. Sharing payment card data with AI services violates PCI DSS. Use tokenized references instead.")
|
|
528
|
+
forbid (
|
|
529
|
+
principal,
|
|
530
|
+
action,
|
|
531
|
+
resource
|
|
532
|
+
)
|
|
533
|
+
when {
|
|
534
|
+
(context has pii_types && context.pii_types.contains("credit_card")) ||
|
|
535
|
+
(context has detected_threats && context.detected_threats.contains("credit_card"))
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
// Block Social Security Numbers
|
|
539
|
+
@id("sentry-pii-block-ssn")
|
|
540
|
+
@name("Block Social Security Numbers")
|
|
541
|
+
@description("Block content containing SSN patterns (XXX-XX-XXXX and variants). SSNs are high-value identity theft targets — exposure through AI services is a critical privacy violation.")
|
|
542
|
+
@severity("critical")
|
|
543
|
+
@tags("ssn,identity,privacy,compliance,nist-si-4")
|
|
544
|
+
@reject_message("Content blocked: Social Security Number patterns detected. SSNs must never be shared with AI services.")
|
|
545
|
+
forbid (
|
|
546
|
+
principal,
|
|
547
|
+
action,
|
|
548
|
+
resource
|
|
549
|
+
)
|
|
550
|
+
when {
|
|
551
|
+
(context has pii_types && context.pii_types.contains("ssn")) ||
|
|
552
|
+
(context has detected_threats && context.detected_threats.contains("ssn"))
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
// Block passport numbers
|
|
556
|
+
@id("sentry-pii-block-passport")
|
|
557
|
+
@name("Block passport numbers")
|
|
558
|
+
@description("Block content containing passport number patterns. Passport numbers are government-issued identifiers with high identity theft risk.")
|
|
559
|
+
@severity("critical")
|
|
560
|
+
@tags("passport,identity,privacy,gdpr")
|
|
561
|
+
@reject_message("Content blocked: passport number patterns detected. Government-issued identifiers must not be shared with AI services.")
|
|
562
|
+
forbid (
|
|
563
|
+
principal,
|
|
564
|
+
action,
|
|
565
|
+
resource
|
|
566
|
+
)
|
|
567
|
+
when {
|
|
568
|
+
context has pii_types && context.pii_types.contains("passport")
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// Block IBAN (International Bank Account Numbers)
|
|
572
|
+
@id("sentry-pii-block-iban")
|
|
573
|
+
@name("Block bank account numbers")
|
|
574
|
+
@description("Block content containing IBAN patterns. Bank account numbers are sensitive financial identifiers that must not be exposed to AI services.")
|
|
575
|
+
@severity("critical")
|
|
576
|
+
@tags("iban,financial,privacy,gdpr,pci-dss")
|
|
577
|
+
@reject_message("Content blocked: bank account number (IBAN) patterns detected. Financial account numbers must not be shared with AI services.")
|
|
578
|
+
forbid (
|
|
579
|
+
principal,
|
|
580
|
+
action,
|
|
581
|
+
resource
|
|
582
|
+
)
|
|
583
|
+
when {
|
|
584
|
+
context has pii_types && context.pii_types.contains("iban")
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// Block bulk PII exposure
|
|
588
|
+
@id("sentry-pii-block-bulk-exposure")
|
|
589
|
+
@name("Block bulk PII exposure")
|
|
590
|
+
@description("Block content containing 3 or more PII matches. Multiple PII items indicate a data dump — customer lists, CSV exports, or database content being leaked to AI services.")
|
|
591
|
+
@severity("critical")
|
|
592
|
+
@tags("pii,bulk,data-exfiltration,gdpr-art-32,ccpa")
|
|
593
|
+
@reject_message("Content blocked: multiple PII items detected (3+). Bulk personal data must never be shared with AI services. Use data masking or tokenization.")
|
|
594
|
+
forbid (
|
|
595
|
+
principal,
|
|
596
|
+
action,
|
|
597
|
+
resource
|
|
598
|
+
)
|
|
599
|
+
when {
|
|
600
|
+
context has pii_count && context.pii_count >= 3
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
// ---------------------------------------------------------------------------
|
|
604
|
+
// Section 3: PII Confidence Detection
|
|
605
|
+
// Catches PII patterns via ML classifier that escape regex detection.
|
|
606
|
+
// ---------------------------------------------------------------------------
|
|
607
|
+
|
|
608
|
+
// Block high-confidence PII
|
|
609
|
+
@id("sentry-pii-block-high-confidence")
|
|
610
|
+
@name("Block high-confidence PII")
|
|
611
|
+
@description("Block content when the PII confidence score exceeds threshold (80/100). Catches novel PII patterns including names, addresses, and identifiers that regex rules may miss.")
|
|
612
|
+
@severity("critical")
|
|
613
|
+
@tags("pii,confidence,privacy,compliance,ml-classifier")
|
|
614
|
+
@reject_message("Content blocked: the ML classifier detected personally identifiable information with high confidence. The content appears to contain personal data.")
|
|
615
|
+
forbid (
|
|
616
|
+
principal,
|
|
617
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
618
|
+
resource
|
|
619
|
+
)
|
|
620
|
+
when {
|
|
621
|
+
context has pii_confidence && context.pii_confidence >= 80
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
// ---------------------------------------------------------------------------
|
|
625
|
+
// Section 4: PII Threat Category
|
|
626
|
+
// Defense-in-depth via threat aggregation layer.
|
|
627
|
+
// ---------------------------------------------------------------------------
|
|
628
|
+
|
|
629
|
+
// Block PII threat category
|
|
630
|
+
@id("sentry-pii-block-threat-category")
|
|
631
|
+
@name("Block PII threat category")
|
|
632
|
+
@description("Block content when threat categorization identifies PII. Defense-in-depth behind the pii_detected boolean — catches cases where PII is flagged at the aggregation layer.")
|
|
633
|
+
@severity("high")
|
|
634
|
+
@tags("pii,privacy,data-protection,gdpr")
|
|
635
|
+
@reject_message("Content blocked: threat scanners detected personally identifiable information. Remove all PII before submitting.")
|
|
636
|
+
forbid (
|
|
637
|
+
principal,
|
|
638
|
+
action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
|
|
639
|
+
resource
|
|
640
|
+
)
|
|
641
|
+
when {
|
|
642
|
+
context has threat_categories && context.threat_categories.contains("pii")
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
// ---------------------------------------------------------------------------
|
|
646
|
+
// Section 5: AI Response PII Blocking
|
|
647
|
+
// Prevent AI responses containing PII from reaching the user.
|
|
648
|
+
// ---------------------------------------------------------------------------
|
|
649
|
+
|
|
650
|
+
// Block AI responses containing PII
|
|
651
|
+
@id("sentry-pii-block-responses")
|
|
652
|
+
@name("Block AI responses with PII")
|
|
653
|
+
@description("Block AI responses when PII is detected in the output. Prevents AI services from exposing personal data in generated responses (e.g., when the model echoes back or generates PII from training data).")
|
|
654
|
+
@severity("high")
|
|
655
|
+
@tags("pii,response-safety,data-protection,owasp-llm06")
|
|
656
|
+
@reject_message("AI response blocked: personally identifiable information detected in the AI response. The AI service generated content containing personal data.")
|
|
657
|
+
forbid (
|
|
658
|
+
principal,
|
|
659
|
+
action == Sentry::Action::"receive_response",
|
|
660
|
+
resource
|
|
661
|
+
)
|
|
662
|
+
when {
|
|
663
|
+
context has pii_detected && context.pii_detected
|
|
664
|
+
};
|
|
665
|
+
`;
|
|
666
|
+
const SENTRY_SENTRY_FILE_SAFETY_DEFAULT_CEDAR = `// =============================================================================
|
|
667
|
+
// File & Attachment Safety Policy (Default)
|
|
668
|
+
// =============================================================================
|
|
669
|
+
// Enforces document sensitivity controls for files uploaded to AI chat services.
|
|
670
|
+
// Integrates with Microsoft Information Protection (MIP) labels to prevent
|
|
671
|
+
// confidential and restricted documents from being shared with AI.
|
|
672
|
+
//
|
|
673
|
+
// Detection layers:
|
|
674
|
+
// 1. MIP label enforcement — sensitivity_level from document metadata
|
|
675
|
+
// 2. PII/secrets in file content — from Shield PIIRegexDetector/SecretsDetector
|
|
676
|
+
// 3. Injection payloads in files — from Shield InjectionDetector
|
|
677
|
+
// 4. File type restrictions — block dangerous extensions
|
|
678
|
+
// 5. Phishing link detection — from CheckPhishDetector
|
|
679
|
+
//
|
|
680
|
+
// Compliance:
|
|
681
|
+
// Microsoft Information Protection (MIP) — label-based access control
|
|
682
|
+
// NIST 800-53 SC-28 (Protection of Information at Rest)
|
|
683
|
+
// GDPR Art. 32 (Security of Processing)
|
|
684
|
+
// ISO 27001 A.8.2 (Information Classification)
|
|
685
|
+
//
|
|
686
|
+
// Category: file_safety
|
|
687
|
+
// Namespace: Sentry
|
|
688
|
+
// =============================================================================
|
|
689
|
+
|
|
690
|
+
// ---------------------------------------------------------------------------
|
|
691
|
+
// Section 1: MIP Label Enforcement
|
|
692
|
+
// Block uploads based on Microsoft Information Protection sensitivity labels.
|
|
693
|
+
// Labels are read from document metadata via MIP SDK / Graph API.
|
|
694
|
+
// ---------------------------------------------------------------------------
|
|
695
|
+
|
|
696
|
+
// Block restricted documents
|
|
697
|
+
@id("sentry-file-block-restricted")
|
|
698
|
+
@name("Block restricted documents")
|
|
699
|
+
@description("Block uploads of documents with 'restricted' sensitivity level. Restricted documents contain the most sensitive data (board materials, M&A, legal privilege) and must never be shared with AI services.")
|
|
700
|
+
@severity("critical")
|
|
701
|
+
@tags("mip,restricted,classification,compliance,iso-27001")
|
|
702
|
+
@reject_message("Upload blocked: this document is classified as RESTRICTED. Restricted documents must never be shared with AI services. Contact your security team if you need to process this content.")
|
|
703
|
+
forbid (
|
|
704
|
+
principal,
|
|
705
|
+
action == Sentry::Action::"upload_file",
|
|
706
|
+
resource
|
|
707
|
+
)
|
|
708
|
+
when {
|
|
709
|
+
context has sensitivity_level && context.sensitivity_level == "restricted"
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
// Block confidential documents
|
|
713
|
+
@id("sentry-file-block-confidential")
|
|
714
|
+
@name("Block confidential documents")
|
|
715
|
+
@description("Block uploads of documents with 'confidential' sensitivity level. Confidential documents (financial reports, customer data, internal strategy) should not be shared with external AI services.")
|
|
716
|
+
@severity("critical")
|
|
717
|
+
@tags("mip,confidential,classification,compliance,iso-27001")
|
|
718
|
+
@reject_message("Upload blocked: this document is classified as CONFIDENTIAL. Confidential documents should not be shared with AI services without explicit authorization.")
|
|
719
|
+
forbid (
|
|
720
|
+
principal,
|
|
721
|
+
action == Sentry::Action::"upload_file",
|
|
722
|
+
resource
|
|
723
|
+
)
|
|
724
|
+
when {
|
|
725
|
+
context has sensitivity_level && context.sensitivity_level == "confidential"
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// Block rights-managed documents
|
|
729
|
+
@id("sentry-file-block-rights-managed")
|
|
730
|
+
@name("Block rights-managed documents")
|
|
731
|
+
@description("Block uploads of documents with IRM/RMS rights management restrictions. Rights-managed documents have explicit access controls that would be bypassed by sharing with AI services.")
|
|
732
|
+
@severity("critical")
|
|
733
|
+
@tags("mip,irm,rms,rights-management,compliance")
|
|
734
|
+
@reject_message("Upload blocked: this document has rights management restrictions that prohibit sharing with AI services.")
|
|
735
|
+
forbid (
|
|
736
|
+
principal,
|
|
737
|
+
action == Sentry::Action::"upload_file",
|
|
738
|
+
resource
|
|
739
|
+
)
|
|
740
|
+
when {
|
|
741
|
+
context has is_rights_managed && context.is_rights_managed
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
// ---------------------------------------------------------------------------
|
|
745
|
+
// Section 2: File Content Security
|
|
746
|
+
// Block files containing secrets, PII, or injection payloads.
|
|
747
|
+
// ---------------------------------------------------------------------------
|
|
748
|
+
|
|
749
|
+
// Block files containing secrets
|
|
750
|
+
@id("sentry-file-block-secrets")
|
|
751
|
+
@name("Block files with secrets")
|
|
752
|
+
@description("Block file uploads when secrets or credentials are detected in document content. Prevents uploading configuration files, code, or documents containing API keys, tokens, or passwords to AI services.")
|
|
753
|
+
@severity("critical")
|
|
754
|
+
@tags("secrets,file-upload,credentials,nist-sc-28")
|
|
755
|
+
@reject_message("Upload blocked: secrets or credentials detected in the file. Files containing API keys, tokens, or passwords must not be shared with AI services.")
|
|
756
|
+
forbid (
|
|
757
|
+
principal,
|
|
758
|
+
action == Sentry::Action::"upload_file",
|
|
759
|
+
resource
|
|
760
|
+
)
|
|
761
|
+
when {
|
|
762
|
+
context has contains_secrets && context.contains_secrets
|
|
763
|
+
};
|
|
764
|
+
|
|
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.")
|
|
769
|
+
@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.")
|
|
772
|
+
forbid (
|
|
773
|
+
principal,
|
|
774
|
+
action == Sentry::Action::"upload_file",
|
|
775
|
+
resource
|
|
776
|
+
)
|
|
777
|
+
when {
|
|
778
|
+
context has pii_count && context.pii_count >= 3
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
// Block files with phishing links
|
|
782
|
+
@id("sentry-file-block-phishing")
|
|
783
|
+
@name("Block files with phishing links")
|
|
784
|
+
@description("Block file uploads when phishing URLs are detected in document content. Prevents sharing of compromised documents that could expose phishing links to AI processing.")
|
|
785
|
+
@severity("high")
|
|
786
|
+
@tags("phishing,file-upload,security")
|
|
787
|
+
@reject_message("Upload blocked: phishing URLs detected in the file. Documents containing phishing links cannot be shared with AI services.")
|
|
788
|
+
forbid (
|
|
789
|
+
principal,
|
|
790
|
+
action == Sentry::Action::"upload_file",
|
|
791
|
+
resource
|
|
792
|
+
)
|
|
793
|
+
when {
|
|
794
|
+
context has phishing_detected && context.phishing_detected
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
// ---------------------------------------------------------------------------
|
|
798
|
+
// Section 3: File Type & Size Restrictions
|
|
799
|
+
// Block potentially dangerous file types and oversized files.
|
|
800
|
+
// ---------------------------------------------------------------------------
|
|
801
|
+
|
|
802
|
+
// Block large file uploads with any threats
|
|
803
|
+
@id("sentry-file-block-large-threats")
|
|
804
|
+
@name("Block large files with threats")
|
|
805
|
+
@description("Block file uploads over 10MB when any threats are detected. Large files with threats likely contain data dumps or bulk exports being exfiltrated to AI services.")
|
|
806
|
+
@severity("high")
|
|
807
|
+
@tags("file-upload,size-limit,data-protection")
|
|
808
|
+
@reject_message("Upload blocked: security threats detected in a large file. Large data transfers to AI services require threat-free content.")
|
|
809
|
+
forbid (
|
|
810
|
+
principal,
|
|
811
|
+
action == Sentry::Action::"upload_file",
|
|
812
|
+
resource
|
|
813
|
+
)
|
|
814
|
+
when {
|
|
815
|
+
context has file_size_bytes && context has threat_count &&
|
|
816
|
+
context.file_size_bytes > 10485760 && context.threat_count >= 1
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
// ---------------------------------------------------------------------------
|
|
820
|
+
// Section 4: Source Code Protection
|
|
821
|
+
// Block source code uploads to AI services.
|
|
822
|
+
// ---------------------------------------------------------------------------
|
|
823
|
+
|
|
824
|
+
// Block files with high code content
|
|
825
|
+
@id("sentry-file-block-source-code")
|
|
826
|
+
@name("Block source code uploads")
|
|
827
|
+
@description("Block file uploads when source code constitutes more than 80% of the content. Prevents bulk source code exfiltration to external AI services where it may be used for training or exposed.")
|
|
828
|
+
@severity("high")
|
|
829
|
+
@tags("source-code,ip-protection,file-upload,data-leakage")
|
|
830
|
+
@reject_message("Upload blocked: the file appears to be primarily source code (>80%). Bulk source code should not be shared with external AI services to protect intellectual property.")
|
|
831
|
+
forbid (
|
|
832
|
+
principal,
|
|
833
|
+
action == Sentry::Action::"upload_file",
|
|
834
|
+
resource
|
|
835
|
+
)
|
|
836
|
+
when {
|
|
837
|
+
context has contains_code && context.contains_code &&
|
|
838
|
+
context has code_ratio && context.code_ratio > 80
|
|
839
|
+
};
|
|
840
|
+
`;
|
|
841
|
+
const SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR = `// =============================================================================
|
|
842
|
+
// Organization Rules Policy (Default)
|
|
843
|
+
// =============================================================================
|
|
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
|
|
848
|
+
//
|
|
849
|
+
// These rules complement category-specific policies (PII, Content Safety,
|
|
850
|
+
// File Safety) with cross-cutting organizational controls.
|
|
851
|
+
//
|
|
852
|
+
// Category: organization
|
|
853
|
+
// Namespace: Sentry
|
|
854
|
+
// =============================================================================
|
|
855
|
+
|
|
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.")
|
|
869
|
+
forbid (
|
|
870
|
+
principal,
|
|
871
|
+
action == Sentry::Action::"send_message",
|
|
872
|
+
resource
|
|
873
|
+
)
|
|
874
|
+
when {
|
|
875
|
+
context has contains_secrets && context.contains_secrets
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
// Block pasted content containing secrets
|
|
879
|
+
@id("sentry-org-block-secrets-paste")
|
|
880
|
+
@name("Block paste with secrets")
|
|
881
|
+
@description("Block paste operations when secrets are detected. Prevents credential leakage when users paste from terminals, config files, or code editors into AI chats.")
|
|
882
|
+
@severity("critical")
|
|
883
|
+
@tags("secrets,paste-safety,credentials,nist-sc-28")
|
|
884
|
+
@reject_message("Paste blocked: secrets or credentials detected in pasted content. Remove API keys, tokens, and passwords before pasting into AI services.")
|
|
885
|
+
forbid (
|
|
886
|
+
principal,
|
|
887
|
+
action == Sentry::Action::"paste_content",
|
|
888
|
+
resource
|
|
889
|
+
)
|
|
890
|
+
when {
|
|
891
|
+
context has contains_secrets && context.contains_secrets
|
|
892
|
+
};
|
|
893
|
+
|
|
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.")
|
|
898
|
+
@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.")
|
|
901
|
+
forbid (
|
|
902
|
+
principal,
|
|
903
|
+
action,
|
|
904
|
+
resource
|
|
905
|
+
)
|
|
906
|
+
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"))
|
|
915
|
+
};
|
|
916
|
+
|
|
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.")
|
|
921
|
+
@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.")
|
|
961
|
+
forbid (
|
|
962
|
+
principal,
|
|
963
|
+
action,
|
|
964
|
+
resource
|
|
965
|
+
)
|
|
966
|
+
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"))
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
// ---------------------------------------------------------------------------
|
|
974
|
+
// Section 2: Source Code Protection
|
|
975
|
+
// Prevent bulk source code from being shared with AI services.
|
|
976
|
+
// ---------------------------------------------------------------------------
|
|
977
|
+
|
|
978
|
+
// Block messages with high code content
|
|
979
|
+
@id("sentry-org-block-code-messages")
|
|
980
|
+
@name("Block messages with source code")
|
|
981
|
+
@description("Block messages when source code constitutes more than 80% of the content. Prevents bulk source code exfiltration to external AI services.")
|
|
982
|
+
@severity("high")
|
|
983
|
+
@tags("source-code,ip-protection,data-leakage")
|
|
984
|
+
@reject_message("Message blocked: the content appears to be primarily source code (>80%). Bulk source code should not be shared with external AI services to protect intellectual property.")
|
|
985
|
+
forbid (
|
|
986
|
+
principal,
|
|
987
|
+
action == Sentry::Action::"send_message",
|
|
988
|
+
resource
|
|
989
|
+
)
|
|
990
|
+
when {
|
|
991
|
+
context has contains_code && context.contains_code &&
|
|
992
|
+
context has code_ratio && context.code_ratio > 80
|
|
993
|
+
};
|
|
994
|
+
|
|
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
|
+
// ---------------------------------------------------------------------------
|
|
1013
|
+
// Section 3: Session-Aware Escalation
|
|
1014
|
+
// Escalate protections when threats are detected across the session.
|
|
1015
|
+
// ---------------------------------------------------------------------------
|
|
1016
|
+
|
|
1017
|
+
// Block all actions after repeated threat detection
|
|
1018
|
+
@id("sentry-org-session-threat-escalation")
|
|
1019
|
+
@name("Escalate after repeated threats")
|
|
1020
|
+
@description("Block all actions when threats have been detected in 3+ turns of the session. Repeated threat detections indicate either a persistent attacker or a compromised data source requiring investigation.")
|
|
1021
|
+
@severity("high")
|
|
1022
|
+
@tags("session,escalation,behavioral,defense-in-depth")
|
|
1023
|
+
@reject_message("Session blocked: security threats have been detected in multiple turns of this conversation. This session has been flagged for review. Please start a new session or contact your security team.")
|
|
1024
|
+
forbid (
|
|
1025
|
+
principal,
|
|
1026
|
+
action,
|
|
1027
|
+
resource
|
|
1028
|
+
)
|
|
1029
|
+
when {
|
|
1030
|
+
context has session_threat_turns && context.session_threat_turns >= 3
|
|
1031
|
+
};
|
|
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
|
+
`;
|
|
1049
|
+
// =============================================================================
|
|
1050
|
+
// CATEGORIES
|
|
1051
|
+
// =============================================================================
|
|
1052
|
+
export const SENTRY_CATEGORIES = [
|
|
1053
|
+
{ 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
|
+
{ 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
|
+
{ 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
|
+
{ 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' },
|
|
1058
|
+
];
|
|
1059
|
+
// =============================================================================
|
|
1060
|
+
// DEFAULT POLICIES
|
|
1061
|
+
// =============================================================================
|
|
1062
|
+
export const SENTRY_DEFAULTS = [
|
|
1063
|
+
{
|
|
1064
|
+
id: 'sentry-baseline-default',
|
|
1065
|
+
name: 'Baseline Permit',
|
|
1066
|
+
description: 'Permits all actions by default — threat-specific forbid policies override this when threats are detected',
|
|
1067
|
+
category: 'organization',
|
|
1068
|
+
cedarText: SENTRY_SENTRY_BASELINE_DEFAULT_CEDAR,
|
|
1069
|
+
severity: 'low',
|
|
1070
|
+
tags: ['baseline', 'permit-default', 'organization'],
|
|
1071
|
+
isActive: true,
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
id: 'sentry-semantic-default',
|
|
1075
|
+
name: 'Semantic Threat Detection',
|
|
1076
|
+
description: 'Detect and block prompt injection, jailbreak attempts, and high-severity threats across messages, paste, and file uploads',
|
|
1077
|
+
category: 'semantic',
|
|
1078
|
+
cedarText: SENTRY_SENTRY_SEMANTIC_DEFAULT_CEDAR,
|
|
1079
|
+
severity: 'critical',
|
|
1080
|
+
tags: ['injection', 'jailbreak', 'owasp-llm01', 'owasp-llm02', 'baseline'],
|
|
1081
|
+
isActive: true,
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
id: 'sentry-content-safety-default',
|
|
1085
|
+
name: 'Content Safety',
|
|
1086
|
+
description: 'Detect and block violent, harmful, hateful, sexual, and profane content including cut-and-paste safety enforcement',
|
|
1087
|
+
category: 'content_safety',
|
|
1088
|
+
cedarText: SENTRY_SENTRY_CONTENT_SAFETY_DEFAULT_CEDAR,
|
|
1089
|
+
severity: 'critical',
|
|
1090
|
+
tags: ['violence', 'hate-speech', 'sexual', 'profanity', 'content-safety', 'paste-safety', 'baseline'],
|
|
1091
|
+
isActive: true,
|
|
1092
|
+
},
|
|
1093
|
+
];
|
|
1094
|
+
// =============================================================================
|
|
1095
|
+
// ALL TEMPLATES
|
|
1096
|
+
// =============================================================================
|
|
1097
|
+
export const SENTRY_TEMPLATES = [
|
|
1098
|
+
{
|
|
1099
|
+
id: 'sentry-pii-default',
|
|
1100
|
+
name: 'PII Detection',
|
|
1101
|
+
description: 'Detect and block credit card numbers, SSNs, health data, and other PII in messages, pasted content, file uploads, and AI responses',
|
|
1102
|
+
category: 'pii',
|
|
1103
|
+
cedarText: SENTRY_SENTRY_PII_DEFAULT_CEDAR,
|
|
1104
|
+
severity: 'critical',
|
|
1105
|
+
tags: ['pii', 'privacy', 'compliance', 'pci-dss', 'gdpr', 'hipaa', 'baseline'],
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
id: 'sentry-file-safety-default',
|
|
1109
|
+
name: 'File & Attachment Safety',
|
|
1110
|
+
description: 'Enforce MIP sensitivity labels, block confidential document uploads, detect secrets and PII in files, and restrict file types',
|
|
1111
|
+
category: 'file_safety',
|
|
1112
|
+
cedarText: SENTRY_SENTRY_FILE_SAFETY_DEFAULT_CEDAR,
|
|
1113
|
+
severity: 'critical',
|
|
1114
|
+
tags: ['mip', 'document-sensitivity', 'file-upload', 'dlp', 'compliance'],
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
id: 'sentry-organization-default',
|
|
1118
|
+
name: 'Organization Rules',
|
|
1119
|
+
description: 'Organization-wide policies: credential leakage prevention, source code protection, and secrets blocking across all interactions',
|
|
1120
|
+
category: 'organization',
|
|
1121
|
+
cedarText: SENTRY_SENTRY_ORGANIZATION_DEFAULT_CEDAR,
|
|
1122
|
+
severity: 'critical',
|
|
1123
|
+
tags: ['secrets', 'credentials', 'source-code', 'data-protection', 'organization'],
|
|
1124
|
+
},
|
|
1125
|
+
];
|
|
1126
|
+
// =============================================================================
|
|
1127
|
+
// TEMPLATES METADATA
|
|
1128
|
+
// =============================================================================
|
|
1129
|
+
/** Raw templates.json metadata for the Sentry service. */
|
|
1130
|
+
export const SENTRY_TEMPLATES_JSON = `{
|
|
1131
|
+
"service": "sentry",
|
|
1132
|
+
"version": "1.0.0",
|
|
1133
|
+
"description": "Sentry policy templates for browser AI security",
|
|
1134
|
+
"categories": [
|
|
1135
|
+
{
|
|
1136
|
+
"id": "pii",
|
|
1137
|
+
"name": "PII Detection",
|
|
1138
|
+
"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"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
"id": "semantic",
|
|
1142
|
+
"name": "Semantic Threat Detection",
|
|
1143
|
+
"description": "Detect and block prompt injection, jailbreak attempts, and high-severity threats in messages, pasted content, and uploaded files"
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
"id": "content_safety",
|
|
1147
|
+
"name": "Content Safety",
|
|
1148
|
+
"description": "Detect and block violent, harmful, hateful, sexual, and profane content in AI interactions, including cut-and-paste safety rules"
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
"id": "file_safety",
|
|
1152
|
+
"name": "File & Attachment Safety",
|
|
1153
|
+
"description": "Enforce document sensitivity controls (MIP labels), block sensitive file uploads, detect secrets and PII in uploaded documents"
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"id": "organization",
|
|
1157
|
+
"name": "Organization Rules",
|
|
1158
|
+
"description": "Organization-wide baselines, AI service allowlists, credential leakage prevention, and source code protection"
|
|
1159
|
+
}
|
|
1160
|
+
],
|
|
1161
|
+
"defaults": [
|
|
1162
|
+
{
|
|
1163
|
+
"id": "sentry-baseline-default",
|
|
1164
|
+
"name": "Baseline Permit",
|
|
1165
|
+
"description": "Permits all actions by default — threat-specific forbid policies override this when threats are detected",
|
|
1166
|
+
"category": "organization",
|
|
1167
|
+
"file": "defaults/baseline.cedar",
|
|
1168
|
+
"severity": "low",
|
|
1169
|
+
"tags": ["baseline", "permit-default", "organization"],
|
|
1170
|
+
"is_active": true
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
"id": "sentry-semantic-default",
|
|
1174
|
+
"name": "Semantic Threat Detection",
|
|
1175
|
+
"description": "Detect and block prompt injection, jailbreak attempts, and high-severity threats across messages, paste, and file uploads",
|
|
1176
|
+
"category": "semantic",
|
|
1177
|
+
"file": "defaults/semantic.cedar",
|
|
1178
|
+
"severity": "critical",
|
|
1179
|
+
"tags": ["injection", "jailbreak", "owasp-llm01", "owasp-llm02", "baseline"],
|
|
1180
|
+
"is_active": true
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
"id": "sentry-content-safety-default",
|
|
1184
|
+
"name": "Content Safety",
|
|
1185
|
+
"description": "Detect and block violent, harmful, hateful, sexual, and profane content including cut-and-paste safety enforcement",
|
|
1186
|
+
"category": "content_safety",
|
|
1187
|
+
"file": "defaults/content_safety.cedar",
|
|
1188
|
+
"severity": "critical",
|
|
1189
|
+
"tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "paste-safety", "baseline"],
|
|
1190
|
+
"is_active": true
|
|
1191
|
+
}
|
|
1192
|
+
],
|
|
1193
|
+
"templates": [
|
|
1194
|
+
{
|
|
1195
|
+
"id": "sentry-pii-default",
|
|
1196
|
+
"name": "PII Detection",
|
|
1197
|
+
"description": "Detect and block credit card numbers, SSNs, health data, and other PII in messages, pasted content, file uploads, and AI responses",
|
|
1198
|
+
"category": "pii",
|
|
1199
|
+
"file": "defaults/pii.cedar",
|
|
1200
|
+
"severity": "critical",
|
|
1201
|
+
"tags": ["pii", "privacy", "compliance", "pci-dss", "gdpr", "hipaa", "baseline"]
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
"id": "sentry-file-safety-default",
|
|
1205
|
+
"name": "File & Attachment Safety",
|
|
1206
|
+
"description": "Enforce MIP sensitivity labels, block confidential document uploads, detect secrets and PII in files, and restrict file types",
|
|
1207
|
+
"category": "file_safety",
|
|
1208
|
+
"file": "defaults/file_safety.cedar",
|
|
1209
|
+
"severity": "critical",
|
|
1210
|
+
"tags": ["mip", "document-sensitivity", "file-upload", "dlp", "compliance"]
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
"id": "sentry-organization-default",
|
|
1214
|
+
"name": "Organization Rules",
|
|
1215
|
+
"description": "Organization-wide policies: credential leakage prevention, source code protection, and secrets blocking across all interactions",
|
|
1216
|
+
"category": "organization",
|
|
1217
|
+
"file": "defaults/organization.cedar",
|
|
1218
|
+
"severity": "critical",
|
|
1219
|
+
"tags": ["secrets", "credentials", "source-code", "data-protection", "organization"]
|
|
1220
|
+
}
|
|
1221
|
+
]
|
|
1222
|
+
}
|
|
1223
|
+
`;
|
|
1224
|
+
// =============================================================================
|
|
1225
|
+
// HELPER FUNCTIONS
|
|
1226
|
+
// =============================================================================
|
|
1227
|
+
export function getSentryDefaultsByCategory(category) {
|
|
1228
|
+
return SENTRY_DEFAULTS.filter(d => d.category === category);
|
|
1229
|
+
}
|
|
1230
|
+
export function getSentryTemplatesByCategory(category) {
|
|
1231
|
+
return SENTRY_TEMPLATES.filter(t => t.category === category);
|
|
1232
|
+
}
|
|
1233
|
+
export function getSentryTemplateById(id) {
|
|
1234
|
+
return SENTRY_TEMPLATES.find(t => t.id === id);
|
|
1235
|
+
}
|