Post

Replies

Boosts

Views

Activity

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.
6
0
132
4d
macOS Open Directory: Does ODNodeCreateRecord cleanup preserve concurrent records?
We are designing a local, non-login service account provisioning process on macOS using the public Open Directory API. The documentation for ODNodeCreateRecord() states that if setting an initial attribute fails, the record is deleted and an error is returned. We need to ensure that a failed creation attempt cannot delete or modify a pre-existing record, including during concurrent record creation or replacement. Questions: When attribute initialization fails, is the internal cleanup guaranteed to target only the record instance created by that specific API call, rather than another record with the same name? Is this cleanup bound to a unique record identity or UUID, including if another process concurrently creates, removes, or replaces a record with the same name? Does the public API provide an atomic create-only guarantee that prevents changes to an existing record? If these guarantees are not provided, what supported API or provisioning approach should be used to avoid affecting pre-existing local Directory Services records? Our current plan uses the local /Local/Default Directory Services node for a dedicated service account, administrative change serialization, pre-creation collision checks, and post-operation identity verification. We understand that these checks do not themselves prove atomicity or race-free cleanup. We would appreciate clarification of the supported API guarantees, specifically for macOS 15. Thank you.
3
0
81
2w
macOS: How to reliably verify the absence of an extended ACL using a file descriptor?
We are implementing a fail-closed security check for a directory opened through a file descriptor on macOS. We need to reliably distinguish between: No extended ACL is present. An extended ACL is present but contains zero entries. ACL retrieval failed or is unsupported. Observed behavior For an existing directory with mode 0700: acl_get_fd_np(fd, ACL_TYPE_EXTENDED) returns NULL with errno == ENOENT. acl_get_file(path, ACL_TYPE_EXTENDED) returns NULL with errno == ENOENT. fstat() and lstat() agree on the device and inode. The directory exists and can be opened successfully. ls -ldeO@ displays no extended ACL entries. We reviewed Apple's open-source implementations of acl_get_fd_np() and filesec_get_property(). We understand that ENOENT can result from an unavailable FILESEC_ACL property, rather than a missing filesystem object. We also understand that XNU distinguishes an empty ACL from KAUTH_FILESEC_NOACL. Question Is there a publicly supported, file-descriptor-based API with documented postconditions that can reliably prove the absence of an extended ACL, while distinguishing it from an empty ACL and an ACL retrieval failure? Specifically: Can fstatx_np() and filesec_get_property() provide this distinction? Can fgetattrlist() with ATTR_CMN_EXTENDED_SECURITY and ATTR_CMN_RETURNED_ATTRS reliably establish ACL absence? What additional filesystem capability checks or return-value checks are required? If no public API provides this guarantee, is that a documented limitation? For security reasons, our implementation rejects the object whenever ACL absence cannot be established reliably. We would appreciate clarification of the supported API contract and its limitations. Thank you.
1
0
72
2w
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.
Replies
6
Boosts
0
Views
132
Activity
4d
macOS Open Directory: Does ODNodeCreateRecord cleanup preserve concurrent records?
We are designing a local, non-login service account provisioning process on macOS using the public Open Directory API. The documentation for ODNodeCreateRecord() states that if setting an initial attribute fails, the record is deleted and an error is returned. We need to ensure that a failed creation attempt cannot delete or modify a pre-existing record, including during concurrent record creation or replacement. Questions: When attribute initialization fails, is the internal cleanup guaranteed to target only the record instance created by that specific API call, rather than another record with the same name? Is this cleanup bound to a unique record identity or UUID, including if another process concurrently creates, removes, or replaces a record with the same name? Does the public API provide an atomic create-only guarantee that prevents changes to an existing record? If these guarantees are not provided, what supported API or provisioning approach should be used to avoid affecting pre-existing local Directory Services records? Our current plan uses the local /Local/Default Directory Services node for a dedicated service account, administrative change serialization, pre-creation collision checks, and post-operation identity verification. We understand that these checks do not themselves prove atomicity or race-free cleanup. We would appreciate clarification of the supported API guarantees, specifically for macOS 15. Thank you.
Replies
3
Boosts
0
Views
81
Activity
2w
macOS: How to reliably verify the absence of an extended ACL using a file descriptor?
We are implementing a fail-closed security check for a directory opened through a file descriptor on macOS. We need to reliably distinguish between: No extended ACL is present. An extended ACL is present but contains zero entries. ACL retrieval failed or is unsupported. Observed behavior For an existing directory with mode 0700: acl_get_fd_np(fd, ACL_TYPE_EXTENDED) returns NULL with errno == ENOENT. acl_get_file(path, ACL_TYPE_EXTENDED) returns NULL with errno == ENOENT. fstat() and lstat() agree on the device and inode. The directory exists and can be opened successfully. ls -ldeO@ displays no extended ACL entries. We reviewed Apple's open-source implementations of acl_get_fd_np() and filesec_get_property(). We understand that ENOENT can result from an unavailable FILESEC_ACL property, rather than a missing filesystem object. We also understand that XNU distinguishes an empty ACL from KAUTH_FILESEC_NOACL. Question Is there a publicly supported, file-descriptor-based API with documented postconditions that can reliably prove the absence of an extended ACL, while distinguishing it from an empty ACL and an ACL retrieval failure? Specifically: Can fstatx_np() and filesec_get_property() provide this distinction? Can fgetattrlist() with ATTR_CMN_EXTENDED_SECURITY and ATTR_CMN_RETURNED_ATTRS reliably establish ACL absence? What additional filesystem capability checks or return-value checks are required? If no public API provides this guarantee, is that a documented limitation? For security reasons, our implementation rejects the object whenever ACL absence cannot be established reliably. We would appreciate clarification of the supported API contract and its limitations. Thank you.
Replies
1
Boosts
0
Views
72
Activity
2w