@@ -5165,4 +5165,61 @@ network_policies:
51655165 let input = l7_input ( "h.test" , 80 , "HEAD" , "/protected" ) ;
51665166 assert ! ( !eval_l7( & engine, & input) ) ;
51675167 }
5168+
5169+ #[ test]
5170+ fn empty_binaries_allows_any_binary ( ) {
5171+ let engine = test_engine ( ) ;
5172+ let input = NetworkInput {
5173+ host : "open.example.com" . into ( ) ,
5174+ port : 443 ,
5175+ binary_path : PathBuf :: from ( "/any/random/binary" ) ,
5176+ binary_sha256 : "unused" . into ( ) ,
5177+ ancestors : vec ! [ ] ,
5178+ cmdline_paths : vec ! [ ] ,
5179+ } ;
5180+ let decision = engine. evaluate_network ( & input) . unwrap ( ) ;
5181+ assert ! (
5182+ decision. allowed,
5183+ "Expected allow with empty binaries list, got deny: {}" ,
5184+ decision. reason
5185+ ) ;
5186+ assert_eq ! ( decision. matched_policy. as_deref( ) , Some ( "open_endpoint" ) ) ;
5187+ }
5188+
5189+ #[ test]
5190+ fn unresolved_identity_allowed_with_empty_binaries ( ) {
5191+ let engine = test_engine ( ) ;
5192+ let input = NetworkInput {
5193+ host : "open.example.com" . into ( ) ,
5194+ port : 443 ,
5195+ binary_path : PathBuf :: from ( "<unresolved>" ) ,
5196+ binary_sha256 : String :: new ( ) ,
5197+ ancestors : vec ! [ ] ,
5198+ cmdline_paths : vec ! [ ] ,
5199+ } ;
5200+ let decision = engine. evaluate_network ( & input) . unwrap ( ) ;
5201+ assert ! (
5202+ decision. allowed,
5203+ "Expected allow for unresolved identity with empty binaries, got deny: {}" ,
5204+ decision. reason
5205+ ) ;
5206+ }
5207+
5208+ #[ test]
5209+ fn unresolved_identity_denied_with_specific_binaries ( ) {
5210+ let engine = test_engine ( ) ;
5211+ let input = NetworkInput {
5212+ host : "api.anthropic.com" . into ( ) ,
5213+ port : 443 ,
5214+ binary_path : PathBuf :: from ( "<unresolved>" ) ,
5215+ binary_sha256 : String :: new ( ) ,
5216+ ancestors : vec ! [ ] ,
5217+ cmdline_paths : vec ! [ ] ,
5218+ } ;
5219+ let decision = engine. evaluate_network ( & input) . unwrap ( ) ;
5220+ assert ! (
5221+ !decision. allowed,
5222+ "Expected deny for unresolved identity when policy requires specific binary"
5223+ ) ;
5224+ }
51685225}
0 commit comments