Why is xpc_connection_set_peer_code_signing_requirement() closing the connection instead of returning XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT?

I'm using libxpc in a C server and Swift client. I set up a code-signing requirement in the server using xpc_connection_set_peer_code_signing_requirement(). However, when the client doesn't meet the requirement, the server just closes the connection, and I get XPC_ERROR_CONNECTION_INTERRUPTED on the client side instead of XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT, making debugging harder.

What I want:

  • To receive XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT on the client when code-signing fails, for better debugging.

What I’ve tried:

  • Using xpc_connection_set_peer_code_signing_requirement(), but it causes the connection to be dropped immediately.

Questions:

  1. Why does the server close the connection without sending the expected error?
  2. How can I receive the correct error on the client side?
  3. Are there any other methods for debugging code-signing failures with libxpc?

Thanks for any insights!

XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT should be delivered as the error when the request is expecting a reply. What API are you use on the client to send the request?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Why is xpc_connection_set_peer_code_signing_requirement() closing the connection instead of returning XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT?
 
 
Q