macOS: Can an XPC audit token prove that a peer belongs to a specific launchd job instance?

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.

I'm designing a security-sensitive macOS service using a protected launchd daemon and a separate bootstrap supervisor.

So these are both launchd daemons?

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

Thank you, Quinn.

No, not in the currently proposed architecture.

The protected Root service is intended to be a launchd-managed daemon with a SpawnConstraint.

The separate bootstrap supervisor is intended to be a protected, one-shot native executable invoked only after explicit owner authorization and macOS administrator authentication. It is not intended to be a second launchd daemon.

The supervisor would request that launchd start the specific protected Root job. This architecture is still a design proposal, not a deployed or verified implementation.

The unresolved question is how to establish an OS-backed association between the current launchd job instance and the XPC peer during the initial handshake, without relying solely on PID, code-signing identity, or application-supplied claims.

If that association is not available through supported public APIs, what architecture would Apple recommend for establishing a secure initial communication channel?

Thank you for your guidance.