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.
Topic:
App & System Services
SubTopic:
Core OS
0
0
16