File tree Expand file tree Collapse file tree
crates/openshell-supervisor/src/backend_setup Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -698,10 +698,23 @@ fn mxc_setup_preserves_admitted_identity_and_constructs_only_mxc() {
698698 let proxy = built. proxy_listener . unwrap ( ) ;
699699 assert_eq ! ( proxy. bind_addr, launch. proxy. bind_addr) ;
700700 assert_eq ! ( proxy. authorization. as_ref( ) , launch. proxy. authorization) ;
701+ let listener = std:: net:: TcpListener :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
702+ let client = std:: net:: TcpStream :: connect ( listener. local_addr ( ) . unwrap ( ) ) . unwrap ( ) ;
703+ let ( server, peer) = listener. accept ( ) . unwrap ( ) ;
704+ let socket_identity = ( proxy. identity_resolver ) ( peer, server. local_addr ( ) . unwrap ( ) ) . unwrap ( ) ;
701705 assert_eq ! (
702- proxy. binary_identity. executable. path,
706+ std:: fs:: canonicalize( & socket_identity. executable. path) . unwrap( ) ,
707+ std:: fs:: canonicalize( std:: env:: current_exe( ) . unwrap( ) ) . unwrap( )
708+ ) ;
709+ assert ! ( socket_identity. executable. digest. is_some( ) ) ;
710+ assert_ne ! (
711+ socket_identity. executable. path,
703712 launch. proxy. workload_binary
704713 ) ;
714+ // A missing connection must fail closed instead of using the launch binary.
715+ assert ! ( ( proxy. identity_resolver) ( peer, "127.0.0.1:0" . parse( ) . unwrap( ) ) . is_err( ) ) ;
716+ drop ( client) ;
717+ drop ( server) ;
705718
706719 // Selecting a Windows implementation does not waive main's identity checks.
707720 let mut foreign_auth = setup. auth . clone ( ) ;
You can’t perform that action at this time.
0 commit comments