On MacOS, using Xcode13, does SecItemAdd automatically create ACL on login keychain?

In older MacOS versions, below API would create access ref object of the app running the code and store it into SectrustedApplicationRef mySelf object.

SecTrustedApplicationRef mySelf = NULL;
SecTrustedApplicationCreateFromPath(NULL, &mySelf);

Then I can store mySelf in an array - allTrustedApps, and create SecAccessRef object

   SecAccessRef accessRef = NULL;
  status = SecAccessCreate((CFStringRef)accessLabel, (__bridge CFArrayRef)allTrustedApps, &accessRef);

Finally, I would then add this access ref object into kSecAttrAccess field of the query dictionary before feeding it into SecItemAdd.

However, on MacOS 10.15+ SecTrustedApplicationCreateFromPath is deprecated.

As I was playing around with ACL, and when I tried to add a kSecClassGenericPassword object into login keychain using SecItemAdd, without 'KSecAttrAccess' in the write query dictionary. (nothing but kSecAttrAccount and kSecAttrService) - I've noticed that the final object in the login keychain still has ACL containing the hosting app that ran the keychain add op.

Is this by design?

Thanks, Peter

I've noticed that the final object in the login keychain still has ACL containing the hosting app that ran the keychain add op.

Is this by design?

Yes. We’ve always added the creating app to the item’s ACL by default. I’m not sure why you were previously doing this explicitly.

Share and Enjoy

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

On MacOS, using Xcode13, does SecItemAdd automatically create ACL on login keychain?
 
 
Q