Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable using kSecUseDataProtectionKeychain on macOS keychains prior to Catalina #215

Conversation

dfed
Copy link
Collaborator

@dfed dfed commented Jan 25, 2020

According to my tests in #214, it looks like kSecUseDataProtectionKeychain can be used on older macOS installs.

It seems possible that using kSecUseDataProtectionKeychain may obviate #140, since kSecUseDataProtectionKeychain seems to change how access control works. In the following screenshot, the left item was added to the keychain using kSecUseDataProtectionKeychain = true, and the right item was added using kSecUseDataProtectionKeychain = false:

image

However, per #213, using kSecUseDataProtectionKeychain requires keychain sharing entitlements on macOS, so I've protected the test with testEnvironmentIsSigned(). Since our macOS CI environment isn't code-signed, CI can not tell us if this is working. However, given that my kSecUseDataProtectionKeychain tests in #214 failed on macOS 10.13 and 10.14 with errSecMissingEntitlement, that indicates to me that those keychains understand and respect kSecUseDataProtectionKeychain (otherwise we'd have gotten errSecParam).

If anyone has a pre-Catalina Mac install around and wants to help me test this, I'd be greatly appreciative. The test would involve using this branch of Valet in your application that has a Keychain Sharing entitlement on a pre-Catalina Mac, running migrateObjectsFromPreCatalina() on your Valet, and then trying to access the keychain. I think it'll just work, but, would be best to verify.

@dfed dfed requested review from fdiaz and NickEntin January 25, 2020 18:22
@dfed
Copy link
Collaborator Author

dfed commented Jan 25, 2020

Actually, on second thought... we probably shouldn't try to set "nleg" (i.e. kSecUseDataProtectionKeychain) on older macOS keychains, even if it will indeed work. Seems safer to respect Apple's marking of kSecUseDataProtectionKeychain as available on 10.15+ and not use the hardcoded constant value on older operating systems. I'm down a rabbit hole. Closing this PR.

@dfed dfed closed this Jan 25, 2020
@dfed dfed deleted the dfed--enable-using-kSecUseDataProtectionKeychain-pre-catalina branch January 25, 2020 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant