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

Function parse_policy_with_network_rules

crates/openshell-policy/src/lib.rs:1500–1520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1498
1499 #[test]
1500 fn parse_policy_with_network_rules() {
1501 let yaml = r"
1502version: 1
1503network_policies:
1504 test:
1505 name: test_policy
1506 endpoints:
1507 - { host: example.com, port: 443 }
1508 binaries:
1509 - { path: /usr/bin/curl }
1510";
1511 let policy = parse_sandbox_policy(yaml).expect("should parse");
1512 assert_eq!(policy.network_policies.len(), 1);
1513 let rule = &policy.network_policies["test"];
1514 assert_eq!(rule.name, "test_policy");
1515 assert_eq!(rule.endpoints.len(), 1);
1516 assert_eq!(rule.endpoints[0].host, "example.com");
1517 assert_eq!(rule.endpoints[0].port, 443);
1518 assert_eq!(rule.binaries.len(), 1);
1519 assert_eq!(rule.binaries[0].path, "/usr/bin/curl");
1520 }
1521
1522 #[test]
1523 fn parse_l7_query_matchers_and_round_trip() {

Callers

nothing calls this directly

Calls 1

parse_sandbox_policyFunction · 0.85

Tested by

no test coverage detected