I have two processes that talk to each other using an NSXPCConnection. If I want to pass sensitive data over the connection, should I be worried about it being intercepted or read by other processes? Should I encrypt any sensitive data before sending it over the connection and have the other process have to decrypt it?
One process is a LaunchDaemon and the other is a LaunchAgent.
XPC connections from your agent to your daemon are reasonably secure. Specifically, when your agent starts the connection it should set the privileged
flag (or XPC_CONNECTION_MACH_SERVICE_PRIVILEGED
in the C API). That ensures that the agent only connects to the service in the global namespace, and adding a service to the global namespace is a privileged operation.
IMPORTANT The docs I linked to above don’t really capture the meaning of that flag (r. 100412590). Rather, read the description in the xpc_connection_create
man page.
If you want the daemon to be able to check the identity of the client, see this post.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"