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

Crash on clean install: "could not remove legacy passphrase" #3876

Closed
3 tasks done
mattrubin opened this issue Sep 9, 2018 · 0 comments
Closed
3 tasks done

Crash on clean install: "could not remove legacy passphrase" #3876

mattrubin opened this issue Sep 9, 2018 · 0 comments

Comments

@mattrubin
Copy link
Contributor

  • I have searched open and closed issues for duplicates
  • I am submitting a bug report for existing functionality that does not work as intended
  • This isn't a feature request or a discussion topic

Bug description

As of the changes merged in 7dd6132, when installed and run for the first time on a clean device, the app crashes on launch with an uncaught exception: [OWSStorage.m:851 +[OWSStorage deleteDBKeys]]: could not remove legacy passphrase.

The cause of the crash is this newly-added code in +[OWSStorage deleteDBKeys] to delete the legacy passphrase:

NSError *_Nullable error;
BOOL result = [CurrentAppContext().keychainStorage removeWithService:keychainService
key:keychainDBLegacyPassphrase
error:&error];
if (error || !result) {
OWSFailDebug(@"could not remove legacy passphrase.");
}

The error originates inside of SSKDefaultKeychainStorage.remove(service:key:):

var error: NSError?
let result = SAMKeychain.deletePassword(forService: service, account: key, error: &error)
if let error = error {
throw KeychainStorageError.failure(description: "\(logTag) error removing data: \(error)")
}

When asked to delete a password that does not exist, the underlying keychain API used by +[SAMKeychain deletePasswordForService:account:error:] produces an error with the localized description "The specified item could not be found in the keychain". In this case, failing to delete a password because the password did not exist should not be considered an error. This particular error case needs to be caught and treated as a success.

Steps to reproduce

  • Launch the iOS Simulator, and reset the simulator with "Hardware > Erase All Content and Settings..."
  • Build and run the app at commit 7dd6132, or any later commit currently on the master branch.

Actual result: On launch, the app crashes with an uncaught exception: [OWSStorage.m:851 +[OWSStorage deleteDBKeys]]: could not remove legacy passphrase.

Expected result: The app should not crash when attempting to delete the legacy passphrase if the legacy passphrase does not exist. Following the above steps with the parent commit (0357699), the app will launch on a clean simulator without issue.

Device info

Device: iPhone X (simulator)
iOS version: iOS 11.4 (15F79)
Signal version: Development build at commit 7dd6132

mattrubin added a commit to mattrubin/Signal-iOS that referenced this issue Sep 9, 2018
charlesmchen-signal pushed a commit to mattrubin/Signal-iOS that referenced this issue Sep 18, 2018
michelle-signal pushed a commit that referenced this issue Jan 23, 2022
* conversation will not be updated if message draft is unchanged

* simplified message draft compare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant