Hello Apple Developer Forums,
I am looking for a documented, supported user-space method on macOS to verify that an already-open file or directory has no extended ACL, while distinguishing that state from an unsupported filesystem or an ACL retrieval failure.
Environment and observations:
macOS 15.7.7 on an Intel Mac; Command Line Tools SDK 15.5.
In an isolated synthetic test, acl_get_fd_np(fd, ACL_TYPE_EXTENDED) returned NULL with errno == ENOENT for a newly created regular file and directory with no ACL added by the test.
The same API returned an ACL containing one ACE after an ACL was added to a separate synthetic file.
An invalid file descriptor returned NULL with errno == EBADF.
These are observations on this OS and test filesystem only. I have not interpreted ENOENT as proof of ACL absence, and I have not tested fgetattrlist.
I could not establish from the available documentation whether NULL/ENOENT is a guaranteed indication of ACL absence. I also could not establish whether ATTR_CMN_RETURNED_ATTRS and KAUTH_FILESEC_NOACL provide a supported, stable user-space contract when using fgetattrlist.
Questions:
When acl_get_fd_np(fd, ACL_TYPE_EXTENDED) returns NULL with errno == ENOENT for an existing object, does that reliably mean the object has no extended ACL? Could it instead indicate unsupported or unavailable ACL data?
When requesting ATTR_CMN_EXTENDED_SECURITY through fgetattrlist, how can a caller confirm that the attribute was actually returned? Is ATTR_CMN_RETURNED_ATTRS supported for fgetattrlist? How should omitted or unsupported attributes be distinguished from ACL absence?
Is KAUTH_FILESEC_NOACL a supported, stable public user-space contract for parsing kauth_filesec returned by fgetattrlist? Under which documented conditions, if any, does it establish ACL absence?
Does VOL_CAP_INT_EXTENDED_SECURITY establish only volume capability, or can it help establish per-object ACL absence? What documented result distinguishes an ACL-free object from a filesystem that does not support extended security?
What guarantees apply when retrieving ACL information through an already-open descriptor if the pathname is renamed or replaced? Are ACL retrieval and fstat an atomic snapshot, particularly if another process changes the ACL?
What supported API and decision procedure would Apple recommend for positively confirming no extended ACL on an already-open file or directory, while treating unsupported, omitted, malformed, and error results as distinct fail-closed outcomes?
If this behavior is not covered by a supported public API contract, a clarification of that limitation and a reference to the closest documented API would be very helpful.
Thank you.