@highflame/policy 2.2.6 → 2.2.7

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.
@@ -0,0 +1,666 @@
1
+ // =============================================================================
2
+ // AgentOps Cedar Schema
3
+ // =============================================================================
4
+ // Unified schema for all agent guardrail policies. Covers every request path
5
+ // where an AI agent touches the Highflame platform:
6
+ // - LLM prompt/response (Guardrails path)
7
+ // - IDE tool calls and file access (Overwatch path)
8
+ // - MCP server connections (AI Gateway path)
9
+ //
10
+ // The context types are a superset of Guardrails, Overwatch, and AI Gateway
11
+ // schemas. All extra fields are optional — Shield projects only what is present
12
+ // in the request, Cedar ignores absent optional attributes.
13
+ //
14
+ // Service: highflame-shield (agent_ops product)
15
+ // Namespace: AgentOps
16
+ // =============================================================================
17
+
18
+ namespace AgentOps {
19
+ // =========================================================================
20
+ // Entity Types — ReBAC Hierarchy
21
+ // =========================================================================
22
+ // Entity hierarchy enables Cedar's `in` operator for policy scoping:
23
+ // Account (org root)
24
+ // └── Project in [Account]
25
+ // ├── App in [Project]
26
+ // │ └── Session in [App, Agent]
27
+ // └── Agent in [Project]
28
+ // └── Session in [App, Agent]
29
+ //
30
+ // Policy scoping examples:
31
+ // resource in AgentOps::Project::"<uuid>" → project-wide (all agents)
32
+ // resource in AgentOps::Agent::"<external_id>" → named agent + its sessions
33
+ // resource == AgentOps::Agent::"<external_id>" → named agent only (exact match)
34
+ // resource in AgentOps::Account::"<uuid>" → org-wide
35
+ // =========================================================================
36
+
37
+ /// Account represents an organization (top-level tenant)
38
+ entity Account;
39
+
40
+ /// Project represents a project within an account
41
+ entity Project in [Account];
42
+
43
+ /// User represents a principal (human or service) making requests
44
+ entity User;
45
+
46
+ /// Agent represents an AI agent (Claude, Cursor, Copilot, MCP client, etc.)
47
+ /// Used as both principal (who is acting) and resource (policy scoping target).
48
+ /// Agent + sessions: resource in AgentOps::Agent::"<external_id>" (hierarchy match)
49
+ /// Agent only: resource == AgentOps::Agent::"<external_id>" (exact match)
50
+ entity Agent in [Project];
51
+
52
+ /// App represents a protected application (guardrails-enabled LLM app)
53
+ entity App in [Project];
54
+
55
+ /// Session represents an agentic conversation session with state tracking.
56
+ /// Sessions can belong to either an App or an Agent.
57
+ entity Session in [App, Agent];
58
+
59
+ // =========================================================================
60
+ // Actions
61
+ // =========================================================================
62
+
63
+ /// Process user prompts and AI responses for security threats and content violations
64
+ action "process_prompt" appliesTo {
65
+ principal: [User, Agent],
66
+ resource: [App, Agent, Session],
67
+ context: ProcessPromptContext
68
+ };
69
+
70
+ /// Execute tool calls (shell, file operations, MCP tools)
71
+ action "call_tool" appliesTo {
72
+ principal: [User, Agent],
73
+ resource: [Agent, Session],
74
+ context: CallToolContext
75
+ };
76
+
77
+ /// Read file operations
78
+ action "read_file" appliesTo {
79
+ principal: [User, Agent],
80
+ resource: [Agent, Session],
81
+ context: FileReadContext
82
+ };
83
+
84
+ /// Write file operations
85
+ action "write_file" appliesTo {
86
+ principal: [User, Agent],
87
+ resource: [Agent, Session],
88
+ context: FileWriteContext
89
+ };
90
+
91
+ /// Connect to an MCP server
92
+ action "connect_server" appliesTo {
93
+ principal: [User, Agent],
94
+ resource: [Agent, Session],
95
+ context: ConnectServerContext
96
+ };
97
+
98
+ // =========================================================================
99
+ // Context Types (Action-Specific)
100
+ // =========================================================================
101
+
102
+ /// Context for process_prompt action (user prompts & AI responses)
103
+ type ProcessPromptContext = {
104
+ // Identity (AARM R6 / CAP-IDN-011) — projected from the principal's token; optional.
105
+ "role"?: String,
106
+ "privilege_scope"?: Set<String>,
107
+ "identity_type"?: String, // Principal identity class: "human" | "agent" | "service" | "mcp_server"
108
+ "principal"?: String, // Stable principal identifier (e.g. ZeroID / WIMSE URI or user id)
109
+ // Core metadata (required)
110
+ "request_id": String,
111
+ "timestamp": Long,
112
+ "direction": String, // "input" | "output"
113
+ "content_type": String, // "prompt" | "response" | "tool_call" | "file"
114
+ "detector_count": Long,
115
+
116
+ // IDE / workspace context (optional — present for Overwatch/code-agent traffic)
117
+ "source"?: String, // Traffic origin: "ide" | "cli" | "api" | "browser"
118
+ "event"?: String, // Event type: "prompt" | "tool_call" | "file_read" | ...
119
+ "user_email"?: String, // Human operator email (IDE sessions)
120
+ "cwd"?: String, // Current working directory
121
+ "workspace_root"?: String, // IDE workspace root path
122
+
123
+ // Model context (optional — present for AI Gateway traffic)
124
+ "model_name"?: String, // LLM model name: "claude-3-5-sonnet", "gpt-4o", ...
125
+ "model_provider"?: String, // Model provider: "anthropic" | "openai" | "google" | ...
126
+
127
+ // Security - Injection & Jailbreak (optional)
128
+ "injection_score"?: Long, // Combined injection confidence: MAX(pulse, deep_context)
129
+ "jailbreak_score"?: Long, // Combined jailbreak confidence: MAX(pulse, deep_context)
130
+ "injection_pulse_score"?: Long, // 0-100 Pulse single-turn classifier
131
+ "injection_deep_context_score"?: Long, // 0-100 DeepContext multi-turn
132
+ "jailbreak_pulse_score"?: Long, // 0-100 Pulse single-turn classifier
133
+ "jailbreak_deep_context_score"?: Long, // 0-100 DeepContext multi-turn
134
+ "injection_type"?: String, // "prompt" | "sql" | "command" | "none"
135
+ "indirect_injection_score"?: Long, // Indirect injection via tool outputs (0-100)
136
+
137
+ // Privacy - Secrets (optional)
138
+ "secrets_detected"?: Boolean,
139
+ "secret_count"?: Long,
140
+ "secret_types"?: Set<String>, // ["aws_access_key", "github_token", ...]
141
+
142
+ // Privacy - PII (optional)
143
+ "pii_detected"?: Boolean,
144
+ "pii_count"?: Long,
145
+ "pii_types"?: Set<String>, // ["email", "phone", "ssn", "credit_card", ...]
146
+ "pii_score"?: Long, // PII ML classifier confidence (0-100)
147
+
148
+ // Aggregated threat summary (optional — populated by aggregation detectors)
149
+ "highest_severity"?: String, // "critical" | "high" | "medium" | "low" | "none"
150
+ "threat_count"?: Long,
151
+ "threat_categories"?: Set<String>,
152
+ "detected_threats"?: Set<String>,
153
+
154
+ // Trust & Safety - Toxicity (optional)
155
+ "violence_score"?: Long, // 0-100
156
+ "hate_speech_score"?: Long, // 0-100
157
+ "sexual_score"?: Long, // 0-100
158
+ "weapons_score"?: Long, // 0-100
159
+ "crime_score"?: Long, // 0-100
160
+ "profanity_score"?: Long, // 0-100
161
+
162
+ // Semantic - Topic Classification (optional)
163
+ "content_topics"?: Set<String>, // ["controlled_substances", "weapons_manufacturing", ...]
164
+ "topic_confidence"?: Long, // 0-100
165
+
166
+ // Security - Invisible Character Detection (optional)
167
+ "invisible_chars_detected"?: Boolean,
168
+ "invisible_chars_score"?: Long, // 0-100
169
+
170
+ // Security - Pattern Detection (optional)
171
+ "command_injection_detected"?: Boolean,
172
+ "command_injection_type"?: String, // "reverse_shell" | "privilege_escalation" | ...
173
+ "command_injection_score"?: Long, // 0-100
174
+ "path_traversal_detected"?: Boolean,
175
+ "path_traversal_severity"?: String, // "critical" | "high" | "medium" | "low" | "none"
176
+ "path_traversal_type"?: String,
177
+ "sql_injection_detected"?: Boolean,
178
+ "sql_injection_type"?: String, // "tautology" | "union_based" | "destructive" | ...
179
+ "sql_injection_score"?: Long, // 0-100
180
+
181
+ // Security - Cross-Origin Escalation (optional)
182
+ "cross_origin_detected"?: Boolean,
183
+ "cross_origin_type"?: String, // "cross_origin_tool" | "cross_origin_server" | "none"
184
+ "cross_origin_score"?: Long, // 0-100
185
+
186
+ // Security - Encoded Injection (optional)
187
+ "encoded_content_detected"?: Boolean,
188
+ "encoded_types"?: Set<String>, // ["base64", "hex", "unicode", "url", ...]
189
+ "encoded_count"?: Long,
190
+ "encoded_score"?: Long, // 0-100
191
+
192
+ // Language & Script Detection (optional)
193
+ "detected_language"?: String, // ISO language code
194
+ "is_english"?: Boolean,
195
+ "language_confidence"?: Long, // 0-100
196
+ "detected_script"?: String, // "latin" | "cyrillic" | "arabic" | "unknown" | ...
197
+ "is_latin_script"?: Boolean,
198
+ "script_confidence"?: Long, // 0-100
199
+
200
+ // Content Analysis (optional)
201
+ "hallucination_score"?: Long,
202
+ "factuality_score"?: Long, // 0-100
203
+ "sentiment_score"?: Long,
204
+ "contains_code"?: Boolean,
205
+ "code_languages"?: Set<String>,
206
+ "code_ratio"?: Long, // 0-100
207
+ "keyword_matched"?: Boolean,
208
+ "keyword_categories"?: Set<String>,
209
+ "keyword_count"?: Long,
210
+ "contains_non_ascii"?: Boolean,
211
+ "phishing_detected"?: Boolean,
212
+ "content_safety_score"?: Long, // 0-100
213
+ "content_safety_blocked"?: Boolean,
214
+
215
+ // Agentic - Multi-Turn Context (optional)
216
+ "conversation_turn"?: Long,
217
+ "multi_turn_detection"?: Boolean,
218
+
219
+ // Session Detection History — cross-turn sticky flags (optional)
220
+ "session_pii_detected"?: Boolean,
221
+ "session_pii_types"?: Set<String>,
222
+ "session_secrets_detected"?: Boolean,
223
+ "session_secret_types"?: Set<String>,
224
+ "session_injection_detected"?: Boolean,
225
+ "session_command_injection"?: Boolean,
226
+ "session_threat_turns"?: Long,
227
+ "session_max_injection_score"?: Long,
228
+ "session_max_jailbreak_score"?: Long,
229
+ "session_max_command_injection_score"?: Long,
230
+ "session_max_pii_score"?: Long,
231
+ "session_max_secret_score"?: Long,
232
+ "session_cumulative_risk_score"?: Long,
233
+ "session_original_request"?: String,
234
+ "session_max_sensitivity"?: String,
235
+
236
+ // Usage Budget — multi-window token & cost enforcement (optional)
237
+ "budget_remaining_pct"?: Long,
238
+ "budget_exceeded"?: Boolean,
239
+ "budget_cost_micros_this_turn"?: Long,
240
+ "budget_model"?: String,
241
+ "budget_tokens_pct_session"?: Long,
242
+ "budget_tokens_pct_daily"?: Long,
243
+ "budget_tokens_pct_monthly"?: Long,
244
+ "budget_cost_pct_daily"?: Long,
245
+ "budget_cost_pct_monthly"?: Long,
246
+ "budget_exceeded_session"?: Boolean,
247
+ "budget_exceeded_daily"?: Boolean,
248
+ "budget_exceeded_monthly"?: Boolean,
249
+
250
+ // Agent Identity — authenticated agent principal metadata (optional)
251
+ "agent_id"?: String,
252
+ "agent_type"?: String, // "orchestrator" | "autonomous" | "tool_agent" | "human_proxy"
253
+ "agent_trust_level"?: String, // "first_party" | "verified_third_party" | "unverified"
254
+ "agent_framework"?: String,
255
+ "agent_publisher"?: String,
256
+
257
+ };
258
+
259
+ /// Context for call_tool action (agentic tool execution)
260
+ type CallToolContext = {
261
+ // Identity (AARM R6 / CAP-IDN-011) — projected from the principal's token; optional.
262
+ "role"?: String,
263
+ "privilege_scope"?: Set<String>,
264
+ "identity_type"?: String,
265
+ "principal"?: String,
266
+ // Core metadata (required)
267
+ "request_id": String,
268
+ "timestamp": Long,
269
+
270
+ // IDE / workspace context (optional)
271
+ "source"?: String,
272
+ "event"?: String,
273
+ "user_email"?: String,
274
+ "cwd"?: String,
275
+ "workspace_root"?: String,
276
+
277
+ // Tool Risk (optional)
278
+ "tool_name"?: String,
279
+ "tool_risk_score"?: Long, // 0-100
280
+ "tool_is_sensitive"?: Boolean,
281
+ "tool_category"?: String, // "safe" | "sensitive" | "dangerous"
282
+ "tool_is_builtin"?: Boolean,
283
+
284
+ // AARM R3 (CAP-ENF-007) — Action Parameter Validation
285
+ "action_params"?: {
286
+ "amount"?: Long,
287
+ "count"?: Long,
288
+ "command"?: String,
289
+ "path"?: String,
290
+ "url"?: String,
291
+ "recipient"?: String,
292
+ "target"?: String,
293
+ "query"?: String,
294
+ },
295
+ "param_type_violation"?: Boolean,
296
+ "param_type_violations"?: Set<String>,
297
+
298
+ // MCP context (optional)
299
+ "mcp_server"?: String,
300
+ "mcp_tool"?: String,
301
+ "mcp_server_verified"?: Boolean,
302
+
303
+ // Agentic - Behavioral Patterns (optional)
304
+ "suspicious_pattern"?: Boolean,
305
+ "pattern_type"?: String, // "data_exfiltration" | "secret_exfiltration" | ...
306
+ "sequence_risk"?: Long, // 0-100
307
+
308
+ // Agentic - Loop Detection (optional)
309
+ "loop_detected"?: Boolean,
310
+ "loop_count"?: Long,
311
+ "loop_tool"?: String,
312
+
313
+ // Security checks on tool arguments (optional)
314
+ "secrets_detected"?: Boolean,
315
+ "secret_count"?: Long,
316
+ "secret_types"?: Set<String>,
317
+ "pii_detected"?: Boolean,
318
+ "pii_types"?: Set<String>,
319
+ "pii_count"?: Long,
320
+ "pii_score"?: Long,
321
+ "injection_score"?: Long,
322
+ "injection_pulse_score"?: Long,
323
+ "injection_deep_context_score"?: Long,
324
+ "indirect_injection_score"?: Long,
325
+ "indirect_injection_type"?: String, // Type of indirect injection detected
326
+
327
+ // Semantic - Topic Classification (optional)
328
+ "content_topics"?: Set<String>, // ["controlled_substances", "weapons_manufacturing", ...]
329
+ "topic_confidence"?: Long, // 0-100
330
+
331
+ // Security - Pattern Detection (optional)
332
+ "command_injection_detected"?: Boolean,
333
+ "command_injection_type"?: String,
334
+ "command_injection_score"?: Long,
335
+ "path_traversal_detected"?: Boolean,
336
+ "path_traversal_severity"?: String,
337
+ "path_traversal_type"?: String,
338
+ "sql_injection_detected"?: Boolean,
339
+ "sql_injection_type"?: String,
340
+ "sql_injection_score"?: Long,
341
+
342
+ // Security - Cross-Origin Escalation (optional)
343
+ "cross_origin_detected"?: Boolean,
344
+ "cross_origin_type"?: String,
345
+ "cross_origin_score"?: Long,
346
+
347
+ // Security - Invisible Character Detection (optional)
348
+ "invisible_chars_detected"?: Boolean,
349
+ "invisible_chars_score"?: Long,
350
+
351
+ // Security - Encoded Injection (optional)
352
+ "encoded_content_detected"?: Boolean,
353
+ "encoded_types"?: Set<String>,
354
+ "encoded_count"?: Long,
355
+ "encoded_score"?: Long,
356
+
357
+ // Agentic - Agent Security (optional)
358
+ "tool_poisoning_detected"?: Boolean,
359
+ "tool_poisoning_score"?: Long,
360
+ "tool_poisoning_type"?: String,
361
+ "rug_pull_detected"?: Boolean,
362
+ "rug_pull_score"?: Long,
363
+ "rug_pull_type"?: String,
364
+
365
+ // Agentic - MCP Risk (optional)
366
+ "mcp_config_risk"?: Boolean,
367
+ "mcp_risk_type"?: String,
368
+ "mcp_risk_score"?: Long,
369
+
370
+ // Tool Operation Classifier (optional)
371
+ "tool_operation_classes"?: Set<String>,
372
+
373
+ // Agentic - Multi-Turn Context (optional)
374
+ "conversation_turn"?: Long,
375
+ "multi_turn_detection"?: Boolean,
376
+
377
+ // Session Detection History — cross-turn sticky flags (optional)
378
+ "session_pii_detected"?: Boolean,
379
+ "session_pii_types"?: Set<String>,
380
+ "session_secrets_detected"?: Boolean,
381
+ "session_secret_types"?: Set<String>,
382
+ "session_injection_detected"?: Boolean,
383
+ "session_command_injection"?: Boolean,
384
+ "session_threat_turns"?: Long,
385
+ "session_max_injection_score"?: Long,
386
+ "session_max_jailbreak_score"?: Long,
387
+ "session_max_command_injection_score"?: Long,
388
+ "session_max_pii_score"?: Long,
389
+ "session_max_secret_score"?: Long,
390
+ "session_cumulative_risk_score"?: Long,
391
+ "session_original_request"?: String,
392
+ "session_max_sensitivity"?: String,
393
+
394
+ // Usage Budget (optional)
395
+ "budget_remaining_pct"?: Long,
396
+ "budget_exceeded"?: Boolean,
397
+ "budget_cost_micros_this_turn"?: Long,
398
+ "budget_model"?: String,
399
+ "budget_tokens_pct_session"?: Long,
400
+ "budget_tokens_pct_daily"?: Long,
401
+ "budget_tokens_pct_monthly"?: Long,
402
+ "budget_cost_pct_daily"?: Long,
403
+ "budget_cost_pct_monthly"?: Long,
404
+ "budget_exceeded_session"?: Boolean,
405
+ "budget_exceeded_daily"?: Boolean,
406
+ "budget_exceeded_monthly"?: Boolean,
407
+
408
+ // Aggregated threat summary (optional)
409
+ "highest_severity"?: String,
410
+ "threat_count"?: Long,
411
+ "detected_threats"?: Set<String>,
412
+
413
+ // Agent Identity (optional)
414
+ "agent_id"?: String,
415
+ "agent_type"?: String,
416
+ "agent_trust_level"?: String,
417
+ "agent_framework"?: String,
418
+ "agent_publisher"?: String,
419
+
420
+ // File & Path (optional)
421
+ "path"?: String,
422
+
423
+ };
424
+
425
+ /// Context for read_file action
426
+ type FileReadContext = {
427
+ // Identity (optional)
428
+ "role"?: String,
429
+ "privilege_scope"?: Set<String>,
430
+ "identity_type"?: String,
431
+ "principal"?: String,
432
+ // Core metadata (required)
433
+ "request_id": String,
434
+ "timestamp": Long,
435
+
436
+ // IDE / workspace context (optional)
437
+ "source"?: String,
438
+ "event"?: String,
439
+ "user_email"?: String,
440
+ "cwd"?: String,
441
+ "workspace_root"?: String,
442
+
443
+ // File path (optional)
444
+ "path"?: String,
445
+
446
+ // Security checks on file content (optional)
447
+ "secrets_detected"?: Boolean,
448
+ "secret_count"?: Long,
449
+ "secret_types"?: Set<String>,
450
+ "pii_detected"?: Boolean,
451
+ "pii_types"?: Set<String>,
452
+
453
+ // Security - Path Traversal (optional)
454
+ "path_traversal_detected"?: Boolean,
455
+ "path_traversal_severity"?: String,
456
+ "path_traversal_type"?: String,
457
+
458
+ // Aggregated threat summary (optional)
459
+ "highest_severity"?: String,
460
+ "threat_count"?: Long,
461
+ "detected_threats"?: Set<String>,
462
+
463
+ // Session Detection History (optional)
464
+ "session_pii_detected"?: Boolean,
465
+ "session_pii_types"?: Set<String>,
466
+ "session_secrets_detected"?: Boolean,
467
+ "session_secret_types"?: Set<String>,
468
+ "session_injection_detected"?: Boolean,
469
+ "session_command_injection"?: Boolean,
470
+ "session_threat_turns"?: Long,
471
+ "session_max_injection_score"?: Long,
472
+ "session_max_jailbreak_score"?: Long,
473
+ "session_max_command_injection_score"?: Long,
474
+ "session_max_pii_score"?: Long,
475
+ "session_max_secret_score"?: Long,
476
+ "session_cumulative_risk_score"?: Long,
477
+ "session_original_request"?: String,
478
+ "session_max_sensitivity"?: String,
479
+
480
+ // Usage Budget (optional)
481
+ "budget_remaining_pct"?: Long,
482
+ "budget_exceeded"?: Boolean,
483
+ "budget_cost_micros_this_turn"?: Long,
484
+ "budget_model"?: String,
485
+ "budget_tokens_pct_session"?: Long,
486
+ "budget_tokens_pct_daily"?: Long,
487
+ "budget_tokens_pct_monthly"?: Long,
488
+ "budget_cost_pct_daily"?: Long,
489
+ "budget_cost_pct_monthly"?: Long,
490
+ "budget_exceeded_session"?: Boolean,
491
+ "budget_exceeded_daily"?: Boolean,
492
+ "budget_exceeded_monthly"?: Boolean,
493
+
494
+ // Agent Identity (optional)
495
+ "agent_id"?: String,
496
+ "agent_type"?: String,
497
+ "agent_trust_level"?: String,
498
+ "agent_framework"?: String,
499
+ "agent_publisher"?: String,
500
+
501
+ };
502
+
503
+ /// Context for write_file action
504
+ type FileWriteContext = {
505
+ // Identity (optional)
506
+ "role"?: String,
507
+ "privilege_scope"?: Set<String>,
508
+ "identity_type"?: String,
509
+ "principal"?: String,
510
+ // Core metadata (required)
511
+ "request_id": String,
512
+ "timestamp": Long,
513
+
514
+ // IDE / workspace context (optional)
515
+ "source"?: String,
516
+ "event"?: String,
517
+ "user_email"?: String,
518
+ "cwd"?: String,
519
+ "workspace_root"?: String,
520
+
521
+ // File path (optional)
522
+ "path"?: String,
523
+
524
+ // Security - Invisible Character Detection in write content (optional)
525
+ "invisible_chars_detected"?: Boolean,
526
+ "invisible_chars_score"?: Long,
527
+
528
+ // Security checks on content being written (optional)
529
+ "secrets_detected"?: Boolean,
530
+ "secret_count"?: Long,
531
+ "secret_types"?: Set<String>,
532
+ "pii_detected"?: Boolean,
533
+ "pii_types"?: Set<String>,
534
+
535
+ // Security - Path Traversal (optional)
536
+ "path_traversal_detected"?: Boolean,
537
+ "path_traversal_severity"?: String,
538
+ "path_traversal_type"?: String,
539
+
540
+ // Aggregated threat summary (optional)
541
+ "highest_severity"?: String,
542
+ "threat_count"?: Long,
543
+ "detected_threats"?: Set<String>,
544
+
545
+ // Session Detection History (optional)
546
+ "session_pii_detected"?: Boolean,
547
+ "session_pii_types"?: Set<String>,
548
+ "session_secrets_detected"?: Boolean,
549
+ "session_secret_types"?: Set<String>,
550
+ "session_injection_detected"?: Boolean,
551
+ "session_command_injection"?: Boolean,
552
+ "session_threat_turns"?: Long,
553
+ "session_max_injection_score"?: Long,
554
+ "session_max_jailbreak_score"?: Long,
555
+ "session_max_command_injection_score"?: Long,
556
+ "session_max_pii_score"?: Long,
557
+ "session_max_secret_score"?: Long,
558
+ "session_cumulative_risk_score"?: Long,
559
+ "session_original_request"?: String,
560
+ "session_max_sensitivity"?: String,
561
+
562
+ // Usage Budget (optional)
563
+ "budget_remaining_pct"?: Long,
564
+ "budget_exceeded"?: Boolean,
565
+ "budget_cost_micros_this_turn"?: Long,
566
+ "budget_model"?: String,
567
+ "budget_tokens_pct_session"?: Long,
568
+ "budget_tokens_pct_daily"?: Long,
569
+ "budget_tokens_pct_monthly"?: Long,
570
+ "budget_cost_pct_daily"?: Long,
571
+ "budget_cost_pct_monthly"?: Long,
572
+ "budget_exceeded_session"?: Boolean,
573
+ "budget_exceeded_daily"?: Boolean,
574
+ "budget_exceeded_monthly"?: Boolean,
575
+
576
+ // Agent Identity (optional)
577
+ "agent_id"?: String,
578
+ "agent_type"?: String,
579
+ "agent_trust_level"?: String,
580
+ "agent_framework"?: String,
581
+ "agent_publisher"?: String,
582
+
583
+ };
584
+
585
+ /// Context for connect_server action (MCP server connections)
586
+ type ConnectServerContext = {
587
+ // Identity (optional)
588
+ "role"?: String,
589
+ "privilege_scope"?: Set<String>,
590
+ "identity_type"?: String,
591
+ "principal"?: String,
592
+ // Core metadata (required)
593
+ "request_id": String,
594
+ "timestamp": Long,
595
+
596
+ // IDE / workspace context (optional)
597
+ "source"?: String,
598
+ "event"?: String,
599
+ "user_email"?: String,
600
+ "cwd"?: String,
601
+ "workspace_root"?: String,
602
+
603
+ // MCP context (optional)
604
+ "mcp_server"?: String,
605
+ "mcp_server_verified"?: Boolean,
606
+
607
+ // Agentic - Agent Security (optional)
608
+ "tool_poisoning_detected"?: Boolean,
609
+ "tool_poisoning_score"?: Long,
610
+ "tool_poisoning_type"?: String,
611
+
612
+ // Agentic - MCP Risk (optional)
613
+ "mcp_config_risk"?: Boolean,
614
+ "mcp_risk_type"?: String,
615
+ "mcp_risk_score"?: Long,
616
+
617
+ // Security - Cross-Origin Escalation (optional)
618
+ "cross_origin_detected"?: Boolean,
619
+ "cross_origin_type"?: String,
620
+ "cross_origin_score"?: Long,
621
+
622
+ // Aggregated threat summary (optional)
623
+ "highest_severity"?: String,
624
+ "threat_count"?: Long,
625
+ "detected_threats"?: Set<String>,
626
+
627
+ // Session Detection History (optional)
628
+ "session_pii_detected"?: Boolean,
629
+ "session_pii_types"?: Set<String>,
630
+ "session_secrets_detected"?: Boolean,
631
+ "session_secret_types"?: Set<String>,
632
+ "session_injection_detected"?: Boolean,
633
+ "session_command_injection"?: Boolean,
634
+ "session_threat_turns"?: Long,
635
+ "session_max_injection_score"?: Long,
636
+ "session_max_jailbreak_score"?: Long,
637
+ "session_max_command_injection_score"?: Long,
638
+ "session_max_pii_score"?: Long,
639
+ "session_max_secret_score"?: Long,
640
+ "session_cumulative_risk_score"?: Long,
641
+ "session_original_request"?: String,
642
+ "session_max_sensitivity"?: String,
643
+
644
+ // Usage Budget (optional)
645
+ "budget_remaining_pct"?: Long,
646
+ "budget_exceeded"?: Boolean,
647
+ "budget_cost_micros_this_turn"?: Long,
648
+ "budget_model"?: String,
649
+ "budget_tokens_pct_session"?: Long,
650
+ "budget_tokens_pct_daily"?: Long,
651
+ "budget_tokens_pct_monthly"?: Long,
652
+ "budget_cost_pct_daily"?: Long,
653
+ "budget_cost_pct_monthly"?: Long,
654
+ "budget_exceeded_session"?: Boolean,
655
+ "budget_exceeded_daily"?: Boolean,
656
+ "budget_exceeded_monthly"?: Boolean,
657
+
658
+ // Agent Identity (optional)
659
+ "agent_id"?: String,
660
+ "agent_type"?: String,
661
+ "agent_trust_level"?: String,
662
+ "agent_framework"?: String,
663
+ "agent_publisher"?: String,
664
+
665
+ };
666
+ }
@@ -0,0 +1,21 @@
1
+ // =============================================================================
2
+ // Baseline Permit (Default)
3
+ // =============================================================================
4
+ // Permits all AgentOps actions by default. Threat-specific forbid policies
5
+ // override this when detectors fire. Cedar is default-deny: without at least
6
+ // one permit rule, every request is denied regardless of forbid rules.
7
+ //
8
+ // Category: organization
9
+ // Namespace: AgentOps
10
+ // =============================================================================
11
+
12
+ @id("organization.permit-baseline")
13
+ @name("Permit baseline")
14
+ @description("Permits all AgentOps actions.")
15
+ @severity("low")
16
+ @tags("category:organization,posture:permit-default")
17
+ permit (
18
+ principal,
19
+ action,
20
+ resource
21
+ );