@highflame/policy 2.0.7 → 2.0.9

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 (128) hide show
  1. package/_schemas/overwatch/context.json +163 -1
  2. package/_schemas/overwatch/schema.cedarschema +45 -0
  3. package/dist/actions.gen.d.ts +0 -1
  4. package/dist/actions.gen.js +0 -1
  5. package/dist/annotations.d.ts +0 -1
  6. package/dist/annotations.js +0 -1
  7. package/dist/builder.d.ts +0 -1
  8. package/dist/builder.js +0 -1
  9. package/dist/context.gen.d.ts +0 -1
  10. package/dist/context.gen.js +0 -1
  11. package/dist/engine.d.ts +0 -1
  12. package/dist/engine.js +0 -1
  13. package/dist/entities.gen.d.ts +0 -1
  14. package/dist/entities.gen.js +0 -1
  15. package/dist/entity-metadata-types.gen.d.ts +0 -1
  16. package/dist/entity-metadata-types.gen.js +0 -1
  17. package/dist/errors.d.ts +0 -1
  18. package/dist/errors.js +0 -1
  19. package/dist/index.d.ts +0 -1
  20. package/dist/index.js +0 -1
  21. package/dist/overwatch-context.gen.d.ts +13 -1
  22. package/dist/overwatch-context.gen.js +13 -1
  23. package/dist/overwatch-defaults.gen.d.ts +1 -2
  24. package/dist/overwatch-defaults.gen.js +346 -2
  25. package/dist/overwatch-entities.gen.d.ts +0 -1
  26. package/dist/overwatch-entities.gen.js +0 -1
  27. package/dist/palisade-context.gen.d.ts +0 -1
  28. package/dist/palisade-context.gen.js +0 -1
  29. package/dist/palisade-entities.gen.d.ts +0 -1
  30. package/dist/palisade-entities.gen.js +0 -1
  31. package/dist/parser.d.ts +0 -1
  32. package/dist/parser.js +0 -1
  33. package/dist/schema.gen.d.ts +0 -1
  34. package/dist/schema.gen.js +0 -1
  35. package/dist/schemas.d.ts +0 -1
  36. package/dist/schemas.js +0 -1
  37. package/dist/service-schemas.gen.d.ts +0 -1
  38. package/dist/service-schemas.gen.js +0 -1
  39. package/dist/types.d.ts +0 -1
  40. package/dist/types.js +0 -1
  41. package/package.json +1 -2
  42. package/dist/actions.gen.d.ts.map +0 -1
  43. package/dist/actions.gen.js.map +0 -1
  44. package/dist/annotations.d.ts.map +0 -1
  45. package/dist/annotations.js.map +0 -1
  46. package/dist/builder.d.ts.map +0 -1
  47. package/dist/builder.js.map +0 -1
  48. package/dist/context.gen.d.ts.map +0 -1
  49. package/dist/context.gen.js.map +0 -1
  50. package/dist/engine.d.ts.map +0 -1
  51. package/dist/engine.js.map +0 -1
  52. package/dist/engine.test.d.ts +0 -8
  53. package/dist/engine.test.d.ts.map +0 -1
  54. package/dist/engine.test.js +0 -190
  55. package/dist/engine.test.js.map +0 -1
  56. package/dist/entities.gen.d.ts.map +0 -1
  57. package/dist/entities.gen.js.map +0 -1
  58. package/dist/entity-metadata-types.gen.d.ts.map +0 -1
  59. package/dist/entity-metadata-types.gen.js.map +0 -1
  60. package/dist/errors.d.ts.map +0 -1
  61. package/dist/errors.js.map +0 -1
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/index.js.map +0 -1
  64. package/dist/overwatch-context.gen.d.ts.map +0 -1
  65. package/dist/overwatch-context.gen.js.map +0 -1
  66. package/dist/overwatch-defaults.gen.d.ts.map +0 -1
  67. package/dist/overwatch-defaults.gen.js.map +0 -1
  68. package/dist/overwatch-defaults.test.d.ts +0 -8
  69. package/dist/overwatch-defaults.test.d.ts.map +0 -1
  70. package/dist/overwatch-defaults.test.js +0 -145
  71. package/dist/overwatch-defaults.test.js.map +0 -1
  72. package/dist/overwatch-entities.gen.d.ts.map +0 -1
  73. package/dist/overwatch-entities.gen.js.map +0 -1
  74. package/dist/overwatch-rebac.test.d.ts +0 -25
  75. package/dist/overwatch-rebac.test.d.ts.map +0 -1
  76. package/dist/overwatch-rebac.test.js +0 -301
  77. package/dist/overwatch-rebac.test.js.map +0 -1
  78. package/dist/palisade-context.gen.d.ts.map +0 -1
  79. package/dist/palisade-context.gen.js.map +0 -1
  80. package/dist/palisade-entities.gen.d.ts.map +0 -1
  81. package/dist/palisade-entities.gen.js.map +0 -1
  82. package/dist/parser.d.ts.map +0 -1
  83. package/dist/parser.js.map +0 -1
  84. package/dist/parser.test.d.ts +0 -8
  85. package/dist/parser.test.d.ts.map +0 -1
  86. package/dist/parser.test.js +0 -212
  87. package/dist/parser.test.js.map +0 -1
  88. package/dist/schema.gen.d.ts.map +0 -1
  89. package/dist/schema.gen.js.map +0 -1
  90. package/dist/schemas.d.ts.map +0 -1
  91. package/dist/schemas.js.map +0 -1
  92. package/dist/schemas.test.d.ts +0 -8
  93. package/dist/schemas.test.d.ts.map +0 -1
  94. package/dist/schemas.test.js +0 -375
  95. package/dist/schemas.test.js.map +0 -1
  96. package/dist/service-schemas.gen.d.ts.map +0 -1
  97. package/dist/service-schemas.gen.js.map +0 -1
  98. package/dist/studio-ui.test.d.ts +0 -8
  99. package/dist/studio-ui.test.d.ts.map +0 -1
  100. package/dist/studio-ui.test.js +0 -687
  101. package/dist/studio-ui.test.js.map +0 -1
  102. package/dist/types.d.ts.map +0 -1
  103. package/dist/types.js.map +0 -1
  104. package/src/actions.gen.ts +0 -57
  105. package/src/annotations.ts +0 -243
  106. package/src/builder.ts +0 -799
  107. package/src/context.gen.ts +0 -10
  108. package/src/engine.test.ts +0 -370
  109. package/src/engine.ts +0 -497
  110. package/src/entities.gen.ts +0 -65
  111. package/src/entity-metadata-types.gen.ts +0 -19
  112. package/src/errors.ts +0 -195
  113. package/src/index.ts +0 -62
  114. package/src/overwatch-context.gen.ts +0 -32
  115. package/src/overwatch-defaults.gen.ts +0 -907
  116. package/src/overwatch-defaults.test.ts +0 -176
  117. package/src/overwatch-entities.gen.ts +0 -41
  118. package/src/overwatch-rebac.test.ts +0 -346
  119. package/src/palisade-context.gen.ts +0 -28
  120. package/src/palisade-entities.gen.ts +0 -49
  121. package/src/parser.test.ts +0 -251
  122. package/src/parser.ts +0 -579
  123. package/src/schema.gen.ts +0 -134
  124. package/src/schemas.test.ts +0 -445
  125. package/src/schemas.ts +0 -91
  126. package/src/service-schemas.gen.ts +0 -608
  127. package/src/studio-ui.test.ts +0 -813
  128. package/src/types.ts +0 -66
@@ -1,608 +0,0 @@
1
- // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
- // Source: schemas/overwatch/schema.cedarschema, schemas/palisade/schema.cedarschema
3
- //
4
- // Service-specific Cedar schemas and context metadata.
5
- // Works in both browser and Node.js environments.
6
- //
7
- // Usage:
8
- // import { OVERWATCH_SCHEMA, PALISADE_SCHEMA } from '@highflame/policy/types';
9
- // import { OVERWATCH_CONTEXT, PALISADE_CONTEXT } from '@highflame/policy/types';
10
-
11
- /**
12
- * Overwatch (Guardian) Cedar schema
13
- *
14
- * Full Cedar schema for IDE security, including:
15
- * - Actions: process_prompt, call_tool, connect_server, read_file, write_file
16
- * - Entities: User, Agent, LlmPrompt, Tool, Server, FilePath
17
- * - Context attributes for threat detection and workspace security
18
- */
19
- export const OVERWATCH_SCHEMA = `// Overwatch (Guardian) Cedar Schema
20
- // ===================================
21
- // IDE Security & Policy Enforcement
22
- //
23
- // Overwatch protects IDE operations (prompts, tool calls, file access) by evaluating
24
- // threats detected by YARA and Javelin scanners against Cedar policies.
25
- //
26
- // Architecture:
27
- // User/Agent → IDE Hook → YARA/Javelin → Cedar Policy → Allow/Deny
28
- //
29
- // Supported IDEs:
30
- // - Cursor (beforeSubmitPrompt, beforeShellExecution, beforeMCPExecution, etc.)
31
- // - Claude Code (UserPromptSubmit, PreToolUse)
32
- // - GitHub Copilot (userPromptSubmitted, preToolUse)
33
-
34
- namespace Overwatch {
35
-
36
- // =============================================================================
37
- // ENTITIES
38
- // =============================================================================
39
-
40
- // Human user or service account making requests to the IDE
41
- entity User {
42
- user_type: String, // "external" or "internal"
43
- email: String, // User email (optional)
44
- };
45
-
46
- // AI agent (Claude, GitHub Copilot, etc.)
47
- entity Agent {
48
- agent_type: String, // "claude", "copilot", etc.
49
- };
50
-
51
- // LLM prompt or session
52
- entity LlmPrompt {
53
- prompt_type: String, // "user_prompt", "session"
54
- };
55
-
56
- // MCP tool or native IDE tool
57
- entity Tool {
58
- tool_name: String, // "shell", "read_file", "playwright", etc.
59
- risk_level: String, // "low", "medium", "high"
60
- };
61
-
62
- // MCP server
63
- entity Server {
64
- server_name: String, // "filesystem", "playwright", etc.
65
- };
66
-
67
- // File system path
68
- entity FilePath {
69
- path: String,
70
- is_within_workspace: Bool,
71
- };
72
-
73
- // =============================================================================
74
- // ACTIONS
75
- // =============================================================================
76
-
77
- // User submits a prompt or receives AI response
78
- action process_prompt appliesTo {
79
- principal: [User, Agent],
80
- resource: [LlmPrompt],
81
- context: {
82
- // Event & Source
83
- content: String, // Raw content being scanned
84
- source: String, // IDE source: "cursor", "claudecode", "github_copilot"
85
- event: String, // Hook event name
86
- user_email: String, // User identifier
87
-
88
- // Workspace
89
- cwd: String, // Current working directory
90
- workspace_root: String, // Workspace/repository root
91
-
92
- // Threat Detection
93
- threat_count: Long, // Total threats detected
94
- highest_severity: String, // "critical", "high", "medium", "low"
95
- threat_categories: Set<String>, // Threat category names
96
-
97
- yara_threats: Set<String>, // YARA rule names
98
- max_threat_severity: Long, // Numeric severity (0-4)
99
- contains_secrets: Bool, // Whether secrets detected
100
- prompt_text: String, // Same as content (legacy)
101
- response_content: String, // Response content (if available)
102
- },
103
- };
104
-
105
- // User calls a tool (native IDE tool or MCP tool)
106
- action call_tool appliesTo {
107
- principal: [User, Agent],
108
- resource: [Tool, FilePath],
109
- context: {
110
- // Event & Source
111
- content: String, // Raw content being scanned (e.g., shell command)
112
- source: String, // IDE source
113
- event: String, // Hook event name
114
- user_email: String, // User identifier
115
-
116
- // Tool & MCP
117
- tool_name: String, // Normalized tool name ("shell", "read_file", etc.)
118
- mcp_server: String, // MCP server name
119
- mcp_tool: String, // MCP tool name
120
-
121
- // File & Path
122
- path: String, // File path (if file operation)
123
-
124
- // Workspace
125
- cwd: String,
126
- workspace_root: String,
127
-
128
- // Threat Detection
129
- threat_count: Long,
130
- highest_severity: String,
131
- threat_categories: Set<String>,
132
-
133
- yara_threats: Set<String>,
134
- max_threat_severity: Long,
135
- contains_secrets: Bool,
136
- response_content: String,
137
- },
138
- };
139
-
140
- // Connect to an MCP server
141
- action connect_server appliesTo {
142
- principal: [User, Agent],
143
- resource: [Server],
144
- context: {
145
- content: String,
146
- source: String,
147
- event: String,
148
- user_email: String,
149
- mcp_server: String,
150
- threat_count: Long,
151
- highest_severity: String,
152
- threat_categories: Set<String>,
153
- max_threat_severity: Long,
154
- },
155
- };
156
-
157
- // Read a file from disk
158
- action read_file appliesTo {
159
- principal: [User, Agent],
160
- resource: [FilePath],
161
- context: {
162
- content: String,
163
- source: String,
164
- event: String,
165
- user_email: String,
166
- path: String,
167
- cwd: String,
168
- workspace_root: String,
169
- threat_count: Long,
170
- highest_severity: String,
171
- threat_categories: Set<String>,
172
- max_threat_severity: Long,
173
- contains_secrets: Bool,
174
- },
175
- };
176
-
177
- // Write a file to disk
178
- action write_file appliesTo {
179
- principal: [User, Agent],
180
- resource: [FilePath],
181
- context: {
182
- content: String,
183
- source: String,
184
- event: String,
185
- user_email: String,
186
- path: String,
187
- cwd: String,
188
- workspace_root: String,
189
- threat_count: Long,
190
- highest_severity: String,
191
- threat_categories: Set<String>,
192
- max_threat_severity: Long,
193
- contains_secrets: Bool,
194
- },
195
- };
196
-
197
- }
198
- `;
199
-
200
- /**
201
- * Palisade Cedar schema
202
- *
203
- * Full Cedar schema for ML supply chain security, including:
204
- * - Actions: scan_artifact, validate_integrity, validate_provenance, quarantine_artifact, load_model, deploy_model
205
- * - Entities: Scanner, Artifact, Package
206
- * - Context attributes for ML security findings
207
- */
208
- export const PALISADE_SCHEMA = `// Palisade Cedar Schema
209
- // =====================
210
- // ML Supply Chain Security & Artifact Scanning
211
- //
212
- // Palisade scans ML model artifacts (safetensors, GGUF, pickle, PyTorch) for
213
- // security vulnerabilities and enforces policies based on findings.
214
- //
215
- // Architecture:
216
- // Scanner → Validators (Pickle, SafeTensors, GGUF, etc.) → Cedar Policy → Allow/Deny/Quarantine
217
- //
218
- // Supported Formats:
219
- // - SafeTensors (.safetensors)
220
- // - GGUF (.gguf)
221
- // - Pickle (.pkl, .pickle, .pt)
222
- // - PyTorch (.pth, .pt)
223
- // - ONNX (.onnx)
224
-
225
- namespace Palisade {
226
-
227
- // =============================================================================
228
- // ENTITIES
229
- // =============================================================================
230
-
231
- // Security scanner service
232
- entity Scanner {
233
- scanner_type: String, // "palisade", "redteam", etc.
234
- };
235
-
236
- // ML model artifact
237
- entity Artifact {
238
- artifact_format: String, // "safetensors", "gguf", "pickle", "pytorch", "onnx"
239
- path: String, // File path
240
- signed: Bool, // Whether digitally signed
241
- signer: String, // Who signed (if applicable)
242
- };
243
-
244
- // Software package (npm, PyPI, etc.)
245
- entity Package {
246
- package_name: String,
247
- package_version: String,
248
- };
249
-
250
- // =============================================================================
251
- // ACTIONS
252
- // =============================================================================
253
-
254
- // Scan an ML artifact for security issues
255
- action scan_artifact appliesTo {
256
- principal: [Scanner],
257
- resource: [Artifact],
258
- context: {
259
- // Core Finding & Severity
260
- finding_type: String, // Type of finding (e.g., "backdoor_detected", "safetensors_integrity_violation")
261
- severity: String, // "CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"
262
- environment: String, // "production", "strict_production", "development", "permissive_development", "research"
263
-
264
- // Artifact Metadata
265
- artifact_format: String, // "safetensors", "gguf", "pickle", "pytorch", "onnx"
266
- path: String, // File path to artifact
267
- artifact_signed: Bool, // Whether artifact is digitally signed
268
- provenance_signer: String, // "unknown", "unsigned", or signer name
269
-
270
- // Pickle Security
271
- pickle_exec_path_detected: Bool, // Pickle RCE execution path detected (CRITICAL)
272
-
273
- // Tokenizer Security
274
- tokenizer_added_tokens_count: Long, // Number of added tokens (0-5000+)
275
-
276
- // LoRA Security
277
- adapter_base_digest_mismatch: Bool, // LoRA adapter base model digest mismatch
278
-
279
- // GGUF Security
280
- gguf_suspicious_metadata: Bool, // GGUF metadata contains suspicious patterns
281
-
282
- // SafeTensors Security
283
- safetensors_integrity_violation: Bool, // SafeTensors file integrity violated
284
-
285
- // General Metadata Security
286
- metadata_malicious_pattern: Bool, // Metadata contains malicious patterns
287
-
288
- // CoSAI Maturity
289
- metadata_cosai_level_numeric: Long, // CoSAI maturity level (0-5, higher = more trustworthy)
290
-
291
- // Backdoor Detection
292
- match_count: Long, // Number of behavioral backdoor indicator matches
293
- },
294
- };
295
-
296
- // Validate artifact integrity (checksum, signature)
297
- action validate_integrity appliesTo {
298
- principal: [Scanner],
299
- resource: [Artifact],
300
- context: {
301
- artifact_format: String,
302
- path: String,
303
- artifact_signed: Bool,
304
- provenance_signer: String,
305
- safetensors_integrity_violation: Bool,
306
- finding_type: String,
307
- severity: String,
308
- },
309
- };
310
-
311
- // Validate artifact provenance (signer, origin)
312
- action validate_provenance appliesTo {
313
- principal: [Scanner],
314
- resource: [Artifact],
315
- context: {
316
- artifact_format: String,
317
- path: String,
318
- artifact_signed: Bool,
319
- provenance_signer: String,
320
- metadata_cosai_level_numeric: Long,
321
- finding_type: String,
322
- severity: String,
323
- },
324
- };
325
-
326
- // Quarantine a malicious artifact
327
- action quarantine_artifact appliesTo {
328
- principal: [Scanner],
329
- resource: [Artifact],
330
- context: {
331
- finding_type: String,
332
- severity: String,
333
- environment: String,
334
- artifact_format: String,
335
- path: String,
336
- },
337
- };
338
-
339
- // Load an ML model into memory
340
- action load_model appliesTo {
341
- principal: [Scanner],
342
- resource: [Artifact],
343
- context: {
344
- artifact_format: String,
345
- environment: String,
346
- artifact_signed: Bool,
347
- severity: String,
348
- },
349
- };
350
-
351
- // Deploy an ML model to production
352
- action deploy_model appliesTo {
353
- principal: [Scanner],
354
- resource: [Artifact],
355
- context: {
356
- artifact_format: String,
357
- environment: String,
358
- artifact_signed: Bool,
359
- provenance_signer: String,
360
- severity: String,
361
- },
362
- };
363
-
364
- // Scan a software package
365
- action scan_package appliesTo {
366
- principal: [Scanner],
367
- resource: [Package],
368
- context: {
369
- finding_type: String,
370
- severity: String,
371
- environment: String,
372
- },
373
- };
374
-
375
- }
376
- `;
377
-
378
- /**
379
- * Context attribute metadata for Overwatch actions.
380
- * Used by PolicyBuilder UI to generate form fields.
381
- */
382
- export interface ContextAttribute {
383
- key: string;
384
- type: 'string' | 'number' | 'boolean' | 'array';
385
- required: boolean;
386
- description: string;
387
- }
388
-
389
- export interface ActionContext {
390
- name: string;
391
- description: string;
392
- context_attributes: ContextAttribute[];
393
- }
394
-
395
- export interface ServiceContext {
396
- service: string;
397
- version: string;
398
- description: string;
399
- actions: ActionContext[];
400
- }
401
-
402
- /**
403
- * Overwatch context metadata (parsed JSON)
404
- */
405
- export const OVERWATCH_CONTEXT: ServiceContext = {
406
- "service": "overwatch",
407
- "version": "1.0.0",
408
- "description": "Overwatch (Guardian) IDE security & policy enforcement",
409
- "actions": [
410
- {
411
- "name": "process_prompt",
412
- "description": "User submits a prompt or receives AI response",
413
- "context_attributes": [
414
- { "key": "content", "type": "string", "required": true, "description": "Raw content being scanned (prompt, command, etc.)" },
415
- { "key": "source", "type": "string", "required": true, "description": "IDE source: cursor, claudecode, github_copilot" },
416
- { "key": "event", "type": "string", "required": true, "description": "Hook event name (e.g., beforeSubmitPrompt, UserPromptSubmit)" },
417
- { "key": "user_email", "type": "string", "required": true, "description": "User identifier (OAuth verified or fallback)" },
418
- { "key": "cwd", "type": "string", "required": false, "description": "Current working directory" },
419
- { "key": "workspace_root", "type": "string", "required": false, "description": "Workspace/repository root path" },
420
- { "key": "threat_count", "type": "number", "required": true, "description": "Total number of threats detected by YARA/Javelin" },
421
- { "key": "highest_severity", "type": "string", "required": true, "description": "Highest severity level: critical, high, medium, low" },
422
- { "key": "threat_categories", "type": "array", "required": true, "description": "Threat category names from aggregator" },
423
-
424
- { "key": "yara_threats", "type": "array", "required": true, "description": "YARA rule names that matched" },
425
- { "key": "max_threat_severity", "type": "number", "required": true, "description": "Numeric severity (0-4, where 4=CRITICAL)" },
426
- { "key": "contains_secrets", "type": "boolean", "required": true, "description": "Whether secrets or credentials were detected" },
427
- { "key": "prompt_text", "type": "string", "required": false, "description": "Same as content (legacy field)" },
428
- { "key": "response_content", "type": "string", "required": false, "description": "Response content from AI (if available)" }
429
- ]
430
- },
431
- {
432
- "name": "call_tool",
433
- "description": "User calls a tool (native IDE tool or MCP tool)",
434
- "context_attributes": [
435
- { "key": "content", "type": "string", "required": true, "description": "Raw content being scanned (e.g., shell command)" },
436
- { "key": "source", "type": "string", "required": true, "description": "IDE source: cursor, claudecode, github_copilot" },
437
- { "key": "event", "type": "string", "required": true, "description": "Hook event name (e.g., beforeShellExecution, PreToolUse)" },
438
- { "key": "user_email", "type": "string", "required": true, "description": "User identifier" },
439
- { "key": "tool_name", "type": "string", "required": false, "description": "Normalized tool name: shell, read_file, write_file, edit_file, etc." },
440
- { "key": "mcp_server", "type": "string", "required": false, "description": "MCP server name (e.g., filesystem, playwright)" },
441
- { "key": "mcp_tool", "type": "string", "required": false, "description": "MCP tool name (e.g., list_directory, navigate)" },
442
- { "key": "path", "type": "string", "required": false, "description": "File path (if file operation)" },
443
- { "key": "cwd", "type": "string", "required": false, "description": "Current working directory" },
444
- { "key": "workspace_root", "type": "string", "required": false, "description": "Workspace/repository root path" },
445
- { "key": "threat_count", "type": "number", "required": true, "description": "Total threats detected" },
446
- { "key": "highest_severity", "type": "string", "required": true, "description": "Highest severity: critical, high, medium, low" },
447
- { "key": "threat_categories", "type": "array", "required": true, "description": "Threat category names" },
448
-
449
- { "key": "yara_threats", "type": "array", "required": true, "description": "YARA rule names" },
450
- { "key": "max_threat_severity", "type": "number", "required": true, "description": "Numeric severity (0-4)" },
451
- { "key": "contains_secrets", "type": "boolean", "required": true, "description": "Whether secrets detected" },
452
- { "key": "response_content", "type": "string", "required": false, "description": "Response content (if available)" }
453
- ]
454
- },
455
- {
456
- "name": "connect_server",
457
- "description": "Connect to an MCP server",
458
- "context_attributes": [
459
- { "key": "content", "type": "string", "required": true, "description": "Raw content being scanned" },
460
- { "key": "source", "type": "string", "required": true, "description": "IDE source" },
461
- { "key": "event", "type": "string", "required": true, "description": "Hook event name" },
462
- { "key": "user_email", "type": "string", "required": true, "description": "User identifier" },
463
- { "key": "mcp_server", "type": "string", "required": false, "description": "MCP server name" },
464
- { "key": "threat_count", "type": "number", "required": true, "description": "Total threats detected" },
465
- { "key": "highest_severity", "type": "string", "required": true, "description": "Highest severity level" },
466
- { "key": "threat_categories", "type": "array", "required": true, "description": "Threat category names" },
467
- { "key": "max_threat_severity", "type": "number", "required": true, "description": "Numeric severity (0-4)" }
468
- ]
469
- },
470
- {
471
- "name": "read_file",
472
- "description": "Read a file from disk",
473
- "context_attributes": [
474
- { "key": "content", "type": "string", "required": true, "description": "File content or operation details" },
475
- { "key": "source", "type": "string", "required": true, "description": "IDE source" },
476
- { "key": "event", "type": "string", "required": true, "description": "Hook event name (e.g., beforeReadFile)" },
477
- { "key": "user_email", "type": "string", "required": true, "description": "User identifier" },
478
- { "key": "path", "type": "string", "required": false, "description": "File path being read" },
479
- { "key": "file_path", "type": "string", "required": false, "description": "Duplicate of path field" },
480
- { "key": "cwd", "type": "string", "required": false, "description": "Current working directory" },
481
- { "key": "workspace_root", "type": "string", "required": false, "description": "Workspace root path" },
482
- { "key": "threat_count", "type": "number", "required": true, "description": "Total threats detected" },
483
- { "key": "highest_severity", "type": "string", "required": true, "description": "Highest severity level" },
484
- { "key": "threat_categories", "type": "array", "required": true, "description": "Threat categories" },
485
- { "key": "max_threat_severity", "type": "number", "required": true, "description": "Numeric severity (0-4)" },
486
- { "key": "contains_secrets", "type": "boolean", "required": true, "description": "Whether secrets detected" }
487
- ]
488
- },
489
- {
490
- "name": "write_file",
491
- "description": "Write a file to disk",
492
- "context_attributes": [
493
- { "key": "content", "type": "string", "required": true, "description": "File content being written" },
494
- { "key": "source", "type": "string", "required": true, "description": "IDE source" },
495
- { "key": "event", "type": "string", "required": true, "description": "Hook event name" },
496
- { "key": "user_email", "type": "string", "required": true, "description": "User identifier" },
497
- { "key": "path", "type": "string", "required": false, "description": "File path being written" },
498
- { "key": "file_path", "type": "string", "required": false, "description": "Duplicate of path field" },
499
- { "key": "cwd", "type": "string", "required": false, "description": "Current working directory" },
500
- { "key": "workspace_root", "type": "string", "required": false, "description": "Workspace root path" },
501
- { "key": "threat_count", "type": "number", "required": true, "description": "Total threats detected" },
502
- { "key": "highest_severity", "type": "string", "required": true, "description": "Highest severity level" },
503
- { "key": "threat_categories", "type": "array", "required": true, "description": "Threat categories" },
504
- { "key": "max_threat_severity", "type": "number", "required": true, "description": "Numeric severity (0-4)" },
505
- { "key": "contains_secrets", "type": "boolean", "required": true, "description": "Whether secrets detected" }
506
- ]
507
- }
508
- ]
509
- };
510
-
511
- /**
512
- * Palisade context metadata (parsed JSON)
513
- */
514
- export const PALISADE_CONTEXT: ServiceContext = {
515
- "service": "palisade",
516
- "version": "1.0.0",
517
- "description": "Palisade ML supply chain security & artifact scanning",
518
- "actions": [
519
- {
520
- "name": "scan_artifact",
521
- "description": "Scan an ML artifact for security issues",
522
- "context_attributes": [
523
- { "key": "finding_type", "type": "string", "required": true, "description": "Type of security finding (e.g., backdoor_detected, safetensors_integrity_violation)" },
524
- { "key": "severity", "type": "string", "required": true, "description": "Severity level: CRITICAL, HIGH, MEDIUM, LOW, INFO" },
525
- { "key": "environment", "type": "string", "required": true, "description": "Deployment environment: production, strict_production, development, permissive_development, research" },
526
- { "key": "artifact_format", "type": "string", "required": true, "description": "Model format: safetensors, gguf, pickle, pytorch, onnx" },
527
- { "key": "path", "type": "string", "required": true, "description": "File path to the ML artifact" },
528
- { "key": "artifact_signed", "type": "boolean", "required": true, "description": "Whether the artifact is digitally signed" },
529
- { "key": "provenance_signer", "type": "string", "required": true, "description": "Who signed the artifact: unknown, unsigned, or signer name" },
530
- { "key": "pickle_exec_path_detected", "type": "boolean", "required": false, "description": "Pickle RCE execution path detected (CRITICAL security issue)" },
531
- { "key": "tokenizer_added_tokens_count", "type": "number", "required": false, "description": "Number of added tokens in tokenizer (0-5000+, high count suspicious)" },
532
- { "key": "adapter_base_digest_mismatch", "type": "boolean", "required": false, "description": "LoRA adapter base model digest mismatch (integrity issue)" },
533
- { "key": "gguf_suspicious_metadata", "type": "boolean", "required": false, "description": "GGUF metadata contains suspicious patterns" },
534
- { "key": "safetensors_integrity_violation", "type": "boolean", "required": false, "description": "SafeTensors file integrity violated or corrupted" },
535
- { "key": "metadata_malicious_pattern", "type": "boolean", "required": false, "description": "Metadata contains malicious patterns" },
536
- { "key": "metadata_cosai_level_numeric", "type": "number", "required": false, "description": "CoSAI maturity level (0-5, where higher = more trustworthy)" },
537
- { "key": "match_count", "type": "number", "required": false, "description": "Number of behavioral backdoor indicator matches (for confidence scoring)" }
538
- ]
539
- },
540
- {
541
- "name": "validate_integrity",
542
- "description": "Validate artifact integrity (checksum, signature)",
543
- "context_attributes": [
544
- { "key": "artifact_format", "type": "string", "required": true, "description": "Model format" },
545
- { "key": "path", "type": "string", "required": true, "description": "File path" },
546
- { "key": "artifact_signed", "type": "boolean", "required": true, "description": "Whether digitally signed" },
547
- { "key": "provenance_signer", "type": "string", "required": true, "description": "Signer name" },
548
- { "key": "safetensors_integrity_violation", "type": "boolean", "required": false, "description": "SafeTensors integrity check result" },
549
- { "key": "finding_type", "type": "string", "required": false, "description": "Type of integrity finding" },
550
- { "key": "severity", "type": "string", "required": false, "description": "Severity of integrity issue" }
551
- ]
552
- },
553
- {
554
- "name": "validate_provenance",
555
- "description": "Validate artifact provenance (signer, origin)",
556
- "context_attributes": [
557
- { "key": "artifact_format", "type": "string", "required": true, "description": "Model format" },
558
- { "key": "path", "type": "string", "required": true, "description": "File path" },
559
- { "key": "artifact_signed", "type": "boolean", "required": true, "description": "Whether signed" },
560
- { "key": "provenance_signer", "type": "string", "required": true, "description": "Signer identity" },
561
- { "key": "metadata_cosai_level_numeric", "type": "number", "required": false, "description": "CoSAI maturity level" },
562
- { "key": "finding_type", "type": "string", "required": false, "description": "Type of provenance finding" },
563
- { "key": "severity", "type": "string", "required": false, "description": "Severity level" }
564
- ]
565
- },
566
- {
567
- "name": "quarantine_artifact",
568
- "description": "Quarantine a malicious artifact",
569
- "context_attributes": [
570
- { "key": "finding_type", "type": "string", "required": true, "description": "Type of security finding" },
571
- { "key": "severity", "type": "string", "required": true, "description": "Severity level" },
572
- { "key": "environment", "type": "string", "required": true, "description": "Deployment environment" },
573
- { "key": "artifact_format", "type": "string", "required": true, "description": "Model format" },
574
- { "key": "path", "type": "string", "required": true, "description": "File path" }
575
- ]
576
- },
577
- {
578
- "name": "load_model",
579
- "description": "Load an ML model into memory",
580
- "context_attributes": [
581
- { "key": "artifact_format", "type": "string", "required": true, "description": "Model format" },
582
- { "key": "environment", "type": "string", "required": true, "description": "Deployment environment" },
583
- { "key": "artifact_signed", "type": "boolean", "required": true, "description": "Whether signed" },
584
- { "key": "severity", "type": "string", "required": false, "description": "Severity of any findings" }
585
- ]
586
- },
587
- {
588
- "name": "deploy_model",
589
- "description": "Deploy an ML model to production",
590
- "context_attributes": [
591
- { "key": "artifact_format", "type": "string", "required": true, "description": "Model format" },
592
- { "key": "environment", "type": "string", "required": true, "description": "Deployment environment" },
593
- { "key": "artifact_signed", "type": "boolean", "required": true, "description": "Whether signed" },
594
- { "key": "provenance_signer", "type": "string", "required": true, "description": "Signer identity" },
595
- { "key": "severity", "type": "string", "required": false, "description": "Severity of any findings" }
596
- ]
597
- },
598
- {
599
- "name": "scan_package",
600
- "description": "Scan a software package",
601
- "context_attributes": [
602
- { "key": "finding_type", "type": "string", "required": false, "description": "Type of finding" },
603
- { "key": "severity", "type": "string", "required": false, "description": "Severity level" },
604
- { "key": "environment", "type": "string", "required": true, "description": "Deployment environment" }
605
- ]
606
- }
607
- ]
608
- };