@highflame/policy 1.1.3
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/dist/actions.gen.d.ts +29 -0
- package/dist/actions.gen.d.ts.map +1 -0
- package/dist/actions.gen.js +31 -0
- package/dist/actions.gen.js.map +1 -0
- package/dist/builder.d.ts +189 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/builder.js +385 -0
- package/dist/builder.js.map +1 -0
- package/dist/context.gen.d.ts +99 -0
- package/dist/context.gen.d.ts.map +1 -0
- package/dist/context.gen.js +103 -0
- package/dist/context.gen.js.map +1 -0
- package/dist/engine.d.ts +92 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +203 -0
- package/dist/engine.js.map +1 -0
- package/dist/entities.gen.d.ts +45 -0
- package/dist/entities.gen.d.ts.map +1 -0
- package/dist/entities.gen.js +39 -0
- package/dist/entities.gen.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.gen.d.ts +6 -0
- package/dist/schema.gen.d.ts.map +1 -0
- package/dist/schema.gen.js +301 -0
- package/dist/schema.gen.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -0
- package/src/actions.gen.ts +36 -0
- package/src/builder.ts +478 -0
- package/src/context.gen.ts +107 -0
- package/src/engine.ts +252 -0
- package/src/entities.gen.ts +60 -0
- package/src/index.ts +14 -0
- package/src/schema.gen.ts +301 -0
- package/src/types.ts +15 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded Cedar schema for policy validation.
|
|
3
|
+
* This is the Highflame Cedar schema used across all services.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CEDAR_SCHEMA = "// Highflame Cedar Schema\n// ======================\n// This is the SOURCE OF TRUTH for all entity types, actions, and their relationships\n// across the Highflame platform.\n//\n// All services (authz, Core, Guardian, Palisade) MUST use the types defined here.\n// The codegen tool parses this file and generates typed constants for Go, TypeScript,\n// and Python to ensure consistency.\n//\n// Usage:\n// - Policies are validated against this schema when created/updated\n// - Generated types prevent typos in application code\n// - Cedar CLI can validate: cedar validate --schema highflame.cedarschema --policies policy.cedar\n\n// =============================================================================\n// PRINCIPAL TYPES (Who is making the request)\n// =============================================================================\n\n// Human user or service account making requests\n// Well-known IDs: \"mcp_client\", \"threat_processor\"\nentity User {\n // User type: \"external\", \"internal\"\n user_type: String,\n};\n\n// AI agent or bot\nentity Agent {\n // Agent type: \"llm\", \"scanner\", \"bot\"\n agent_type: String,\n};\n\n// Security scanner service\n// Well-known IDs: \"ramparts\", \"palisade\"\nentity Scanner {\n // Scanner type: \"ramparts\", \"palisade\"\n scanner_type: String,\n // Scanner version\n version: String,\n};\n\n// Backend service account\nentity Service {\n // Service name\n service_name: String,\n // Environment: \"production\", \"staging\", \"development\"\n environment: String,\n};\n\n// =============================================================================\n// RESOURCE TYPES (What is being accessed)\n// =============================================================================\n\n// Generic resource\n// Well-known IDs: \"threat_analysis\", \"tools/list\", \"tools/call\", \"resources/list\",\n// \"resources/read\", \"prompts/list\", \"unknown\"\nentity Resource {};\n\n// LLM response data\n// Well-known IDs: \"response_data\"\nentity ResponseData {};\n\n// MCP tool that can be called\nentity Tool {\n // Tool name\n tool_name: String,\n // Risk level: \"safe\", \"moderate\", \"dangerous\"\n risk_level: String,\n // Category: \"file\", \"network\", \"shell\", \"api\"\n category: String,\n};\n\n// File system path\nentity FilePath {\n // Full path\n path: String,\n // File extension\n extension: String,\n // Whether file is sensitive (.env, credentials, etc.)\n is_sensitive: Bool,\n};\n\n// HTTP endpoint\nentity HttpEndpoint {\n // Hostname\n hostname: String,\n // Scheme: \"http\", \"https\"\n scheme: String,\n // Port number\n port: Long,\n // Whether endpoint is internal\n is_internal: Bool,\n};\n\n// MCP Server\nentity Server {\n // Server name\n server_name: String,\n};\n\n// ML model artifact (for Palisade)\nentity Artifact {\n // Format: \"safetensors\", \"pickle\", \"gguf\", \"onnx\"\n artifact_type: String,\n // Source URL or path\n source: String,\n // SHA256 hash\n hash: String,\n // Whether artifact is signed\n is_signed: Bool,\n};\n\n// Code repository\nentity Repository {\n // Repository URL\n url: String,\n};\n\n// Software package\nentity Package {\n // Package name\n name: String,\n // Package version\n version: String,\n};\n\n// =============================================================================\n// ACTIONS\n// =============================================================================\n\n// --- LLM/Guardrails Actions ---\n\n// Process an LLM prompt\n// Context: prompt_text, yara_threats, threat_count, max_threat_severity,\n// user_type, monitoring_enabled\naction process_prompt appliesTo {\n principal: [User, Agent],\n resource: [Resource],\n};\n\n// Process an LLM response\n// Context: response_size_mb\naction process_response appliesTo {\n principal: [User, Agent],\n resource: [ResponseData],\n};\n\n// --- MCP/Tool Actions ---\n\n// Call an MCP tool\n// Context: tool_name\naction call_tool appliesTo {\n principal: [User, Agent, Service],\n resource: [Tool, Resource],\n};\n\n// Connect to an MCP server\naction connect_server appliesTo {\n principal: [User, Agent, Service],\n resource: [Server, Resource],\n};\n\n// Access a server-specific resource\n// Context: tool_name, resource_name, prompt_name\naction access_server_resource appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// Skip guardrails for an operation\naction skip_guardrails appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// --- File System Actions ---\n\n// Read a file\n// Context: path\naction read_file appliesTo {\n principal: [User, Agent, Scanner],\n resource: [FilePath, Resource],\n};\n\n// Write a file\n// Context: path\naction write_file appliesTo {\n principal: [User, Agent],\n resource: [FilePath, Resource],\n};\n\n// --- HTTP Actions ---\n\n// Make an HTTP request\n// Context: hostname, ip_address, scheme, port\naction http_request appliesTo {\n principal: [User, Agent, Service],\n resource: [HttpEndpoint, Resource],\n};\n\n// --- Scanner Actions ---\n\n// Scan a target (MCP server, repository, etc.)\naction scan_target appliesTo {\n principal: [Scanner, Service],\n resource: [Resource, Repository, Server],\n};\n\n// Scan a software package\naction scan_package appliesTo {\n principal: [Scanner, Service],\n resource: [Package, Resource],\n};\n\n// --- Palisade/ML Actions ---\n\n// Scan an ML artifact\n// Context: environment, artifact_format, artifact_signed, severity, finding_type,\n// provenance_signer, pickle_exec_path_detected, metadata_malicious_pattern,\n// tokenizer_added_tokens_count, safetensors_integrity_violation,\n// gguf_suspicious_metadata, adapter_base_digest_mismatch,\n// metadata_cosai_level_numeric\naction scan_artifact appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact, Resource],\n};\n\n// Validate artifact integrity\naction validate_integrity appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Validate artifact provenance\naction validate_provenance appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Quarantine an artifact\naction quarantine_artifact appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Load an ML model\naction load_model appliesTo {\n principal: [User, Agent, Service],\n resource: [Artifact],\n};\n\n// Deploy an ML model\naction deploy_model appliesTo {\n principal: [User, Service],\n resource: [Artifact],\n};\n\n// =============================================================================\n// CONTEXT ATTRIBUTES REFERENCE (Documentation Only)\n// =============================================================================\n// Cedar context is dynamic and not enforced by schema, but these are the\n// standard attributes used across Highflame services:\n//\n// GUARDRAILS/CORE:\n// tool_name: String - Name of tool being called\n// resource_name: String - Name of resource being accessed\n// prompt_name: String - Name of prompt\n// prompt_text: String - Raw prompt text (for injection detection)\n// response_size_mb: Long - Response size in megabytes\n// yara_threats: Set<String> - Set of detected YARA threat names\n// threat_count: Long - Number of threats detected\n// max_threat_severity: Long - Highest severity (0=INFO, 4=CRITICAL)\n// user_type: String - \"external\" or \"internal\"\n// monitoring_enabled: Bool - Whether monitoring is active\n// path: String - File path\n// hostname: String - HTTP hostname\n// ip_address: String - IP address (for SSRF detection)\n// scheme: String - HTTP scheme\n// port: Long - Port number\n//\n// PALISADE:\n// environment: String - \"production\", \"development\", \"research\"\n// artifact_format: String - \"pickle\", \"safetensors\", \"gguf\", \"onnx\"\n// artifact_signed: Bool - Whether artifact has signature\n// severity: String - \"CRITICAL\", \"HIGH\", \"MEDIUM\", \"LOW\", \"INFO\"\n// finding_type: String - Type of security finding\n// provenance_signer: String - Who signed (\"unknown\", \"unsigned\", or name)\n// pickle_exec_path_detected: Bool - RCE path found in pickle\n// metadata_malicious_pattern: Bool - Malicious pattern in metadata\n// tokenizer_added_tokens_count: Long - Number of added tokens\n// safetensors_integrity_violation: Bool - Safetensors integrity failed\n// gguf_suspicious_metadata: Bool - Suspicious GGUF metadata\n// adapter_base_digest_mismatch: Bool - LoRA adapter digest mismatch\n// metadata_cosai_level_numeric: Long - CoSAI maturity level (0-5)\n";
|
|
6
|
+
//# sourceMappingURL=schema.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.gen.d.ts","sourceRoot":"","sources":["../src/schema.gen.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,YAAY,27RAqSxB,CAAC"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// Code generated by highflame-policy-codegen. DO NOT EDIT.
|
|
2
|
+
// Source: schema/highflame.cedarschema
|
|
3
|
+
/**
|
|
4
|
+
* Embedded Cedar schema for policy validation.
|
|
5
|
+
* This is the Highflame Cedar schema used across all services.
|
|
6
|
+
*/
|
|
7
|
+
export const CEDAR_SCHEMA = `// Highflame Cedar Schema
|
|
8
|
+
// ======================
|
|
9
|
+
// This is the SOURCE OF TRUTH for all entity types, actions, and their relationships
|
|
10
|
+
// across the Highflame platform.
|
|
11
|
+
//
|
|
12
|
+
// All services (authz, Core, Guardian, Palisade) MUST use the types defined here.
|
|
13
|
+
// The codegen tool parses this file and generates typed constants for Go, TypeScript,
|
|
14
|
+
// and Python to ensure consistency.
|
|
15
|
+
//
|
|
16
|
+
// Usage:
|
|
17
|
+
// - Policies are validated against this schema when created/updated
|
|
18
|
+
// - Generated types prevent typos in application code
|
|
19
|
+
// - Cedar CLI can validate: cedar validate --schema highflame.cedarschema --policies policy.cedar
|
|
20
|
+
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// PRINCIPAL TYPES (Who is making the request)
|
|
23
|
+
// =============================================================================
|
|
24
|
+
|
|
25
|
+
// Human user or service account making requests
|
|
26
|
+
// Well-known IDs: "mcp_client", "threat_processor"
|
|
27
|
+
entity User {
|
|
28
|
+
// User type: "external", "internal"
|
|
29
|
+
user_type: String,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// AI agent or bot
|
|
33
|
+
entity Agent {
|
|
34
|
+
// Agent type: "llm", "scanner", "bot"
|
|
35
|
+
agent_type: String,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Security scanner service
|
|
39
|
+
// Well-known IDs: "ramparts", "palisade"
|
|
40
|
+
entity Scanner {
|
|
41
|
+
// Scanner type: "ramparts", "palisade"
|
|
42
|
+
scanner_type: String,
|
|
43
|
+
// Scanner version
|
|
44
|
+
version: String,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Backend service account
|
|
48
|
+
entity Service {
|
|
49
|
+
// Service name
|
|
50
|
+
service_name: String,
|
|
51
|
+
// Environment: "production", "staging", "development"
|
|
52
|
+
environment: String,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// =============================================================================
|
|
56
|
+
// RESOURCE TYPES (What is being accessed)
|
|
57
|
+
// =============================================================================
|
|
58
|
+
|
|
59
|
+
// Generic resource
|
|
60
|
+
// Well-known IDs: "threat_analysis", "tools/list", "tools/call", "resources/list",
|
|
61
|
+
// "resources/read", "prompts/list", "unknown"
|
|
62
|
+
entity Resource {};
|
|
63
|
+
|
|
64
|
+
// LLM response data
|
|
65
|
+
// Well-known IDs: "response_data"
|
|
66
|
+
entity ResponseData {};
|
|
67
|
+
|
|
68
|
+
// MCP tool that can be called
|
|
69
|
+
entity Tool {
|
|
70
|
+
// Tool name
|
|
71
|
+
tool_name: String,
|
|
72
|
+
// Risk level: "safe", "moderate", "dangerous"
|
|
73
|
+
risk_level: String,
|
|
74
|
+
// Category: "file", "network", "shell", "api"
|
|
75
|
+
category: String,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// File system path
|
|
79
|
+
entity FilePath {
|
|
80
|
+
// Full path
|
|
81
|
+
path: String,
|
|
82
|
+
// File extension
|
|
83
|
+
extension: String,
|
|
84
|
+
// Whether file is sensitive (.env, credentials, etc.)
|
|
85
|
+
is_sensitive: Bool,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// HTTP endpoint
|
|
89
|
+
entity HttpEndpoint {
|
|
90
|
+
// Hostname
|
|
91
|
+
hostname: String,
|
|
92
|
+
// Scheme: "http", "https"
|
|
93
|
+
scheme: String,
|
|
94
|
+
// Port number
|
|
95
|
+
port: Long,
|
|
96
|
+
// Whether endpoint is internal
|
|
97
|
+
is_internal: Bool,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// MCP Server
|
|
101
|
+
entity Server {
|
|
102
|
+
// Server name
|
|
103
|
+
server_name: String,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// ML model artifact (for Palisade)
|
|
107
|
+
entity Artifact {
|
|
108
|
+
// Format: "safetensors", "pickle", "gguf", "onnx"
|
|
109
|
+
artifact_type: String,
|
|
110
|
+
// Source URL or path
|
|
111
|
+
source: String,
|
|
112
|
+
// SHA256 hash
|
|
113
|
+
hash: String,
|
|
114
|
+
// Whether artifact is signed
|
|
115
|
+
is_signed: Bool,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// Code repository
|
|
119
|
+
entity Repository {
|
|
120
|
+
// Repository URL
|
|
121
|
+
url: String,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Software package
|
|
125
|
+
entity Package {
|
|
126
|
+
// Package name
|
|
127
|
+
name: String,
|
|
128
|
+
// Package version
|
|
129
|
+
version: String,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// ACTIONS
|
|
134
|
+
// =============================================================================
|
|
135
|
+
|
|
136
|
+
// --- LLM/Guardrails Actions ---
|
|
137
|
+
|
|
138
|
+
// Process an LLM prompt
|
|
139
|
+
// Context: prompt_text, yara_threats, threat_count, max_threat_severity,
|
|
140
|
+
// user_type, monitoring_enabled
|
|
141
|
+
action process_prompt appliesTo {
|
|
142
|
+
principal: [User, Agent],
|
|
143
|
+
resource: [Resource],
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Process an LLM response
|
|
147
|
+
// Context: response_size_mb
|
|
148
|
+
action process_response appliesTo {
|
|
149
|
+
principal: [User, Agent],
|
|
150
|
+
resource: [ResponseData],
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// --- MCP/Tool Actions ---
|
|
154
|
+
|
|
155
|
+
// Call an MCP tool
|
|
156
|
+
// Context: tool_name
|
|
157
|
+
action call_tool appliesTo {
|
|
158
|
+
principal: [User, Agent, Service],
|
|
159
|
+
resource: [Tool, Resource],
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// Connect to an MCP server
|
|
163
|
+
action connect_server appliesTo {
|
|
164
|
+
principal: [User, Agent, Service],
|
|
165
|
+
resource: [Server, Resource],
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// Access a server-specific resource
|
|
169
|
+
// Context: tool_name, resource_name, prompt_name
|
|
170
|
+
action access_server_resource appliesTo {
|
|
171
|
+
principal: [User, Agent, Service],
|
|
172
|
+
resource: [Resource],
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// Skip guardrails for an operation
|
|
176
|
+
action skip_guardrails appliesTo {
|
|
177
|
+
principal: [User, Agent, Service],
|
|
178
|
+
resource: [Resource],
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// --- File System Actions ---
|
|
182
|
+
|
|
183
|
+
// Read a file
|
|
184
|
+
// Context: path
|
|
185
|
+
action read_file appliesTo {
|
|
186
|
+
principal: [User, Agent, Scanner],
|
|
187
|
+
resource: [FilePath, Resource],
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// Write a file
|
|
191
|
+
// Context: path
|
|
192
|
+
action write_file appliesTo {
|
|
193
|
+
principal: [User, Agent],
|
|
194
|
+
resource: [FilePath, Resource],
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// --- HTTP Actions ---
|
|
198
|
+
|
|
199
|
+
// Make an HTTP request
|
|
200
|
+
// Context: hostname, ip_address, scheme, port
|
|
201
|
+
action http_request appliesTo {
|
|
202
|
+
principal: [User, Agent, Service],
|
|
203
|
+
resource: [HttpEndpoint, Resource],
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// --- Scanner Actions ---
|
|
207
|
+
|
|
208
|
+
// Scan a target (MCP server, repository, etc.)
|
|
209
|
+
action scan_target appliesTo {
|
|
210
|
+
principal: [Scanner, Service],
|
|
211
|
+
resource: [Resource, Repository, Server],
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// Scan a software package
|
|
215
|
+
action scan_package appliesTo {
|
|
216
|
+
principal: [Scanner, Service],
|
|
217
|
+
resource: [Package, Resource],
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// --- Palisade/ML Actions ---
|
|
221
|
+
|
|
222
|
+
// Scan an ML artifact
|
|
223
|
+
// Context: environment, artifact_format, artifact_signed, severity, finding_type,
|
|
224
|
+
// provenance_signer, pickle_exec_path_detected, metadata_malicious_pattern,
|
|
225
|
+
// tokenizer_added_tokens_count, safetensors_integrity_violation,
|
|
226
|
+
// gguf_suspicious_metadata, adapter_base_digest_mismatch,
|
|
227
|
+
// metadata_cosai_level_numeric
|
|
228
|
+
action scan_artifact appliesTo {
|
|
229
|
+
principal: [Scanner, Service],
|
|
230
|
+
resource: [Artifact, Resource],
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// Validate artifact integrity
|
|
234
|
+
action validate_integrity appliesTo {
|
|
235
|
+
principal: [Scanner, Service],
|
|
236
|
+
resource: [Artifact],
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// Validate artifact provenance
|
|
240
|
+
action validate_provenance appliesTo {
|
|
241
|
+
principal: [Scanner, Service],
|
|
242
|
+
resource: [Artifact],
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// Quarantine an artifact
|
|
246
|
+
action quarantine_artifact appliesTo {
|
|
247
|
+
principal: [Scanner, Service],
|
|
248
|
+
resource: [Artifact],
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// Load an ML model
|
|
252
|
+
action load_model appliesTo {
|
|
253
|
+
principal: [User, Agent, Service],
|
|
254
|
+
resource: [Artifact],
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// Deploy an ML model
|
|
258
|
+
action deploy_model appliesTo {
|
|
259
|
+
principal: [User, Service],
|
|
260
|
+
resource: [Artifact],
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// =============================================================================
|
|
264
|
+
// CONTEXT ATTRIBUTES REFERENCE (Documentation Only)
|
|
265
|
+
// =============================================================================
|
|
266
|
+
// Cedar context is dynamic and not enforced by schema, but these are the
|
|
267
|
+
// standard attributes used across Highflame services:
|
|
268
|
+
//
|
|
269
|
+
// GUARDRAILS/CORE:
|
|
270
|
+
// tool_name: String - Name of tool being called
|
|
271
|
+
// resource_name: String - Name of resource being accessed
|
|
272
|
+
// prompt_name: String - Name of prompt
|
|
273
|
+
// prompt_text: String - Raw prompt text (for injection detection)
|
|
274
|
+
// response_size_mb: Long - Response size in megabytes
|
|
275
|
+
// yara_threats: Set<String> - Set of detected YARA threat names
|
|
276
|
+
// threat_count: Long - Number of threats detected
|
|
277
|
+
// max_threat_severity: Long - Highest severity (0=INFO, 4=CRITICAL)
|
|
278
|
+
// user_type: String - "external" or "internal"
|
|
279
|
+
// monitoring_enabled: Bool - Whether monitoring is active
|
|
280
|
+
// path: String - File path
|
|
281
|
+
// hostname: String - HTTP hostname
|
|
282
|
+
// ip_address: String - IP address (for SSRF detection)
|
|
283
|
+
// scheme: String - HTTP scheme
|
|
284
|
+
// port: Long - Port number
|
|
285
|
+
//
|
|
286
|
+
// PALISADE:
|
|
287
|
+
// environment: String - "production", "development", "research"
|
|
288
|
+
// artifact_format: String - "pickle", "safetensors", "gguf", "onnx"
|
|
289
|
+
// artifact_signed: Bool - Whether artifact has signature
|
|
290
|
+
// severity: String - "CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"
|
|
291
|
+
// finding_type: String - Type of security finding
|
|
292
|
+
// provenance_signer: String - Who signed ("unknown", "unsigned", or name)
|
|
293
|
+
// pickle_exec_path_detected: Bool - RCE path found in pickle
|
|
294
|
+
// metadata_malicious_pattern: Bool - Malicious pattern in metadata
|
|
295
|
+
// tokenizer_added_tokens_count: Long - Number of added tokens
|
|
296
|
+
// safetensors_integrity_violation: Bool - Safetensors integrity failed
|
|
297
|
+
// gguf_suspicious_metadata: Bool - Suspicious GGUF metadata
|
|
298
|
+
// adapter_base_digest_mismatch: Bool - LoRA adapter digest mismatch
|
|
299
|
+
// metadata_cosai_level_numeric: Long - CoSAI maturity level (0-5)
|
|
300
|
+
`;
|
|
301
|
+
//# sourceMappingURL=schema.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.gen.js","sourceRoot":"","sources":["../src/schema.gen.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,uCAAuC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqS3B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,cAAc,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by highflame-policy-codegen. DO NOT EDIT.
|
|
2
|
+
// Source: schema/highflame.cedarschema
|
|
3
|
+
//
|
|
4
|
+
// Browser-safe exports - no WASM dependency.
|
|
5
|
+
// Use this entry point in browser environments:
|
|
6
|
+
// import { EntityType, PolicyBuilder } from '@highflame/policy/types';
|
|
7
|
+
// Generated types - work in browser and Node.js
|
|
8
|
+
export * from './entities.gen.js';
|
|
9
|
+
export * from './actions.gen.js';
|
|
10
|
+
export * from './context.gen.js';
|
|
11
|
+
export * from './schema.gen.js';
|
|
12
|
+
// PolicyBuilder - works in browser (no WASM dependency)
|
|
13
|
+
export * from './builder.js';
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,uCAAuC;AACvC,EAAE;AACF,6CAA6C;AAC7C,gDAAgD;AAChD,yEAAyE;AAEzE,gDAAgD;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAEhC,wDAAwD;AACxD,cAAc,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@highflame/policy",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "Highflame Cedar policy types and engine wrapper",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./types": {
|
|
14
|
+
"import": "./dist/types.js",
|
|
15
|
+
"types": "./dist/types.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./server": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./entities": {
|
|
22
|
+
"import": "./dist/entities.gen.js",
|
|
23
|
+
"types": "./dist/entities.gen.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./actions": {
|
|
26
|
+
"import": "./dist/actions.gen.js",
|
|
27
|
+
"types": "./dist/actions.gen.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./context": {
|
|
30
|
+
"import": "./dist/context.gen.js",
|
|
31
|
+
"types": "./dist/context.gen.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./engine": {
|
|
34
|
+
"import": "./dist/engine.js",
|
|
35
|
+
"types": "./dist/engine.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./builder": {
|
|
38
|
+
"import": "./dist/builder.js",
|
|
39
|
+
"types": "./dist/builder.d.ts"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc",
|
|
44
|
+
"clean": "rm -rf dist",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@cedar-policy/cedar-wasm": "^4.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"typescript": "^5.3.0"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"src"
|
|
56
|
+
],
|
|
57
|
+
"keywords": [
|
|
58
|
+
"cedar",
|
|
59
|
+
"policy",
|
|
60
|
+
"authorization",
|
|
61
|
+
"highflame"
|
|
62
|
+
],
|
|
63
|
+
"license": "Apache-2.0",
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "https://github.com/highflame-ai/highflame-policy.git",
|
|
67
|
+
"directory": "packages/typescript"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Code generated by highflame-policy-codegen. DO NOT EDIT.
|
|
2
|
+
// Source: schema/highflame.cedarschema
|
|
3
|
+
|
|
4
|
+
import { EntityUID } from './entities.gen.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Action types defined in the Highflame Cedar schema.
|
|
8
|
+
*/
|
|
9
|
+
export const ActionType = {
|
|
10
|
+
AccessServerResource: 'access_server_resource',
|
|
11
|
+
CallTool: 'call_tool',
|
|
12
|
+
ConnectServer: 'connect_server',
|
|
13
|
+
DeployModel: 'deploy_model',
|
|
14
|
+
HttpRequest: 'http_request',
|
|
15
|
+
LoadModel: 'load_model',
|
|
16
|
+
ProcessPrompt: 'process_prompt',
|
|
17
|
+
ProcessResponse: 'process_response',
|
|
18
|
+
QuarantineArtifact: 'quarantine_artifact',
|
|
19
|
+
ReadFile: 'read_file',
|
|
20
|
+
ScanArtifact: 'scan_artifact',
|
|
21
|
+
ScanPackage: 'scan_package',
|
|
22
|
+
ScanTarget: 'scan_target',
|
|
23
|
+
SkipGuardrails: 'skip_guardrails',
|
|
24
|
+
ValidateIntegrity: 'validate_integrity',
|
|
25
|
+
ValidateProvenance: 'validate_provenance',
|
|
26
|
+
WriteFile: 'write_file',
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
export type ActionType = (typeof ActionType)[keyof typeof ActionType];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Create an EntityUID for an action.
|
|
33
|
+
*/
|
|
34
|
+
export function actionUID(action: ActionType): EntityUID {
|
|
35
|
+
return { type: 'Action', id: action };
|
|
36
|
+
}
|