@highflame/policy 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/_schemas/overwatch/schema.cedarschema +19 -5
  2. package/dist/engine.d.ts +24 -7
  3. package/dist/engine.d.ts.map +1 -1
  4. package/dist/engine.js +75 -16
  5. package/dist/engine.js.map +1 -1
  6. package/dist/engine.test.js +13 -13
  7. package/dist/engine.test.js.map +1 -1
  8. package/dist/overwatch-defaults.gen.d.ts +62 -0
  9. package/dist/overwatch-defaults.gen.d.ts.map +1 -0
  10. package/dist/overwatch-defaults.gen.js +829 -0
  11. package/dist/overwatch-defaults.gen.js.map +1 -0
  12. package/dist/overwatch-defaults.test.d.ts +8 -0
  13. package/dist/overwatch-defaults.test.d.ts.map +1 -0
  14. package/dist/overwatch-defaults.test.js +145 -0
  15. package/dist/overwatch-defaults.test.js.map +1 -0
  16. package/dist/overwatch-rebac.test.d.ts +25 -0
  17. package/dist/overwatch-rebac.test.d.ts.map +1 -0
  18. package/dist/overwatch-rebac.test.js +301 -0
  19. package/dist/overwatch-rebac.test.js.map +1 -0
  20. package/dist/schemas.test.js +6 -8
  21. package/dist/schemas.test.js.map +1 -1
  22. package/dist/service-schemas.gen.d.ts +1 -1
  23. package/dist/service-schemas.gen.d.ts.map +1 -1
  24. package/dist/service-schemas.gen.js +2 -4
  25. package/dist/service-schemas.gen.js.map +1 -1
  26. package/dist/studio-ui.test.js +3 -6
  27. package/dist/studio-ui.test.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/engine.test.ts +13 -13
  30. package/src/engine.ts +90 -19
  31. package/src/overwatch-defaults.gen.ts +907 -0
  32. package/src/overwatch-defaults.test.ts +176 -0
  33. package/src/overwatch-rebac.test.ts +346 -0
  34. package/src/schemas.test.ts +8 -8
  35. package/src/service-schemas.gen.ts +4 -4
  36. package/src/studio-ui.test.ts +6 -6
@@ -0,0 +1,829 @@
1
+ // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
+ // Source: schemas/overwatch/templates/templates.json
3
+ //
4
+ // Overwatch 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 OVERWATCH_SECRETS_DEFAULT_CEDAR = `// =============================================================================
11
+ // Secrets Detection Policy (Default)
12
+ // =============================================================================
13
+ // Detects and blocks credential leakage across prompts, tool calls, file
14
+ // operations, and AI response content. Combines YARA-based threat detection
15
+ // with pattern matching for known credential formats.
16
+ //
17
+ // Defense layers:
18
+ // 1. YARA scanner detection (contains_secrets, yara_threats)
19
+ // 2. Sensitive file path blocking (.env files)
20
+ // 3. Response content pattern matching (AWS, GitHub, SSH keys)
21
+ //
22
+ // Compliance: NIST 800-53 SC-28, IA-5 | OWASP A02 | MITRE T1552, T1555
23
+ // Category: secrets
24
+ // Namespace: Overwatch
25
+ // =============================================================================
26
+
27
+ // ---------------------------------------------------------------------------
28
+ // Section 1: YARA-Based Secret Detection
29
+ // ---------------------------------------------------------------------------
30
+
31
+ // Block prompts containing detected secrets
32
+ @id("secrets-block-prompts")
33
+ @name("Block prompts with secrets")
34
+ @description("Block prompts when YARA scanners detect API keys, tokens, or credential patterns")
35
+ @severity("critical")
36
+ @tags("secrets,credentials,prompts,nist-sc-28,nist-ia-5")
37
+ forbid (
38
+ principal,
39
+ action == Overwatch::Action::"process_prompt",
40
+ resource
41
+ )
42
+ when {
43
+ context has contains_secrets && context.contains_secrets == true
44
+ };
45
+
46
+ // Block file reads and tool calls when secrets are detected
47
+ @id("secrets-block-reads-and-tools")
48
+ @name("Block file reads and tool calls with secrets")
49
+ @description("Prevent file reads and tool execution when secrets or credentials are detected in content")
50
+ @severity("high")
51
+ @tags("secrets,file-access,tools,credentials,nist-sc-28")
52
+ forbid (
53
+ principal,
54
+ action in [Overwatch::Action::"read_file", Overwatch::Action::"call_tool"],
55
+ resource
56
+ )
57
+ when {
58
+ context has contains_secrets && context.contains_secrets == true
59
+ };
60
+
61
+ // ---------------------------------------------------------------------------
62
+ // Section 2: Sensitive File Path Protection
63
+ // ---------------------------------------------------------------------------
64
+
65
+ // Block .env file access across all operations
66
+ @id("secrets-block-env-files")
67
+ @name("Block .env file access")
68
+ @description("Block access to .env files that commonly contain secrets, API keys, and database credentials")
69
+ @severity("high")
70
+ @tags("secrets,env-files,config,nist-sc-28,mitre-t1552")
71
+ forbid (
72
+ principal,
73
+ action in [Overwatch::Action::"read_file", Overwatch::Action::"write_file", Overwatch::Action::"call_tool"],
74
+ resource
75
+ )
76
+ when {
77
+ context has path && context.path like "*.env*"
78
+ };
79
+
80
+ // ---------------------------------------------------------------------------
81
+ // Section 3: Response Content Pattern Matching
82
+ // Scans AI responses for known credential formats as defense-in-depth.
83
+ // ---------------------------------------------------------------------------
84
+
85
+ // Block responses containing AWS access keys (AKIA prefix)
86
+ @id("secrets-block-aws-keys")
87
+ @name("Block AWS access keys in responses")
88
+ @description("Detect and block AWS access key IDs (AKIA prefix) in AI responses to prevent credential exfiltration")
89
+ @severity("critical")
90
+ @tags("secrets,aws,credentials,response-scan,nist-ia-5,mitre-t1552")
91
+ forbid (
92
+ principal,
93
+ action,
94
+ resource
95
+ )
96
+ when {
97
+ context has response_content &&
98
+ context.response_content like "*AKIA*"
99
+ };
100
+
101
+ // Block responses containing AWS secret keys
102
+ @id("secrets-block-aws-secrets")
103
+ @name("Block AWS secret keys in responses")
104
+ @description("Detect and block AWS secret access keys in AI responses")
105
+ @severity("critical")
106
+ @tags("secrets,aws,credentials,response-scan,nist-ia-5")
107
+ forbid (
108
+ principal,
109
+ action,
110
+ resource
111
+ )
112
+ when {
113
+ context has response_content &&
114
+ (context.response_content like "*AWS_SECRET_ACCESS_KEY*" ||
115
+ context.response_content like "*aws_secret_access_key*")
116
+ };
117
+
118
+ // Block responses containing GitHub tokens
119
+ @id("secrets-block-github-tokens")
120
+ @name("Block GitHub tokens in responses")
121
+ @description("Detect and block GitHub personal access tokens (ghp_), fine-grained tokens (github_pat_), and app tokens (ghs_)")
122
+ @severity("critical")
123
+ @tags("secrets,github,tokens,response-scan,mitre-t1552")
124
+ forbid (
125
+ principal,
126
+ action,
127
+ resource
128
+ )
129
+ when {
130
+ context has response_content &&
131
+ (context.response_content like "*ghp_*" ||
132
+ context.response_content like "*github_pat_*" ||
133
+ context.response_content like "*ghs_*")
134
+ };
135
+
136
+ // Block responses containing SSH/RSA private keys
137
+ @id("secrets-block-private-keys")
138
+ @name("Block private keys in responses")
139
+ @description("Detect and block SSH, RSA, and OpenSSH private keys in AI responses")
140
+ @severity("critical")
141
+ @tags("secrets,ssh,private-keys,response-scan,nist-sc-28,mitre-t1552")
142
+ forbid (
143
+ principal,
144
+ action,
145
+ resource
146
+ )
147
+ when {
148
+ context has response_content &&
149
+ (context.response_content like "*-----BEGIN PRIVATE KEY-----*" ||
150
+ context.response_content like "*-----BEGIN RSA PRIVATE KEY-----*" ||
151
+ context.response_content like "*-----BEGIN OPENSSH PRIVATE KEY-----*")
152
+ };
153
+
154
+ // ---------------------------------------------------------------------------
155
+ // Section 4: YARA Credential Pattern Detection
156
+ // Catches credential types identified by YARA rule scanning.
157
+ // ---------------------------------------------------------------------------
158
+
159
+ // Block YARA-detected credential and token patterns
160
+ @id("secrets-block-yara-credentials")
161
+ @name("Block YARA-detected credential patterns")
162
+ @description("Block content flagged by YARA rules for credential exposure, API key leaks, JWT tokens, and bearer tokens")
163
+ @severity("critical")
164
+ @tags("secrets,yara,credentials,jwt,bearer,nist-ia-5")
165
+ forbid (
166
+ principal,
167
+ action,
168
+ resource
169
+ )
170
+ when {
171
+ context has yara_threats &&
172
+ (context.yara_threats.contains("secret_exposure") ||
173
+ context.yara_threats.contains("credential_leak") ||
174
+ context.yara_threats.contains("api_key_exposure") ||
175
+ context.yara_threats.contains("jwt_token_exposure") ||
176
+ context.yara_threats.contains("bearer_token_leak"))
177
+ };
178
+ `;
179
+ const OVERWATCH_PII_DEFAULT_CEDAR = `// =============================================================================
180
+ // PII Detection Policy (Default)
181
+ // =============================================================================
182
+ // Detects and blocks personally identifiable information including credit card
183
+ // numbers, Social Security Numbers, and other PII patterns across prompts
184
+ // and tool calls.
185
+ //
186
+ // Compliance: PCI DSS 3.4, 4.1 | NIST 800-53 SI-4 | GDPR Art. 32
187
+ // Category: pii
188
+ // Namespace: Overwatch
189
+ // =============================================================================
190
+
191
+ // Block prompts containing credit card patterns
192
+ @id("pii-block-credit-cards")
193
+ @name("Block credit card numbers")
194
+ @description("Detect and block content containing credit card number patterns (PCI DSS compliance)")
195
+ @severity("critical")
196
+ @tags("pci,credit-card,payment,compliance,pci-dss-3.4")
197
+ forbid (
198
+ principal,
199
+ action == Overwatch::Action::"process_prompt",
200
+ resource
201
+ )
202
+ when {
203
+ context has yara_threats && context.yara_threats.contains("credit_card")
204
+ };
205
+
206
+ // Block prompts containing SSN patterns
207
+ @id("pii-block-ssn")
208
+ @name("Block Social Security Numbers")
209
+ @description("Detect and block content containing SSN patterns (XXX-XX-XXXX format)")
210
+ @severity("critical")
211
+ @tags("ssn,identity,privacy,compliance")
212
+ forbid (
213
+ principal,
214
+ action == Overwatch::Action::"process_prompt",
215
+ resource
216
+ )
217
+ when {
218
+ context has yara_threats && context.yara_threats.contains("ssn")
219
+ };
220
+
221
+ // Block prompts with generic PII threats detected
222
+ @id("pii-block-generic")
223
+ @name("Block detected PII content")
224
+ @description("Block content when PII-related threat categories are detected by YARA or Javelin scanners")
225
+ @severity("high")
226
+ @tags("pii,privacy,data-protection,gdpr")
227
+ forbid (
228
+ principal,
229
+ action == Overwatch::Action::"process_prompt",
230
+ resource
231
+ )
232
+ when {
233
+ context has threat_categories && context.threat_categories.contains("pii")
234
+ };
235
+
236
+ // Block PII leakage via tool calls
237
+ @id("pii-block-tool-calls")
238
+ @name("Block tool calls with PII")
239
+ @description("Prevent tool execution when PII patterns are detected in content")
240
+ @severity("high")
241
+ @tags("pii,tools,data-protection")
242
+ forbid (
243
+ principal,
244
+ action == Overwatch::Action::"call_tool",
245
+ resource
246
+ )
247
+ when {
248
+ context has threat_categories && context.threat_categories.contains("pii")
249
+ };
250
+ `;
251
+ const OVERWATCH_SEMANTIC_DEFAULT_CEDAR = `// =============================================================================
252
+ // Semantic Threat Detection Policy (Default)
253
+ // =============================================================================
254
+ // Detects and blocks prompt injection, jailbreak attempts, and high-severity
255
+ // AI security threats using YARA and Javelin scanner results. Provides
256
+ // defense-in-depth across both prompts and tool calls.
257
+ //
258
+ // Compliance: NIST 800-53 SI-3, SI-4 | OWASP LLM Top 10: LLM01, LLM02
259
+ // MITRE ATLAS: AML.T0051 (LLM Prompt Injection)
260
+ // Category: semantic
261
+ // Namespace: Overwatch
262
+ // =============================================================================
263
+
264
+ // Block prompts with prompt injection detected by YARA
265
+ @id("semantic-block-injection")
266
+ @name("Block prompt injection")
267
+ @description("Detect and block prompt injection patterns in user input via YARA scanning (OWASP LLM01)")
268
+ @severity("critical")
269
+ @tags("injection,security,llm,owasp-llm01,baseline")
270
+ forbid (
271
+ principal,
272
+ action == Overwatch::Action::"process_prompt",
273
+ resource
274
+ )
275
+ when {
276
+ context has yara_threats && context.yara_threats.contains("prompt_injection")
277
+ };
278
+
279
+ // Block prompts with jailbreak attempts
280
+ @id("semantic-block-jailbreak")
281
+ @name("Block jailbreak attempts")
282
+ @description("Detect and block jailbreak and bypass attempts against AI agents (OWASP LLM02)")
283
+ @severity("critical")
284
+ @tags("jailbreak,bypass,security,owasp-llm02,baseline")
285
+ forbid (
286
+ principal,
287
+ action == Overwatch::Action::"process_prompt",
288
+ resource
289
+ )
290
+ when {
291
+ context has yara_threats && context.yara_threats.contains("jailbreak")
292
+ };
293
+
294
+ // Block prompts with high severity semantic threats
295
+ @id("semantic-block-high-severity")
296
+ @name("Block high severity threats")
297
+ @description("Block prompts when semantic threat scanners detect high severity issues (severity >= 3)")
298
+ @severity("high")
299
+ @tags("semantic,severity,security")
300
+ forbid (
301
+ principal,
302
+ action == Overwatch::Action::"process_prompt",
303
+ resource
304
+ )
305
+ when {
306
+ context has threat_categories && context has max_threat_severity &&
307
+ context.threat_categories.contains("semantic") &&
308
+ context.max_threat_severity >= 3
309
+ };
310
+
311
+ // Block prompts with critical threat level
312
+ @id("semantic-block-critical")
313
+ @name("Block critical threats")
314
+ @description("Block all content when any scanner detects critical severity threats")
315
+ @severity("critical")
316
+ @tags("critical,baseline,security")
317
+ forbid (
318
+ principal,
319
+ action == Overwatch::Action::"process_prompt",
320
+ resource
321
+ )
322
+ when {
323
+ context has highest_severity && context.highest_severity == "critical"
324
+ };
325
+
326
+ // Block tool calls with prompt injection detected
327
+ @id("semantic-block-tool-injection")
328
+ @name("Block tool calls with injection")
329
+ @description("Prevent tool execution when prompt injection patterns are detected in content")
330
+ @severity("critical")
331
+ @tags("injection,tools,security,owasp-llm01")
332
+ forbid (
333
+ principal,
334
+ action == Overwatch::Action::"call_tool",
335
+ resource
336
+ )
337
+ when {
338
+ context has yara_threats && context.yara_threats.contains("prompt_injection")
339
+ };
340
+ `;
341
+ const OVERWATCH_TOOLS_DEFAULT_CEDAR = `// =============================================================================
342
+ // Tool Permissioning Policy (Default)
343
+ // =============================================================================
344
+ // Controls access to IDE tools, shell execution, file system paths, and MCP
345
+ // operations. Blocks dangerous command execution tools and restricts access
346
+ // to sensitive system directories and credential files.
347
+ //
348
+ // Compliance: NIST 800-53 AC-3, AC-6, CM-7 | OWASP A01, A03
349
+ // MITRE ATT&CK T1059 (Command/Scripting Interpreter)
350
+ // MITRE ATT&CK T1005 (Data from Local System)
351
+ // Category: tools
352
+ // Namespace: Overwatch
353
+ // =============================================================================
354
+
355
+ // ---------------------------------------------------------------------------
356
+ // Section 1: Dangerous Tool Blocking
357
+ // ---------------------------------------------------------------------------
358
+
359
+ // Block shell and command execution tools
360
+ @id("tools-block-shell-execution")
361
+ @name("Block shell and command execution")
362
+ @description("Block direct shell, bash, and command execution tools to prevent command injection (MITRE T1059)")
363
+ @severity("critical")
364
+ @tags("shell,command-injection,execution,nist-cm-7,mitre-t1059,baseline")
365
+ forbid (
366
+ principal,
367
+ action == Overwatch::Action::"call_tool",
368
+ resource
369
+ )
370
+ when {
371
+ context has tool_name &&
372
+ (context.tool_name == "shell" ||
373
+ context.tool_name == "bash" ||
374
+ context.tool_name == "sh" ||
375
+ context.tool_name == "terminal" ||
376
+ context.tool_name == "system.exec" ||
377
+ context.tool_name == "process.spawn")
378
+ };
379
+
380
+ // Block destructive file operations
381
+ @id("tools-block-destructive-ops")
382
+ @name("Block destructive file operations")
383
+ @description("Block file deletion and other destructive tool operations to prevent data loss")
384
+ @severity("high")
385
+ @tags("file,delete,destructive,nist-ac-3")
386
+ forbid (
387
+ principal,
388
+ action == Overwatch::Action::"call_tool",
389
+ resource
390
+ )
391
+ when {
392
+ context has tool_name &&
393
+ (context.tool_name == "fs.delete" ||
394
+ context.tool_name == "fs.rmdir" ||
395
+ context.tool_name == "fs.unlink")
396
+ };
397
+
398
+ // ---------------------------------------------------------------------------
399
+ // Section 2: Sensitive Path Blocking
400
+ // ---------------------------------------------------------------------------
401
+
402
+ // Block access to sensitive system paths and credential files
403
+ @id("tools-block-sensitive-paths")
404
+ @name("Block access to sensitive system paths")
405
+ @description("Prevent access to system directories, credential files, SSH keys, and cloud config (MITRE T1005, T1552.001)")
406
+ @severity("high")
407
+ @tags("file,path,system,security,nist-ac-6,mitre-t1005")
408
+ forbid (
409
+ principal,
410
+ action in [Overwatch::Action::"read_file", Overwatch::Action::"write_file", Overwatch::Action::"call_tool"],
411
+ resource
412
+ )
413
+ when {
414
+ context has path &&
415
+ (context.path like "/etc/*" ||
416
+ context.path like "/var/*" ||
417
+ context.path like "/proc/*" ||
418
+ context.path like "/sys/*" ||
419
+ context.path like "/root/*" ||
420
+ context.path like "*/.ssh/*" ||
421
+ context.path like "*/.aws/*" ||
422
+ context.path like "*/.gnupg/*" ||
423
+ context.path like "*.pem" ||
424
+ context.path like "*/id_rsa*" ||
425
+ context.path like "*/id_ed25519*")
426
+ };
427
+
428
+ // ---------------------------------------------------------------------------
429
+ // Section 3: Threat-Based Tool Blocking
430
+ // ---------------------------------------------------------------------------
431
+
432
+ // Block tool calls with high severity threats detected
433
+ @id("tools-block-high-severity-threats")
434
+ @name("Block tool calls with high severity threats")
435
+ @description("Prevent tool execution when high or critical severity threats are detected in content")
436
+ @severity("high")
437
+ @tags("tools,threats,severity,security")
438
+ forbid (
439
+ principal,
440
+ action == Overwatch::Action::"call_tool",
441
+ resource
442
+ )
443
+ when {
444
+ context has threat_count && context has max_threat_severity &&
445
+ context.threat_count > 0 && context.max_threat_severity >= 3
446
+ };
447
+ `;
448
+ const OVERWATCH_TOOLS_MCP_ALLOWLIST_CEDAR = `// MCP Server Allowlist Template
449
+ // Only allow specific MCP servers to be used
450
+ // Category: tools
451
+ //
452
+ // NOTE: Users should customize the mcp_server values in the permit rule
453
+ // to match their allowed servers before deploying this template.
454
+
455
+ @id("mcp-allowlist-permit")
456
+ @name("Allow specific MCP servers")
457
+ @description("Only allow connections to pre-approved MCP servers (customize the list)")
458
+ @severity("medium")
459
+ @tags("mcp,allowlist,server,governance")
460
+ permit (
461
+ principal,
462
+ action == Overwatch::Action::"connect_server",
463
+ resource
464
+ )
465
+ when {
466
+ context.mcp_server == "filesystem" ||
467
+ context.mcp_server == "playwright"
468
+ };
469
+
470
+ @id("mcp-allowlist-deny")
471
+ @name("Deny unallowed MCP servers")
472
+ @description("Block all MCP server connections not in the allowlist")
473
+ @severity("medium")
474
+ @tags("mcp,deny-default,server")
475
+ forbid (
476
+ principal,
477
+ action == Overwatch::Action::"connect_server",
478
+ resource
479
+ );
480
+ `;
481
+ const OVERWATCH_ORG_DEFAULT_DENY_CEDAR = `// Default Deny All Template
482
+ // Organization-wide baseline: deny all unless explicitly permitted
483
+ // Category: organization
484
+
485
+ @id("org-deny-all")
486
+ @name("Deny all actions by default")
487
+ @description("Block all actions unless explicitly permitted by other policies - use as organization baseline")
488
+ @severity("high")
489
+ @tags("baseline,security,deny-by-default,organization")
490
+ forbid (
491
+ principal,
492
+ action,
493
+ resource
494
+ );
495
+ `;
496
+ const OVERWATCH_ORG_AUDIT_ALL_CEDAR = `// Audit All Actions Template
497
+ // Log all agent actions for compliance and monitoring
498
+ // Category: organization
499
+
500
+ @id("org-audit-all")
501
+ @name("Audit all actions")
502
+ @description("Permit and log all agent actions for compliance auditing and monitoring")
503
+ @severity("low")
504
+ @tags("audit,compliance,logging,organization")
505
+ permit (
506
+ principal,
507
+ action,
508
+ resource
509
+ );
510
+ `;
511
+ const OVERWATCH_ORG_TEAM_PERMISSIONS_CEDAR = `// Team-Based Permissions (ReBAC)
512
+ // Grant IDE access based on team membership using entity hierarchy
513
+ // Category: organization
514
+ // Namespace: Overwatch
515
+ //
516
+ // Entity hierarchy required:
517
+ // Organization::"acme-corp"
518
+ // └── Team::"dev-team" (in Organization)
519
+ // │ └── Agent::"claude" (in Team)
520
+ // └── Team::"support-team" (in Organization)
521
+ // └── Agent::"claude-support" (in Team)
522
+
523
+ // Dev Team: Full IDE access - all actions permitted
524
+ @id("team-dev-full-access")
525
+ @name("Dev team full IDE access")
526
+ @description("Grant development team agents full IDE access including tools, prompts, file operations, and server connections")
527
+ @severity("medium")
528
+ @tags("rebac,team,dev,permissions,organization")
529
+ permit (
530
+ principal in Overwatch::Team::"dev-team",
531
+ action,
532
+ resource
533
+ );
534
+
535
+ // Support Team: Read-only access - process prompts and read files only
536
+ @id("team-support-read-only")
537
+ @name("Support team read-only access")
538
+ @description("Grant support team agents read-only access limited to prompt processing and file reading")
539
+ @severity("medium")
540
+ @tags("rebac,team,support,read-only,organization")
541
+ permit (
542
+ principal in Overwatch::Team::"support-team",
543
+ action in [Overwatch::Action::"process_prompt", Overwatch::Action::"read_file"],
544
+ resource
545
+ );
546
+ `;
547
+ const OVERWATCH_ORG_AGENT_GUARDRAILS_CEDAR = `// Agent-Specific Guardrails
548
+ // Apply per-agent security policies based on agent identity
549
+ // Category: organization
550
+ // Namespace: Overwatch
551
+ //
552
+ // Different agents have different risk profiles:
553
+ // Claude Code → prompt injection detection
554
+ // Cursor → PII leakage detection
555
+
556
+ // Claude Code: Block prompt injection attempts
557
+ @id("agent-claude-block-injection")
558
+ @name("Claude Code injection guardrail")
559
+ @description("Block prompt injection attempts specifically for Claude Code agent")
560
+ @severity("critical")
561
+ @tags("rebac,agent,claude,injection,guardrail,organization")
562
+ forbid (
563
+ principal == Overwatch::Agent::"claude",
564
+ action == Overwatch::Action::"process_prompt",
565
+ resource
566
+ )
567
+ when {
568
+ context.yara_threats.contains("prompt_injection")
569
+ };
570
+
571
+ // Cursor: Block PII leakage
572
+ @id("agent-cursor-block-pii")
573
+ @name("Cursor PII guardrail")
574
+ @description("Block PII content in Cursor agent prompts to prevent data leakage")
575
+ @severity("critical")
576
+ @tags("rebac,agent,cursor,pii,guardrail,organization")
577
+ forbid (
578
+ principal == Overwatch::Agent::"cursor",
579
+ action == Overwatch::Action::"process_prompt",
580
+ resource
581
+ )
582
+ when {
583
+ context.threat_categories.contains("pii")
584
+ };
585
+ `;
586
+ // =============================================================================
587
+ // CATEGORIES
588
+ // =============================================================================
589
+ export const OVERWATCH_CATEGORIES = [
590
+ { id: 'secrets', name: 'Secrets Detection', description: 'Detect and block credentials, tokens, API keys, and sensitive key patterns in prompts, tool calls, and AI responses' },
591
+ { id: 'pii', name: 'PII Detection', description: 'Detect and block personally identifiable information (PII) such as credit card numbers, SSNs, and other sensitive data' },
592
+ { id: 'semantic', name: 'Semantic Threat Detection', description: 'Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats' },
593
+ { id: 'tools', name: 'Tool Permissioning', description: 'Control access to shell execution, file operations, MCP servers, and sensitive system paths' },
594
+ { id: 'organization', name: 'Organization Rules', description: 'Apply organization-wide policy baselines, team permissions, and agent-specific guardrails' },
595
+ ];
596
+ // =============================================================================
597
+ // DEFAULT POLICIES
598
+ // =============================================================================
599
+ export const OVERWATCH_DEFAULTS = [
600
+ {
601
+ id: 'secrets-default',
602
+ name: 'Secrets Detection',
603
+ description: 'Detect and block credential leakage across prompts, tool calls, file operations, and AI response content',
604
+ category: 'secrets',
605
+ cedarText: OVERWATCH_SECRETS_DEFAULT_CEDAR,
606
+ severity: 'critical',
607
+ tags: ['api-keys', 'tokens', 'credentials', 'aws', 'github', 'ssh', 'baseline'],
608
+ isActive: true,
609
+ },
610
+ {
611
+ id: 'pii-default',
612
+ name: 'PII Detection',
613
+ description: 'Detect and block credit card numbers, SSN, and other sensitive personal information in prompts and tool calls',
614
+ category: 'pii',
615
+ cedarText: OVERWATCH_PII_DEFAULT_CEDAR,
616
+ severity: 'critical',
617
+ tags: ['pii', 'privacy', 'compliance', 'pci-dss', 'gdpr', 'baseline'],
618
+ isActive: true,
619
+ },
620
+ {
621
+ id: 'semantic-default',
622
+ name: 'Semantic Threat Detection',
623
+ description: 'Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats',
624
+ category: 'semantic',
625
+ cedarText: OVERWATCH_SEMANTIC_DEFAULT_CEDAR,
626
+ severity: 'critical',
627
+ tags: ['prompt-injection', 'jailbreak', 'owasp-llm01', 'security', 'baseline'],
628
+ isActive: true,
629
+ },
630
+ {
631
+ id: 'tools-default',
632
+ name: 'Tool Permissioning',
633
+ description: 'Block dangerous shell execution, restrict sensitive file paths, and enforce threat-based tool access controls',
634
+ category: 'tools',
635
+ cedarText: OVERWATCH_TOOLS_DEFAULT_CEDAR,
636
+ severity: 'critical',
637
+ tags: ['shell', 'command-injection', 'file-access', 'mitre-t1059', 'baseline'],
638
+ isActive: false,
639
+ },
640
+ ];
641
+ // =============================================================================
642
+ // ALL TEMPLATES
643
+ // =============================================================================
644
+ export const OVERWATCH_TEMPLATES = [
645
+ {
646
+ id: 'tools-mcp-allowlist',
647
+ name: 'MCP Server Allowlist',
648
+ description: 'Only allow specific MCP servers to be used',
649
+ category: 'tools',
650
+ cedarText: OVERWATCH_TOOLS_MCP_ALLOWLIST_CEDAR,
651
+ severity: 'medium',
652
+ tags: ['mcp', 'allowlist', 'whitelist'],
653
+ },
654
+ {
655
+ id: 'org-default-deny',
656
+ name: 'Default Deny All',
657
+ description: 'Organization-wide baseline: deny all unless explicitly permitted',
658
+ category: 'organization',
659
+ cedarText: OVERWATCH_ORG_DEFAULT_DENY_CEDAR,
660
+ severity: 'high',
661
+ tags: ['baseline', 'security', 'deny-by-default'],
662
+ },
663
+ {
664
+ id: 'org-audit-all',
665
+ name: 'Audit All Actions',
666
+ description: 'Log all agent actions for compliance and monitoring',
667
+ category: 'organization',
668
+ cedarText: OVERWATCH_ORG_AUDIT_ALL_CEDAR,
669
+ severity: 'low',
670
+ tags: ['audit', 'compliance', 'logging'],
671
+ },
672
+ {
673
+ id: 'org-team-permissions',
674
+ name: 'Team-Based Permissions (ReBAC)',
675
+ description: 'Grant IDE access based on team membership using entity hierarchy - supports dev team full access and support team read-only',
676
+ category: 'organization',
677
+ cedarText: OVERWATCH_ORG_TEAM_PERMISSIONS_CEDAR,
678
+ severity: 'medium',
679
+ tags: ['rebac', 'team', 'permissions', 'hierarchy'],
680
+ },
681
+ {
682
+ id: 'org-agent-guardrails',
683
+ name: 'Agent-Specific Guardrails',
684
+ description: 'Apply per-agent security guardrails - injection blocking for Claude, PII blocking for Cursor',
685
+ category: 'organization',
686
+ cedarText: OVERWATCH_ORG_AGENT_GUARDRAILS_CEDAR,
687
+ severity: 'critical',
688
+ tags: ['rebac', 'agent', 'guardrails', 'per-agent'],
689
+ },
690
+ ];
691
+ // =============================================================================
692
+ // TEMPLATES METADATA
693
+ // =============================================================================
694
+ /** Raw templates.json metadata for the Overwatch service. */
695
+ export const OVERWATCH_TEMPLATES_JSON = `{
696
+ "service": "overwatch",
697
+ "version": "2.0.0",
698
+ "description": "Overwatch policy templates for IDE security",
699
+ "categories": [
700
+ {
701
+ "id": "secrets",
702
+ "name": "Secrets Detection",
703
+ "description": "Detect and block credentials, tokens, API keys, and sensitive key patterns in prompts, tool calls, and AI responses"
704
+ },
705
+ {
706
+ "id": "pii",
707
+ "name": "PII Detection",
708
+ "description": "Detect and block personally identifiable information (PII) such as credit card numbers, SSNs, and other sensitive data"
709
+ },
710
+ {
711
+ "id": "semantic",
712
+ "name": "Semantic Threat Detection",
713
+ "description": "Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats"
714
+ },
715
+ {
716
+ "id": "tools",
717
+ "name": "Tool Permissioning",
718
+ "description": "Control access to shell execution, file operations, MCP servers, and sensitive system paths"
719
+ },
720
+ {
721
+ "id": "organization",
722
+ "name": "Organization Rules",
723
+ "description": "Apply organization-wide policy baselines, team permissions, and agent-specific guardrails"
724
+ }
725
+ ],
726
+ "defaults": [
727
+ {
728
+ "id": "secrets-default",
729
+ "name": "Secrets Detection",
730
+ "description": "Detect and block credential leakage across prompts, tool calls, file operations, and AI response content",
731
+ "category": "secrets",
732
+ "file": "defaults/secrets.cedar",
733
+ "severity": "critical",
734
+ "tags": ["api-keys", "tokens", "credentials", "aws", "github", "ssh", "baseline"],
735
+ "is_active": true
736
+ },
737
+ {
738
+ "id": "pii-default",
739
+ "name": "PII Detection",
740
+ "description": "Detect and block credit card numbers, SSN, and other sensitive personal information in prompts and tool calls",
741
+ "category": "pii",
742
+ "file": "defaults/pii.cedar",
743
+ "severity": "critical",
744
+ "tags": ["pii", "privacy", "compliance", "pci-dss", "gdpr", "baseline"],
745
+ "is_active": true
746
+ },
747
+ {
748
+ "id": "semantic-default",
749
+ "name": "Semantic Threat Detection",
750
+ "description": "Detect and block prompt injection, jailbreak attempts, and high-severity AI security threats",
751
+ "category": "semantic",
752
+ "file": "defaults/semantic.cedar",
753
+ "severity": "critical",
754
+ "tags": ["prompt-injection", "jailbreak", "owasp-llm01", "security", "baseline"],
755
+ "is_active": true
756
+ },
757
+ {
758
+ "id": "tools-default",
759
+ "name": "Tool Permissioning",
760
+ "description": "Block dangerous shell execution, restrict sensitive file paths, and enforce threat-based tool access controls",
761
+ "category": "tools",
762
+ "file": "defaults/tools.cedar",
763
+ "severity": "critical",
764
+ "tags": ["shell", "command-injection", "file-access", "mitre-t1059", "baseline"],
765
+ "is_active": false
766
+ }
767
+ ],
768
+ "templates": [
769
+ {
770
+ "id": "tools-mcp-allowlist",
771
+ "name": "MCP Server Allowlist",
772
+ "description": "Only allow specific MCP servers to be used",
773
+ "category": "tools",
774
+ "file": "mcp_server_allowlist.cedar",
775
+ "severity": "medium",
776
+ "tags": ["mcp", "allowlist", "whitelist"]
777
+ },
778
+ {
779
+ "id": "org-default-deny",
780
+ "name": "Default Deny All",
781
+ "description": "Organization-wide baseline: deny all unless explicitly permitted",
782
+ "category": "organization",
783
+ "file": "default_deny_all.cedar",
784
+ "severity": "high",
785
+ "tags": ["baseline", "security", "deny-by-default"]
786
+ },
787
+ {
788
+ "id": "org-audit-all",
789
+ "name": "Audit All Actions",
790
+ "description": "Log all agent actions for compliance and monitoring",
791
+ "category": "organization",
792
+ "file": "audit_all_actions.cedar",
793
+ "severity": "low",
794
+ "tags": ["audit", "compliance", "logging"]
795
+ },
796
+ {
797
+ "id": "org-team-permissions",
798
+ "name": "Team-Based Permissions (ReBAC)",
799
+ "description": "Grant IDE access based on team membership using entity hierarchy - supports dev team full access and support team read-only",
800
+ "category": "organization",
801
+ "file": "team_permissions.cedar",
802
+ "severity": "medium",
803
+ "tags": ["rebac", "team", "permissions", "hierarchy"]
804
+ },
805
+ {
806
+ "id": "org-agent-guardrails",
807
+ "name": "Agent-Specific Guardrails",
808
+ "description": "Apply per-agent security guardrails - injection blocking for Claude, PII blocking for Cursor",
809
+ "category": "organization",
810
+ "file": "agent_guardrails.cedar",
811
+ "severity": "critical",
812
+ "tags": ["rebac", "agent", "guardrails", "per-agent"]
813
+ }
814
+ ]
815
+ }
816
+ `;
817
+ // =============================================================================
818
+ // HELPER FUNCTIONS
819
+ // =============================================================================
820
+ export function getOverwatchDefaultsByCategory(category) {
821
+ return OVERWATCH_DEFAULTS.filter(d => d.category === category);
822
+ }
823
+ export function getOverwatchTemplatesByCategory(category) {
824
+ return OVERWATCH_TEMPLATES.filter(t => t.category === category);
825
+ }
826
+ export function getOverwatchTemplateById(id) {
827
+ return OVERWATCH_TEMPLATES.find(t => t.id === id);
828
+ }
829
+ //# sourceMappingURL=overwatch-defaults.gen.js.map