MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / parse_binary_capability

Function parse_binary_capability

crates/openshell-prover/src/registry.rs:196–233  ·  view source on GitHub ↗
(contents: &str, source: &str)

Source from the content-addressed store, hash-verified

194// ---------------------------------------------------------------------------
195
196fn parse_binary_capability(contents: &str, source: &str) -> Result<BinaryCapability> {
197 let raw: BinaryCapabilityDef = serde_yml::from_str(contents)
198 .into_diagnostic()
199 .wrap_err_with(|| format!("parsing binary descriptor {source}"))?;
200
201 let protocols = raw
202 .protocols
203 .into_iter()
204 .map(|p| {
205 let actions = p
206 .actions
207 .into_iter()
208 .map(|a| BinaryAction {
209 name: a.name,
210 action_type: ActionType::from_str(&a.action_type),
211 description: a.description,
212 })
213 .collect();
214 BinaryProtocol {
215 name: p.name,
216 transport: p.transport,
217 description: p.description,
218 bypasses_l7: p.bypasses_l7,
219 actions,
220 }
221 })
222 .collect();
223
224 Ok(BinaryCapability {
225 path: raw.binary,
226 description: raw.description,
227 protocols,
228 spawns: raw.spawns,
229 can_exfiltrate: raw.can_exfiltrate,
230 exfil_mechanism: raw.exfil_mechanism,
231 can_construct_http: raw.can_construct_http,
232 })
233}
234
235/// Load binary registry from the compile-time embedded registry data.
236pub fn load_embedded_binary_registry() -> Result<BinaryRegistry> {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected