-
Notifications
You must be signed in to change notification settings - Fork 794
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
Fix macOS Access Groups #538
base: master
Are you sure you want to change the base?
Fix macOS Access Groups #538
Conversation
Fixes macOS access groups issues as described in kishikawakatsumi#438, kishikawakatsumi#491 and kishikawakatsumi#535
if #available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13.0, *) { | ||
if accessGroup != nil { | ||
query[UseDataProtectionKeychain] = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatically set UseDataProtectionKeychain
to true
when an access group was set. This is required for macOS and doesn't affect other platforms
if #available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13.0, *) { | ||
if accessGroup != nil { | ||
attributes[UseDataProtectionKeychain] = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here
if #available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13.0, *) { | ||
if accessGroupsCompatible { | ||
query[UseDataProtectionKeychain] = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is from a class function, so we can't check if options has access groups set or not...
@@ -887,12 +887,18 @@ public final class Keychain { | |||
|
|||
// MARK: | |||
|
|||
public class func allKeys(_ itemClass: ItemClass) -> [(String, String)] { | |||
public class func allKeys(_ itemClass: ItemClass, accessGroupsCompatible: Bool = true) -> [(String, String)] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...so I added an optional accessGroupsCompatible
that defaults to true
(per Apple documentation Tip)
There may be other places that also require setting |
Could you elaborate? 🙃 |
@rivera-ernesto That comment was written by an unrelated person. Please ignore it. |
When using Access Groups on macOS
kSecUseDataProtectionKeychain
needs to be set totrue
:https://developer.apple.com/documentation/security/ksecusedataprotectionkeychain
This pull request is a first fix for issues #438, #491 and #535