@highflame/policy 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +219 -0
- package/_schemas/overwatch/context.json +463 -0
- package/_schemas/overwatch/schema.cedarschema +184 -0
- package/_schemas/palisade/context.json +325 -0
- package/_schemas/palisade/schema.cedarschema +168 -0
- package/dist/builder.d.ts +1 -2
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js.map +1 -1
- package/dist/context.gen.d.ts +1 -94
- package/dist/context.gen.d.ts.map +1 -1
- package/dist/context.gen.js +1 -97
- package/dist/context.gen.js.map +1 -1
- package/dist/engine.d.ts +18 -18
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +44 -28
- package/dist/engine.js.map +1 -1
- package/dist/engine.test.js.map +1 -1
- package/dist/entities.gen.d.ts +1 -0
- package/dist/entities.gen.d.ts.map +1 -1
- package/dist/entities.gen.js +1 -0
- package/dist/entities.gen.js.map +1 -1
- package/dist/overwatch-context.gen.d.ts +31 -0
- package/dist/overwatch-context.gen.d.ts.map +1 -0
- package/dist/overwatch-context.gen.js +32 -0
- package/dist/overwatch-context.gen.js.map +1 -0
- package/dist/palisade-context.gen.d.ts +25 -0
- package/dist/palisade-context.gen.d.ts.map +1 -0
- package/dist/palisade-context.gen.js +26 -0
- package/dist/palisade-context.gen.js.map +1 -0
- package/dist/schema.gen.d.ts +1 -1
- package/dist/schema.gen.d.ts.map +1 -1
- package/dist/schema.gen.js +60 -541
- package/dist/schema.gen.js.map +1 -1
- package/dist/schemas.d.ts +64 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +70 -0
- package/dist/schemas.js.map +1 -0
- package/dist/schemas.test.d.ts +8 -0
- package/dist/schemas.test.d.ts.map +1 -0
- package/dist/schemas.test.js +381 -0
- package/dist/schemas.test.js.map +1 -0
- package/package.json +9 -6
- package/src/builder.ts +1 -2
- package/src/context.gen.ts +0 -97
- package/src/engine.test.ts +0 -1
- package/src/engine.ts +62 -33
- package/src/entities.gen.ts +1 -0
- package/src/overwatch-context.gen.ts +34 -0
- package/src/palisade-context.gen.ts +28 -0
- package/src/schema.gen.ts +60 -541
- package/src/schemas.test.ts +449 -0
- package/src/schemas.ts +91 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// Overwatch (Guardian) Cedar Schema
|
|
2
|
+
// ===================================
|
|
3
|
+
// IDE Security & Policy Enforcement
|
|
4
|
+
//
|
|
5
|
+
// Overwatch protects IDE operations (prompts, tool calls, file access) by evaluating
|
|
6
|
+
// threats detected by YARA and Javelin scanners against Cedar policies.
|
|
7
|
+
//
|
|
8
|
+
// Architecture:
|
|
9
|
+
// User/Agent → IDE Hook → YARA/Javelin → Cedar Policy → Allow/Deny
|
|
10
|
+
//
|
|
11
|
+
// Supported IDEs:
|
|
12
|
+
// - Cursor (beforeSubmitPrompt, beforeShellExecution, beforeMCPExecution, etc.)
|
|
13
|
+
// - Claude Code (UserPromptSubmit, PreToolUse)
|
|
14
|
+
// - GitHub Copilot (userPromptSubmitted, preToolUse)
|
|
15
|
+
|
|
16
|
+
namespace Overwatch {
|
|
17
|
+
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// ENTITIES
|
|
20
|
+
// =============================================================================
|
|
21
|
+
|
|
22
|
+
// Human user or service account making requests to the IDE
|
|
23
|
+
entity User {
|
|
24
|
+
user_type: String, // "external" or "internal"
|
|
25
|
+
email: String, // User email (optional)
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// AI agent (Claude, GitHub Copilot, etc.)
|
|
29
|
+
entity Agent {
|
|
30
|
+
agent_type: String, // "claude", "copilot", etc.
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// LLM prompt or session
|
|
34
|
+
entity LlmPrompt {
|
|
35
|
+
prompt_type: String, // "user_prompt", "session"
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// MCP tool or native IDE tool
|
|
39
|
+
entity Tool {
|
|
40
|
+
tool_name: String, // "shell", "read_file", "playwright", etc.
|
|
41
|
+
risk_level: String, // "low", "medium", "high"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// MCP server
|
|
45
|
+
entity Server {
|
|
46
|
+
server_name: String, // "filesystem", "playwright", etc.
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// File system path
|
|
50
|
+
entity FilePath {
|
|
51
|
+
path: String,
|
|
52
|
+
is_within_workspace: Bool,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// =============================================================================
|
|
56
|
+
// ACTIONS
|
|
57
|
+
// =============================================================================
|
|
58
|
+
|
|
59
|
+
// User submits a prompt or receives AI response
|
|
60
|
+
action process_prompt appliesTo {
|
|
61
|
+
principal: [User, Agent],
|
|
62
|
+
resource: [LlmPrompt],
|
|
63
|
+
context: {
|
|
64
|
+
// Event & Source
|
|
65
|
+
content: String, // Raw content being scanned
|
|
66
|
+
source: String, // IDE source: "cursor", "claudecode", "github_copilot"
|
|
67
|
+
event: String, // Hook event name
|
|
68
|
+
user_email: String, // User identifier
|
|
69
|
+
|
|
70
|
+
// Workspace
|
|
71
|
+
cwd: String, // Current working directory
|
|
72
|
+
workspace_root: String, // Workspace/repository root
|
|
73
|
+
|
|
74
|
+
// Threat Detection
|
|
75
|
+
threat_count: Long, // Total threats detected
|
|
76
|
+
highest_severity: String, // "critical", "high", "medium", "low"
|
|
77
|
+
threat_categories: Set<String>, // Threat category names
|
|
78
|
+
threat_types: Set<String>, // YARA threat categories
|
|
79
|
+
yara_threats: Set<String>, // YARA rule names
|
|
80
|
+
max_threat_severity: Long, // Numeric severity (0-4)
|
|
81
|
+
contains_secrets: Bool, // Whether secrets detected
|
|
82
|
+
prompt_text: String, // Same as content (legacy)
|
|
83
|
+
response_content: String, // Response content (if available)
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// User calls a tool (native IDE tool or MCP tool)
|
|
88
|
+
action call_tool appliesTo {
|
|
89
|
+
principal: [User, Agent],
|
|
90
|
+
resource: [Tool, FilePath],
|
|
91
|
+
context: {
|
|
92
|
+
// Event & Source
|
|
93
|
+
content: String, // Raw content being scanned (e.g., shell command)
|
|
94
|
+
source: String, // IDE source
|
|
95
|
+
event: String, // Hook event name
|
|
96
|
+
user_email: String, // User identifier
|
|
97
|
+
|
|
98
|
+
// Tool & MCP
|
|
99
|
+
tool_name: String, // Normalized tool name ("shell", "read_file", etc.)
|
|
100
|
+
mcp_server: String, // MCP server name
|
|
101
|
+
mcp_tool: String, // MCP tool name
|
|
102
|
+
server_name: String, // Alias for mcp_server
|
|
103
|
+
|
|
104
|
+
// File & Path
|
|
105
|
+
path: String, // File path (if file operation)
|
|
106
|
+
file_path: String, // Duplicate of path field
|
|
107
|
+
|
|
108
|
+
// Workspace
|
|
109
|
+
cwd: String,
|
|
110
|
+
workspace_root: String,
|
|
111
|
+
|
|
112
|
+
// Threat Detection
|
|
113
|
+
threat_count: Long,
|
|
114
|
+
highest_severity: String,
|
|
115
|
+
threat_categories: Set<String>,
|
|
116
|
+
threat_types: Set<String>,
|
|
117
|
+
yara_threats: Set<String>,
|
|
118
|
+
max_threat_severity: Long,
|
|
119
|
+
contains_secrets: Bool,
|
|
120
|
+
response_content: String,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Connect to an MCP server
|
|
125
|
+
action connect_server appliesTo {
|
|
126
|
+
principal: [User, Agent],
|
|
127
|
+
resource: [Server],
|
|
128
|
+
context: {
|
|
129
|
+
content: String,
|
|
130
|
+
source: String,
|
|
131
|
+
event: String,
|
|
132
|
+
user_email: String,
|
|
133
|
+
mcp_server: String,
|
|
134
|
+
server_name: String,
|
|
135
|
+
threat_count: Long,
|
|
136
|
+
highest_severity: String,
|
|
137
|
+
threat_categories: Set<String>,
|
|
138
|
+
max_threat_severity: Long,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Read a file from disk
|
|
143
|
+
action read_file appliesTo {
|
|
144
|
+
principal: [User, Agent],
|
|
145
|
+
resource: [FilePath],
|
|
146
|
+
context: {
|
|
147
|
+
content: String,
|
|
148
|
+
source: String,
|
|
149
|
+
event: String,
|
|
150
|
+
user_email: String,
|
|
151
|
+
path: String,
|
|
152
|
+
file_path: String,
|
|
153
|
+
cwd: String,
|
|
154
|
+
workspace_root: String,
|
|
155
|
+
threat_count: Long,
|
|
156
|
+
highest_severity: String,
|
|
157
|
+
threat_categories: Set<String>,
|
|
158
|
+
max_threat_severity: Long,
|
|
159
|
+
contains_secrets: Bool,
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Write a file to disk
|
|
164
|
+
action write_file appliesTo {
|
|
165
|
+
principal: [User, Agent],
|
|
166
|
+
resource: [FilePath],
|
|
167
|
+
context: {
|
|
168
|
+
content: String,
|
|
169
|
+
source: String,
|
|
170
|
+
event: String,
|
|
171
|
+
user_email: String,
|
|
172
|
+
path: String,
|
|
173
|
+
file_path: String,
|
|
174
|
+
cwd: String,
|
|
175
|
+
workspace_root: String,
|
|
176
|
+
threat_count: Long,
|
|
177
|
+
highest_severity: String,
|
|
178
|
+
threat_categories: Set<String>,
|
|
179
|
+
max_threat_severity: Long,
|
|
180
|
+
contains_secrets: Bool,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
{
|
|
2
|
+
"service": "palisade",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Palisade ML supply chain security & artifact scanning",
|
|
5
|
+
"actions": [
|
|
6
|
+
{
|
|
7
|
+
"name": "scan_artifact",
|
|
8
|
+
"description": "Scan an ML artifact for security issues",
|
|
9
|
+
"context_attributes": [
|
|
10
|
+
{
|
|
11
|
+
"key": "finding_type",
|
|
12
|
+
"type": "string",
|
|
13
|
+
"required": true,
|
|
14
|
+
"description": "Type of security finding (e.g., backdoor_detected, safetensors_integrity_violation)"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"key": "severity",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"required": true,
|
|
20
|
+
"description": "Severity level: CRITICAL, HIGH, MEDIUM, LOW, INFO"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"key": "environment",
|
|
24
|
+
"type": "string",
|
|
25
|
+
"required": true,
|
|
26
|
+
"description": "Deployment environment: production, strict_production, development, permissive_development, research"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"key": "artifact_format",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"required": true,
|
|
32
|
+
"description": "Model format: safetensors, gguf, pickle, pytorch, onnx"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"key": "path",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"required": true,
|
|
38
|
+
"description": "File path to the ML artifact"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"key": "artifact_signed",
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"required": true,
|
|
44
|
+
"description": "Whether the artifact is digitally signed"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"key": "provenance_signer",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"required": true,
|
|
50
|
+
"description": "Who signed the artifact: unknown, unsigned, or signer name"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"key": "pickle_exec_path_detected",
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"required": false,
|
|
56
|
+
"description": "Pickle RCE execution path detected (CRITICAL security issue)"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"key": "tokenizer_added_tokens_count",
|
|
60
|
+
"type": "number",
|
|
61
|
+
"required": false,
|
|
62
|
+
"description": "Number of added tokens in tokenizer (0-5000+, high count suspicious)"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"key": "adapter_base_digest_mismatch",
|
|
66
|
+
"type": "boolean",
|
|
67
|
+
"required": false,
|
|
68
|
+
"description": "LoRA adapter base model digest mismatch (integrity issue)"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"key": "gguf_suspicious_metadata",
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"required": false,
|
|
74
|
+
"description": "GGUF metadata contains suspicious patterns"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"key": "safetensors_integrity_violation",
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"required": false,
|
|
80
|
+
"description": "SafeTensors file integrity violated or corrupted"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"key": "metadata_malicious_pattern",
|
|
84
|
+
"type": "boolean",
|
|
85
|
+
"required": false,
|
|
86
|
+
"description": "Metadata contains malicious patterns"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"key": "metadata_cosai_level_numeric",
|
|
90
|
+
"type": "number",
|
|
91
|
+
"required": false,
|
|
92
|
+
"description": "CoSAI maturity level (0-5, where higher = more trustworthy)"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"key": "match_count",
|
|
96
|
+
"type": "number",
|
|
97
|
+
"required": false,
|
|
98
|
+
"description": "Number of behavioral backdoor indicator matches (for confidence scoring)"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "validate_integrity",
|
|
104
|
+
"description": "Validate artifact integrity (checksum, signature)",
|
|
105
|
+
"context_attributes": [
|
|
106
|
+
{
|
|
107
|
+
"key": "artifact_format",
|
|
108
|
+
"type": "string",
|
|
109
|
+
"required": true,
|
|
110
|
+
"description": "Model format"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"key": "path",
|
|
114
|
+
"type": "string",
|
|
115
|
+
"required": true,
|
|
116
|
+
"description": "File path"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"key": "artifact_signed",
|
|
120
|
+
"type": "boolean",
|
|
121
|
+
"required": true,
|
|
122
|
+
"description": "Whether digitally signed"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"key": "provenance_signer",
|
|
126
|
+
"type": "string",
|
|
127
|
+
"required": true,
|
|
128
|
+
"description": "Signer name"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"key": "safetensors_integrity_violation",
|
|
132
|
+
"type": "boolean",
|
|
133
|
+
"required": false,
|
|
134
|
+
"description": "SafeTensors integrity check result"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"key": "finding_type",
|
|
138
|
+
"type": "string",
|
|
139
|
+
"required": false,
|
|
140
|
+
"description": "Type of integrity finding"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"key": "severity",
|
|
144
|
+
"type": "string",
|
|
145
|
+
"required": false,
|
|
146
|
+
"description": "Severity of integrity issue"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "validate_provenance",
|
|
152
|
+
"description": "Validate artifact provenance (signer, origin)",
|
|
153
|
+
"context_attributes": [
|
|
154
|
+
{
|
|
155
|
+
"key": "artifact_format",
|
|
156
|
+
"type": "string",
|
|
157
|
+
"required": true,
|
|
158
|
+
"description": "Model format"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"key": "path",
|
|
162
|
+
"type": "string",
|
|
163
|
+
"required": true,
|
|
164
|
+
"description": "File path"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"key": "artifact_signed",
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"required": true,
|
|
170
|
+
"description": "Whether signed"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"key": "provenance_signer",
|
|
174
|
+
"type": "string",
|
|
175
|
+
"required": true,
|
|
176
|
+
"description": "Signer identity"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"key": "metadata_cosai_level_numeric",
|
|
180
|
+
"type": "number",
|
|
181
|
+
"required": false,
|
|
182
|
+
"description": "CoSAI maturity level"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"key": "finding_type",
|
|
186
|
+
"type": "string",
|
|
187
|
+
"required": false,
|
|
188
|
+
"description": "Type of provenance finding"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"key": "severity",
|
|
192
|
+
"type": "string",
|
|
193
|
+
"required": false,
|
|
194
|
+
"description": "Severity level"
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "quarantine_artifact",
|
|
200
|
+
"description": "Quarantine a malicious artifact",
|
|
201
|
+
"context_attributes": [
|
|
202
|
+
{
|
|
203
|
+
"key": "finding_type",
|
|
204
|
+
"type": "string",
|
|
205
|
+
"required": true,
|
|
206
|
+
"description": "Type of security finding"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"key": "severity",
|
|
210
|
+
"type": "string",
|
|
211
|
+
"required": true,
|
|
212
|
+
"description": "Severity level"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"key": "environment",
|
|
216
|
+
"type": "string",
|
|
217
|
+
"required": true,
|
|
218
|
+
"description": "Deployment environment"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"key": "artifact_format",
|
|
222
|
+
"type": "string",
|
|
223
|
+
"required": true,
|
|
224
|
+
"description": "Model format"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"key": "path",
|
|
228
|
+
"type": "string",
|
|
229
|
+
"required": true,
|
|
230
|
+
"description": "File path"
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "load_model",
|
|
236
|
+
"description": "Load an ML model into memory",
|
|
237
|
+
"context_attributes": [
|
|
238
|
+
{
|
|
239
|
+
"key": "artifact_format",
|
|
240
|
+
"type": "string",
|
|
241
|
+
"required": true,
|
|
242
|
+
"description": "Model format"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"key": "environment",
|
|
246
|
+
"type": "string",
|
|
247
|
+
"required": true,
|
|
248
|
+
"description": "Deployment environment"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"key": "artifact_signed",
|
|
252
|
+
"type": "boolean",
|
|
253
|
+
"required": true,
|
|
254
|
+
"description": "Whether signed"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"key": "severity",
|
|
258
|
+
"type": "string",
|
|
259
|
+
"required": false,
|
|
260
|
+
"description": "Severity of any findings"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "deploy_model",
|
|
266
|
+
"description": "Deploy an ML model to production",
|
|
267
|
+
"context_attributes": [
|
|
268
|
+
{
|
|
269
|
+
"key": "artifact_format",
|
|
270
|
+
"type": "string",
|
|
271
|
+
"required": true,
|
|
272
|
+
"description": "Model format"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"key": "environment",
|
|
276
|
+
"type": "string",
|
|
277
|
+
"required": true,
|
|
278
|
+
"description": "Deployment environment"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"key": "artifact_signed",
|
|
282
|
+
"type": "boolean",
|
|
283
|
+
"required": true,
|
|
284
|
+
"description": "Whether signed"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"key": "provenance_signer",
|
|
288
|
+
"type": "string",
|
|
289
|
+
"required": true,
|
|
290
|
+
"description": "Signer identity"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"key": "severity",
|
|
294
|
+
"type": "string",
|
|
295
|
+
"required": false,
|
|
296
|
+
"description": "Severity of any findings"
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"name": "scan_package",
|
|
302
|
+
"description": "Scan a software package",
|
|
303
|
+
"context_attributes": [
|
|
304
|
+
{
|
|
305
|
+
"key": "finding_type",
|
|
306
|
+
"type": "string",
|
|
307
|
+
"required": false,
|
|
308
|
+
"description": "Type of finding"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"key": "severity",
|
|
312
|
+
"type": "string",
|
|
313
|
+
"required": false,
|
|
314
|
+
"description": "Severity level"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"key": "environment",
|
|
318
|
+
"type": "string",
|
|
319
|
+
"required": true,
|
|
320
|
+
"description": "Deployment environment"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// Palisade Cedar Schema
|
|
2
|
+
// =====================
|
|
3
|
+
// ML Supply Chain Security & Artifact Scanning
|
|
4
|
+
//
|
|
5
|
+
// Palisade scans ML model artifacts (safetensors, GGUF, pickle, PyTorch) for
|
|
6
|
+
// security vulnerabilities and enforces policies based on findings.
|
|
7
|
+
//
|
|
8
|
+
// Architecture:
|
|
9
|
+
// Scanner → Validators (Pickle, SafeTensors, GGUF, etc.) → Cedar Policy → Allow/Deny/Quarantine
|
|
10
|
+
//
|
|
11
|
+
// Supported Formats:
|
|
12
|
+
// - SafeTensors (.safetensors)
|
|
13
|
+
// - GGUF (.gguf)
|
|
14
|
+
// - Pickle (.pkl, .pickle, .pt)
|
|
15
|
+
// - PyTorch (.pth, .pt)
|
|
16
|
+
// - ONNX (.onnx)
|
|
17
|
+
|
|
18
|
+
namespace Palisade {
|
|
19
|
+
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// ENTITIES
|
|
22
|
+
// =============================================================================
|
|
23
|
+
|
|
24
|
+
// Security scanner service
|
|
25
|
+
entity Scanner {
|
|
26
|
+
scanner_type: String, // "palisade", "redteam", etc.
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// ML model artifact
|
|
30
|
+
entity Artifact {
|
|
31
|
+
artifact_format: String, // "safetensors", "gguf", "pickle", "pytorch", "onnx"
|
|
32
|
+
path: String, // File path
|
|
33
|
+
signed: Bool, // Whether digitally signed
|
|
34
|
+
signer: String, // Who signed (if applicable)
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Software package (npm, PyPI, etc.)
|
|
38
|
+
entity Package {
|
|
39
|
+
package_name: String,
|
|
40
|
+
package_version: String,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// =============================================================================
|
|
44
|
+
// ACTIONS
|
|
45
|
+
// =============================================================================
|
|
46
|
+
|
|
47
|
+
// Scan an ML artifact for security issues
|
|
48
|
+
action scan_artifact appliesTo {
|
|
49
|
+
principal: [Scanner],
|
|
50
|
+
resource: [Artifact],
|
|
51
|
+
context: {
|
|
52
|
+
// Core Finding & Severity
|
|
53
|
+
finding_type: String, // Type of finding (e.g., "backdoor_detected", "safetensors_integrity_violation")
|
|
54
|
+
severity: String, // "CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"
|
|
55
|
+
environment: String, // "production", "strict_production", "development", "permissive_development", "research"
|
|
56
|
+
|
|
57
|
+
// Artifact Metadata
|
|
58
|
+
artifact_format: String, // "safetensors", "gguf", "pickle", "pytorch", "onnx"
|
|
59
|
+
path: String, // File path to artifact
|
|
60
|
+
artifact_signed: Bool, // Whether artifact is digitally signed
|
|
61
|
+
provenance_signer: String, // "unknown", "unsigned", or signer name
|
|
62
|
+
|
|
63
|
+
// Pickle Security
|
|
64
|
+
pickle_exec_path_detected: Bool, // Pickle RCE execution path detected (CRITICAL)
|
|
65
|
+
|
|
66
|
+
// Tokenizer Security
|
|
67
|
+
tokenizer_added_tokens_count: Long, // Number of added tokens (0-5000+)
|
|
68
|
+
|
|
69
|
+
// LoRA Security
|
|
70
|
+
adapter_base_digest_mismatch: Bool, // LoRA adapter base model digest mismatch
|
|
71
|
+
|
|
72
|
+
// GGUF Security
|
|
73
|
+
gguf_suspicious_metadata: Bool, // GGUF metadata contains suspicious patterns
|
|
74
|
+
|
|
75
|
+
// SafeTensors Security
|
|
76
|
+
safetensors_integrity_violation: Bool, // SafeTensors file integrity violated
|
|
77
|
+
|
|
78
|
+
// General Metadata Security
|
|
79
|
+
metadata_malicious_pattern: Bool, // Metadata contains malicious patterns
|
|
80
|
+
|
|
81
|
+
// CoSAI Maturity
|
|
82
|
+
metadata_cosai_level_numeric: Long, // CoSAI maturity level (0-5, higher = more trustworthy)
|
|
83
|
+
|
|
84
|
+
// Backdoor Detection
|
|
85
|
+
match_count: Long, // Number of behavioral backdoor indicator matches
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Validate artifact integrity (checksum, signature)
|
|
90
|
+
action validate_integrity appliesTo {
|
|
91
|
+
principal: [Scanner],
|
|
92
|
+
resource: [Artifact],
|
|
93
|
+
context: {
|
|
94
|
+
artifact_format: String,
|
|
95
|
+
path: String,
|
|
96
|
+
artifact_signed: Bool,
|
|
97
|
+
provenance_signer: String,
|
|
98
|
+
safetensors_integrity_violation: Bool,
|
|
99
|
+
finding_type: String,
|
|
100
|
+
severity: String,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Validate artifact provenance (signer, origin)
|
|
105
|
+
action validate_provenance appliesTo {
|
|
106
|
+
principal: [Scanner],
|
|
107
|
+
resource: [Artifact],
|
|
108
|
+
context: {
|
|
109
|
+
artifact_format: String,
|
|
110
|
+
path: String,
|
|
111
|
+
artifact_signed: Bool,
|
|
112
|
+
provenance_signer: String,
|
|
113
|
+
metadata_cosai_level_numeric: Long,
|
|
114
|
+
finding_type: String,
|
|
115
|
+
severity: String,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Quarantine a malicious artifact
|
|
120
|
+
action quarantine_artifact appliesTo {
|
|
121
|
+
principal: [Scanner],
|
|
122
|
+
resource: [Artifact],
|
|
123
|
+
context: {
|
|
124
|
+
finding_type: String,
|
|
125
|
+
severity: String,
|
|
126
|
+
environment: String,
|
|
127
|
+
artifact_format: String,
|
|
128
|
+
path: String,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Load an ML model into memory
|
|
133
|
+
action load_model appliesTo {
|
|
134
|
+
principal: [Scanner],
|
|
135
|
+
resource: [Artifact],
|
|
136
|
+
context: {
|
|
137
|
+
artifact_format: String,
|
|
138
|
+
environment: String,
|
|
139
|
+
artifact_signed: Bool,
|
|
140
|
+
severity: String,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Deploy an ML model to production
|
|
145
|
+
action deploy_model appliesTo {
|
|
146
|
+
principal: [Scanner],
|
|
147
|
+
resource: [Artifact],
|
|
148
|
+
context: {
|
|
149
|
+
artifact_format: String,
|
|
150
|
+
environment: String,
|
|
151
|
+
artifact_signed: Bool,
|
|
152
|
+
provenance_signer: String,
|
|
153
|
+
severity: String,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Scan a software package
|
|
158
|
+
action scan_package appliesTo {
|
|
159
|
+
principal: [Scanner],
|
|
160
|
+
resource: [Package],
|
|
161
|
+
context: {
|
|
162
|
+
finding_type: String,
|
|
163
|
+
severity: String,
|
|
164
|
+
environment: String,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
}
|
package/dist/builder.d.ts
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { EntityType, EntityUID } from './entities.gen.js';
|
|
25
25
|
import { ActionType } from './actions.gen.js';
|
|
26
|
-
import { ContextKey } from './context.gen.js';
|
|
27
26
|
/**
|
|
28
27
|
* Policy effect - permit or forbid
|
|
29
28
|
*/
|
|
@@ -199,7 +198,7 @@ export declare class PolicyBuilder {
|
|
|
199
198
|
/**
|
|
200
199
|
* Add a structured condition
|
|
201
200
|
*/
|
|
202
|
-
when(field:
|
|
201
|
+
when(field: string, operator: ConditionOperator, value: string | number | boolean | string[]): PolicyBuilder;
|
|
203
202
|
/**
|
|
204
203
|
* Add a raw condition string (for advanced users)
|
|
205
204
|
*/
|