Hi Quinn,
Thanks again for clarifying the GUI-session LaunchAgent and XPC approach. We've completed a read-only review of the public APIs and have one remaining platform-identity question before implementing that design.
Our target is macOS 26.6.2 (25G83), arm64, using C-XPC and a system-level daemon.
We understand that xpc_connection_set_peer_code_signing_requirement can enforce an independently configured code requirement, and that SecCodeCreateWithXPCMessage can obtain a dynamic code reference from the actual received message. We also understand that xpc_connection_get_euid, get_asid and get_pid describe connection-time credentials.
We need to establish two additional properties:
Actual-message process identity
Is there a supported public mechanism to establish that the received XPC message's authenticated sender corresponds to a particular kernel-observed process incarnation, including its account, audit session and PID version?
Specifically, can we reliably associate that identity with the audit-token process identity obtained from a separate Mach message?
We don't want to assume that matching PIDs, code identity or connection-time credentials proves process-incarnation equality, especially across forwarding, exec, replacement or reconnection.
Particular GUI LaunchAgent instance
How should our daemon establish that this authenticated process is the actual launchd-managed agent belonging to a particular GUI login session, rather than another same-UID process executing the same signed code?
Does launchd expose a supported service-instance or bootstrap-domain binding that establishes this relationship? Or is a different communication arrangement recommended?
We are not asking for instantaneous logout detection or atomic ordering against pending IPC. We understand those guarantees aren't provided. Our controller will enforce its own authorization epochs and retire authority upon observed agent loss or revocation.
We are only trying to determine which process and GUI-session identity facts macOS can authoritatively supply, so our application can enforce the remaining rules.
If either association is not available through supported public interfaces, confirmation of that limitation—or a recommended alternative architecture—would be equally useful.
Thanks again for your help.
Topic:
App & System Services
SubTopic:
Core OS
Tags: