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

Method get_or_unknown

crates/openshell-prover/src/registry.rs:168–189  ·  view source on GitHub ↗

Look up a binary, falling back to glob matching, then to a conservative unknown descriptor.

(&self, path: &str)

Source from the content-addressed store, hash-verified

166 /// Look up a binary, falling back to glob matching, then to a conservative
167 /// unknown descriptor.
168 pub fn get_or_unknown(&self, path: &str) -> BinaryCapability {
169 if let Some(cap) = self.binaries.get(path) {
170 return cap.clone();
171 }
172 for (reg_path, cap) in &self.binaries {
173 if reg_path.contains('*')
174 && let Ok(pattern) = glob::Pattern::new(reg_path)
175 && pattern.matches(path)
176 {
177 return cap.clone();
178 }
179 }
180 BinaryCapability {
181 path: path.to_owned(),
182 description: "Unknown binary — not in registry".to_owned(),
183 protocols: Vec::new(),
184 spawns: Vec::new(),
185 can_exfiltrate: true,
186 exfil_mechanism: String::new(),
187 can_construct_http: true,
188 }
189 }
190}
191
192// ---------------------------------------------------------------------------

Callers 2

check_credential_safetyFunction · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected