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

Function test_findings_for_github_policy

crates/openshell-prover/src/lib.rs:164–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

162 // The prover output is categorical, not severity-graded.
163 #[test]
164 fn test_findings_for_github_policy() {
165 use finding::category;
166
167 let policy_path = testdata_dir().join("policy.yaml");
168 let creds_path = testdata_dir().join("credentials.yaml");
169
170 let pol = parse_policy(&policy_path).expect("parse policy");
171 let cred_set = credentials::load_credential_set_embedded(&creds_path).expect("load creds");
172 let bin_reg = registry::load_embedded_binary_registry().expect("load registry");
173
174 let z3_model = build_model(pol, cred_set, bin_reg);
175 let findings = run_all_queries(&z3_model);
176
177 let categories: std::collections::HashSet<&str> =
178 findings.iter().map(|f| f.query.as_str()).collect();
179 assert!(
180 categories.contains(category::L7_BYPASS_CREDENTIALED),
181 "expected l7_bypass_credentialed finding for bypass-L7 binary with credential in scope; \
182 got categories: {categories:?}"
183 );
184 // Every emitted category must be one of the four v1 categories.
185 let allowed: std::collections::HashSet<&str> = [
186 category::LINK_LOCAL_REACH,
187 category::L7_BYPASS_CREDENTIALED,
188 category::CREDENTIAL_REACH_EXPANSION,
189 category::CAPABILITY_EXPANSION,
190 ]
191 .into_iter()
192 .collect();
193 for c in &categories {
194 assert!(
195 allowed.contains(*c),
196 "unexpected category {c} emitted by the prover"
197 );
198 }
199 }
200
201 #[test]
202 fn test_wildcard_endpoint_covering_credential_host_emits_credential_reach() {

Callers

nothing calls this directly

Calls 7

testdata_dirFunction · 0.85
parse_policyFunction · 0.85
build_modelFunction · 0.85
run_all_queriesFunction · 0.85
as_strMethod · 0.45

Tested by

no test coverage detected