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

Function ancestor_binary_allowed

crates/openshell-supervisor-network/src/opa.rs:1655–1677  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1653
1654 #[test]
1655 fn ancestor_binary_allowed() {
1656 // Use github policy: binary /usr/bin/git is the policy binary.
1657 // If the socket process is /usr/bin/python3 but its ancestor is /usr/bin/git, allow.
1658 let engine = test_engine();
1659 let input = NetworkInput {
1660 host: "github.com".into(),
1661 port: 443,
1662 binary_path: PathBuf::from("/usr/bin/python3"),
1663 binary_sha256: "unused".into(),
1664 ancestors: vec![PathBuf::from("/usr/bin/git")],
1665 cmdline_paths: vec![],
1666 };
1667 let decision = engine.evaluate_network(&input).unwrap();
1668 assert!(
1669 decision.allowed,
1670 "Expected allow via ancestor match, got deny: {}",
1671 decision.reason
1672 );
1673 assert_eq!(
1674 decision.matched_policy.as_deref(),
1675 Some("github_ssh_over_https")
1676 );
1677 }
1678
1679 #[test]
1680 fn no_ancestor_match_denied() {

Callers

nothing calls this directly

Calls 2

test_engineFunction · 0.85
evaluate_networkMethod · 0.80

Tested by

no test coverage detected