Enable using kSecUseDataProtectionKeychain on macOS keychains prior to Catalina #215
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, sincekSecUseDataProtectionKeychain
seems to change how access control works. In the following screenshot, the left item was added to the keychain usingkSecUseDataProtectionKeychain = true
, and the right item was added usingkSecUseDataProtectionKeychain = false
:However, per #213, using
kSecUseDataProtectionKeychain
requires keychain sharing entitlements on macOS, so I've protected the test withtestEnvironmentIsSigned()
. Since our macOS CI environment isn't code-signed, CI can not tell us if this is working. However, given that mykSecUseDataProtectionKeychain
tests in #214 failed on macOS 10.13 and 10.14 witherrSecMissingEntitlement
, that indicates to me that those keychains understand and respectkSecUseDataProtectionKeychain
(otherwise we'd have gottenerrSecParam
).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.