-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix bug where multiple keychain entries would result in user persistence failure #5930
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
Conversation
Generated by 🚫 Danger |
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.
What are the risks of continuing with the wrong keychain?
// More than one keychain item was found, all but the first will be ignored. | ||
FIRLogError( | ||
kFIRLoggerAuth, @"I-AUT000005", | ||
@"Keychain query returned multiple results, all but the first will be ignored: %@", |
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.
Should the match limit of 2 above be removed, in order to get all the ignored results?
Is there a way to delete the duplicate users from the keychain? (I'm still new to iOS so don't know exactly how the keychain works) |
One auth session will be discarded. Based on my understanding of the code, the two auth sessions are actually the same user, one from the legacy keychain service (with no service specified) and one from the up-to-date keychain service. The right thing to do is probably to delete the legacy entry if we encounter both a legacy and non-legacy keychain entry. |
0725a41
to
ff33875
Compare
I've modified the code to always return the non-legacy item if it exists. The way keychain deletions work, I'm not sure it's practical to delete the old keychain value without making significant modifications to the class. Given the relatively limited impact of the bug I'm ok with not removing the legacy entry in this method. |
Fix CI , then LGTM |
Fixes #5906.