@highflame/policy 2.1.32 → 2.1.33

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.
@@ -1,42 +1,41 @@
1
1
  // =============================================================================
2
2
  // Secrets Detection Policy (Default)
3
3
  // =============================================================================
4
- // Block credential and secret leakage across messages and AI responses.
4
+ // Block credential and secret leakage across messages and file uploads.
5
5
  // Shield SecretsDetector identifies 18+ secret types via regex.
6
6
  //
7
- // Paste-targeted secret rules live in clipboard.cedar; this file covers
8
- // non-paste channels (messages, responses, and cross-cutting rules).
7
+ // Paste-targeted secret rules live in clipboard.cedar.
9
8
  //
10
9
  // Category: secrets
11
10
  // Namespace: Sentry
12
11
  // =============================================================================
13
12
 
14
- // Block messages containing secrets
13
+ // Block messages and uploads containing secrets
15
14
  @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.")
15
+ @name("Block messages and uploads with secrets")
16
+ @description("Block messages and file uploads when detection engines identify API keys, tokens, or credential patterns. First line of defense against accidental credential exposure in AI chat interactions.")
18
17
  @severity("critical")
19
18
  @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.")
19
+ @reject_message("Content blocked: detected secrets such as API keys, tokens, or credentials. Remove all secrets before sending to AI services.")
21
20
  forbid (
22
21
  principal,
23
- action == Sentry::Action::"send_message",
22
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
24
23
  resource
25
24
  )
26
25
  when {
27
26
  context has contains_secrets && context.contains_secrets
28
27
  };
29
28
 
30
- // Block high-risk secret types across all actions
29
+ // Block high-risk secret types across messages and file uploads
31
30
  @id("sentry-org-block-high-risk-secrets")
32
31
  @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.")
32
+ @description("Block messages and file uploads containing cloud provider keys (AWS, GCP, Azure), GitHub tokens, SSH private keys, or database connection strings. These credential types pose the highest exfiltration risk.")
34
33
  @severity("critical")
35
34
  @tags("secrets,aws,github,ssh,cloud,nist-ia-5,mitre-t1552")
36
35
  @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
36
  forbid (
38
37
  principal,
39
- action,
38
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
40
39
  resource
41
40
  )
42
41
  when {
@@ -50,16 +49,16 @@ when {
50
49
  context.secret_types.contains("private_key"))
51
50
  };
52
51
 
53
- // Block API keys and tokens across all actions
52
+ // Block API keys and tokens across messages and file uploads
54
53
  @id("sentry-org-block-api-keys")
55
54
  @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.")
55
+ @description("Block messages and file uploads containing generic API keys, JWT tokens, and OAuth credentials. These are the most commonly leaked credential types when users interact with AI services.")
57
56
  @severity("high")
58
57
  @tags("secrets,api-key,jwt,oauth,nist-ia-5")
59
58
  @reject_message("Content blocked: API keys, JWT tokens, or OAuth credentials detected. These must never be shared with AI services.")
60
59
  forbid (
61
60
  principal,
62
- action,
61
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
63
62
  resource
64
63
  )
65
64
  when {
@@ -71,23 +70,23 @@ when {
71
70
  context.secret_types.contains("stripe_key"))
72
71
  };
73
72
 
74
- // Block SSH key exposure across messages, paste, and file uploads
73
+ // Block SSH key exposure across messages and file uploads
75
74
  @id("sentry-secrets-block-ssh-keys")
76
75
  @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.")
76
+ @description("Block when SSH private key content or SSH key file paths are detected. Covers messages and file uploads. AI chat services must not receive SSH credentials.")
78
77
  @severity("critical")
79
78
  @tags("secrets,ssh,credentials,nist-ia-5,mitre-t1552")
80
79
  @reject_message("Blocked: SSH private key content or key file path detected. AI chat services must not receive SSH credentials.")
81
80
  forbid (
82
81
  principal,
83
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
82
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
84
83
  resource
85
84
  )
86
85
  when {
87
86
  context has secret_types && context.secret_types.contains("ssh_key")
88
87
  };
89
88
 
90
- // Block PEM/certificate key exposure across messages, paste, and file uploads
89
+ // Block PEM/certificate key exposure across messages and file uploads
91
90
  @id("sentry-secrets-block-pem-keys")
92
91
  @name("Block PEM/certificate key exposure")
93
92
  @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.")
@@ -96,7 +95,7 @@ when {
96
95
  @reject_message("Blocked: PEM private key or certificate key file detected. AI chat services must not receive certificate credentials.")
97
96
  forbid (
98
97
  principal,
99
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
98
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
100
99
  resource
101
100
  )
102
101
  when {
@@ -106,13 +105,13 @@ when {
106
105
  // Block bulk secret exposure
107
106
  @id("sentry-org-block-bulk-secrets")
108
107
  @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.")
108
+ @description("Block messages and file uploads when 3+ distinct secrets are found. Multiple secrets indicate a configuration dump, .env file paste, or credential harvesting being sent to AI services.")
110
109
  @severity("critical")
111
110
  @tags("secrets,bulk,data-exfiltration,nist-sc-28")
112
111
  @reject_message("Content blocked: multiple credentials detected (3+). Configuration dumps and credential lists must never be shared with AI services.")
113
112
  forbid (
114
113
  principal,
115
- action,
114
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
116
115
  resource
117
116
  )
118
117
  when {
@@ -122,13 +121,13 @@ when {
122
121
  // Block detected credential patterns
123
122
  @id("sentry-org-block-detected-credentials")
124
123
  @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.")
124
+ @description("Block messages and file uploads flagged by detection engine rules for credential exposure, API key leaks, and token exposure. Defense-in-depth behind contains_secrets.")
126
125
  @severity("critical")
127
126
  @tags("secrets,credentials,detection-rules,nist-ia-5")
128
127
  @reject_message("Content blocked: detection engines identified credential patterns including secret exposure, API keys, or token leaks.")
129
128
  forbid (
130
129
  principal,
131
- action,
130
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
132
131
  resource
133
132
  )
134
133
  when {
@@ -137,19 +136,3 @@ when {
137
136
  context.detected_threats.contains("credential_leak") ||
138
137
  context.detected_threats.contains("api_key_exposure"))
139
138
  };
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
- };
@@ -2,7 +2,8 @@
2
2
  // Semantic Threat Detection Policy (Default)
3
3
  // =============================================================================
4
4
  // Detects and blocks prompt injection, jailbreak attempts, and high-severity
5
- // threats across all browser AI interactions: messages, paste, file uploads.
5
+ // threats across browser AI interactions: messages and file uploads.
6
+ // Paste-targeted semantic rules live in clipboard.cedar.
6
7
  //
7
8
  // Uses multi-layered detection from Shield:
8
9
  // 1. ML classifier scores (injection_score, jailbreak_score)
@@ -22,20 +23,20 @@
22
23
 
23
24
  // ---------------------------------------------------------------------------
24
25
  // Section 1: Prompt Injection Detection
25
- // Blocks injection attempts in messages, pasted content, and uploaded files.
26
- // Users may inadvertently paste injection payloads from compromised sources.
26
+ // Blocks injection attempts in messages and uploaded files.
27
+ // Paste-targeted injection rules live in clipboard.cedar.
27
28
  // ---------------------------------------------------------------------------
28
29
 
29
- // Block messages and pastes with prompt injection patterns
30
+ // Block messages with prompt injection patterns
30
31
  @id("sentry-semantic-block-injection")
31
32
  @name("Block prompt injection")
32
- @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).")
33
+ @description("Block messages when detection engine rules identify prompt injection patterns. Catches instruction override, role assumption, and manipulation techniques in user input (OWASP LLM01).")
33
34
  @severity("critical")
34
35
  @tags("injection,security,owasp-llm01,mitre-aml-t0051,baseline")
35
- @reject_message("Content was blocked because prompt injection patterns were detected. This prevents manipulation of AI agent behavior. Remove adversarial instructions and try again.")
36
+ @reject_message("Content blocked: prompt injection patterns were detected. This prevents manipulation of AI agent behavior. Remove adversarial instructions and try again.")
36
37
  forbid (
37
38
  principal,
38
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
39
+ action == Sentry::Action::"process_prompt",
39
40
  resource
40
41
  )
41
42
  when {
@@ -48,10 +49,10 @@ when {
48
49
  @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.")
49
50
  @severity("critical")
50
51
  @tags("injection,ml-classifier,security,owasp-llm01")
51
- @reject_message("Your content was blocked because the ML classifier detected prompt injection with high confidence.")
52
+ @reject_message("Content blocked: the ML classifier detected prompt injection with high confidence.")
52
53
  forbid (
53
54
  principal,
54
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
55
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
55
56
  resource
56
57
  )
57
58
  when {
@@ -64,7 +65,7 @@ when {
64
65
  @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.")
65
66
  @severity("critical")
66
67
  @tags("injection,file-upload,security,owasp-llm01")
67
- @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.")
68
+ @reject_message("Upload blocked: prompt injection patterns were detected in the uploaded document. Files containing adversarial instructions cannot be shared with AI services.")
68
69
  forbid (
69
70
  principal,
70
71
  action == Sentry::Action::"upload_file",
@@ -85,10 +86,10 @@ when {
85
86
  @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).")
86
87
  @severity("critical")
87
88
  @tags("jailbreak,bypass,security,owasp-llm02,mitre-aml-t0054,baseline")
88
- @reject_message("Your message was blocked because jailbreak patterns were detected. This prevents circumvention of AI safety controls.")
89
+ @reject_message("Content blocked: jailbreak patterns were detected. This prevents circumvention of AI safety controls.")
89
90
  forbid (
90
91
  principal,
91
- action == Sentry::Action::"send_message",
92
+ action == Sentry::Action::"process_prompt",
92
93
  resource
93
94
  )
94
95
  when {
@@ -101,10 +102,10 @@ when {
101
102
  @description("Block content when the ML jailbreak classifier exceeds threshold (75/100). Catches sophisticated jailbreak techniques including multi-turn manipulation and encoded payloads.")
102
103
  @severity("critical")
103
104
  @tags("jailbreak,ml-classifier,security,owasp-llm02")
104
- @reject_message("Your content was blocked because the ML classifier detected a jailbreak attempt with high confidence.")
105
+ @reject_message("Content blocked: the ML classifier detected a jailbreak attempt with high confidence.")
105
106
  forbid (
106
107
  principal,
107
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content"],
108
+ action == Sentry::Action::"process_prompt",
108
109
  resource
109
110
  )
110
111
  when {
@@ -119,13 +120,13 @@ when {
119
120
  // Block any content with critical severity threats
120
121
  @id("sentry-semantic-block-critical")
121
122
  @name("Block critical threats")
122
- @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.")
123
+ @description("Block messages and file uploads when any detection engine reports critical severity. This is the ultimate catch-all for critical-severity threats regardless of type or source.")
123
124
  @severity("critical")
124
125
  @tags("critical,baseline,security,catch-all")
125
- @reject_message("Your content was blocked because security scanners detected a critical-severity threat. This content cannot be processed by AI services.")
126
+ @reject_message("Content blocked: security scanners detected a critical-severity threat. This content cannot be processed by AI services.")
126
127
  forbid (
127
128
  principal,
128
- action,
129
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
129
130
  resource
130
131
  )
131
132
  when {
@@ -138,10 +139,10 @@ when {
138
139
  @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.")
139
140
  @severity("high")
140
141
  @tags("semantic,severity,security,defense-in-depth")
141
- @reject_message("Your message was blocked because security scanners detected high severity issues. Review your content for manipulative or adversarial patterns.")
142
+ @reject_message("Content blocked: security scanners detected high severity issues. Review your content for manipulative or adversarial patterns.")
142
143
  forbid (
143
144
  principal,
144
- action == Sentry::Action::"send_message",
145
+ action == Sentry::Action::"process_prompt",
145
146
  resource
146
147
  )
147
148
  when {
@@ -156,10 +157,10 @@ when {
156
157
  @description("Block content when multiple distinct threats are detected simultaneously (3+). Multiple concurrent threats strongly indicate an adversarial attack chain or compromised content.")
157
158
  @severity("high")
158
159
  @tags("multi-threat,security,defense-in-depth")
159
- @reject_message("Content was blocked because multiple security threats were detected simultaneously. This pattern indicates potentially adversarial content.")
160
+ @reject_message("Content blocked: multiple security threats were detected simultaneously. This pattern indicates potentially adversarial content.")
160
161
  forbid (
161
162
  principal,
162
- action in [Sentry::Action::"send_message", Sentry::Action::"paste_content", Sentry::Action::"upload_file"],
163
+ action in [Sentry::Action::"process_prompt", Sentry::Action::"upload_file"],
163
164
  resource
164
165
  )
165
166
  when {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "service": "sentry",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Sentry policy templates for browser AI security",
5
5
  "categories": [
6
6
  {
@@ -21,7 +21,7 @@
21
21
  {
22
22
  "id": "content_safety",
23
23
  "name": "Content Safety",
24
- "description": "Detect and block violent, harmful, hateful, sexual, and profane content in AI interactions, including cut-and-paste safety rules"
24
+ "description": "Detect and block violent, harmful, hateful, sexual, and profane content in AI interactions across messages, paste, and file uploads"
25
25
  },
26
26
  {
27
27
  "id": "file_safety",
@@ -31,7 +31,7 @@
31
31
  {
32
32
  "id": "clipboard",
33
33
  "name": "Clipboard Policy",
34
- "description": "Control paste operations into AI chat services — block paste outright, block when secrets or source code are detected"
34
+ "description": "Control paste operations into AI chat services — block paste outright, block when secrets, PII, source code, large threat-laden pastes, encoded payloads, or invisible characters are detected"
35
35
  },
36
36
  {
37
37
  "id": "organization",
@@ -64,11 +64,11 @@
64
64
  {
65
65
  "id": "sentry-content-safety-default",
66
66
  "name": "Content Safety",
67
- "description": "Detect and block violent, harmful, hateful, sexual, and profane content including cut-and-paste safety enforcement",
67
+ "description": "Detect and block violent, harmful, hateful, sexual, and profane content across messages, paste, and file uploads",
68
68
  "category": "content_safety",
69
69
  "file": "defaults/content_safety.cedar",
70
70
  "severity": "critical",
71
- "tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "paste-safety", "baseline"]
71
+ "tags": ["violence", "hate-speech", "sexual", "profanity", "content-safety", "baseline"]
72
72
  },
73
73
  {
74
74
  "id": "sentry-secrets-default",
@@ -91,7 +91,7 @@
91
91
  {
92
92
  "id": "sentry-file-safety-default",
93
93
  "name": "File & Attachment Safety",
94
- "description": "Enforce MIP sensitivity labels, block confidential document uploads, detect secrets and PII in files, and restrict file types",
94
+ "description": "Enforce MIP sensitivity labels (restricted, confidential, rights-managed) and block file uploads containing secrets or PII",
95
95
  "category": "file_safety",
96
96
  "file": "defaults/file_safety.cedar",
97
97
  "severity": "critical",
@@ -100,11 +100,11 @@
100
100
  {
101
101
  "id": "sentry-clipboard-default",
102
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",
103
+ "description": "Control paste into AI chat services: blanket paste blocking, paste-with-secrets, paste-with-PII, paste-with-source-code, large pastes carrying threats, encoded injection payloads, and invisible-character payloads",
104
104
  "category": "clipboard",
105
105
  "file": "defaults/clipboard.cedar",
106
106
  "severity": "high",
107
- "tags": ["paste", "clipboard", "data-protection", "source-code", "secrets"]
107
+ "tags": ["paste", "clipboard", "data-protection", "source-code", "secrets", "pii", "encoding", "invisible-chars"]
108
108
  },
109
109
  {
110
110
  "id": "sentry-organization-default",