I'm designing a security-sensitive macOS service using a protected launchd daemon and a separate bootstrap supervisor.
The daemon's executable and launchd plist are intended to be protected from modification by unprivileged users. The job uses a SpawnConstraint to restrict which signed executable launchd may start.
During the initial XPC handshake, the supervisor must determine whether the sender is the current process launched by one specific launchd job, rather than another independently started process running the same signed executable.
I understand that:
- Spawn constraints restrict the executable that launchd may start.
- XPC peer code-signing requirements can authenticate a sender's code identity.
- A valid signature, Team ID, audit token or PID alone does not necessarily establish the sender's originating launchd job or current launch instance.
My question:
Is there a supported public macOS API or documented mechanism that allows a receiver to verify that the sender of an XPC message belongs to a specific launchd job label and its current launch instance, with OS-backed evidence rather than application-supplied claims?
If not, is this association intentionally unavailable through public APIs? What architecture does Apple recommend when the receiver must distinguish a launchd-managed daemon from another process running the same signed executable?
I'm particularly interested in avoiding PID-reuse races and avoiding the disclosure of authorization material before the peer is authenticated.
I'm looking for a supported design, not private APIs or undocumented launchctl behavior.
Thank you.