mirror of
https://github.com/yattee/yattee.git
synced 2026-10-31 08:57:17 +00:00
Migrate a saved login without asking about it
The pre-revamp release reads its unscoped Keychain item with kSecAttrSynchronizableAny and no identity in the key, so a credential retained across an Apple Account change is already served to whoever holds the device. Asking before reusing it prevents nothing that is not already happening, and it cost every upgrading user a trip into the instance editor to find a button they had no reason to look for. What silent adoption could genuinely add is re-filing that secret as synchronizable under the identity signed in now, which uploads a login of unproven provenance into that person's iCloud Keychain and spreads it to their devices. So the copy is written device-local instead, and the migration runs where the status is computed. The real owner loses nothing: the item it was copied from syncs, so each of their devices finds it and adopts its own copy, and adoption still never deletes it. Two things keep that closed. Turning iCloud sync on rewrites stored credentials to follow the setting, which would undo the whole point, so adopted ones are left out of it. And only the account the instance's legacy login became may inherit the secret — the old item is keyed by instance, so a second login the user added themselves would otherwise match it.
This commit is contained in:
@@ -897,6 +897,17 @@ final class AppEnvironment {
|
||||
|
||||
credentials.refreshLoginStatus(for: account)
|
||||
|
||||
// An account migrated from a pre-revamp login has its credential
|
||||
// under the old unscoped key. Move it across before concluding
|
||||
// anything: the upgrade is not something to ask the user about —
|
||||
// the previous release already served that item to whoever held the
|
||||
// device, and the copy made here stays on it.
|
||||
if !credentials.isLoggedIn(for: account),
|
||||
credentials.hasAdoptableLegacyCredential(for: account),
|
||||
credentials.adoptLegacyCredential(for: account) {
|
||||
credentials.refreshLoginStatus(for: account)
|
||||
}
|
||||
|
||||
guard credentials.isLoggedIn(for: account) else {
|
||||
accountsManager.setStatus(.credentialMissing, for: account.id)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user