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

chore: bulletproofing crypto box to cc migration (WPB-14250) (🍒4.6) #3677

Merged

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented Nov 27, 2024

StoryWPB-14250 [Android] implement fall guards for CC migration

This PR was automatically cherry-picked based on the following PR:

Original PR description:



PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

When enabling core crypto storage, if there are any Proteus clients, we need to migrate them from CryptoBox.
Things usually don't go as planned, so we need to have a recovery plan in place.

Causes (Optional)

There might be some errors while migrating.

Solutions

Implement a recovery plan for this case:

  • Catch possible exceptions from migration, we were not handling it and assuming success
  • Perform logout, using a new LogoutReason, so we can act (cleanup) accordingly
    • Cleanup local crypto files
    • Cleanup from Metadata all related client info (retained id, current id, prekeys, etc.)
    • Set the refresh token to needs update.

If everything goes smoothly, the user will be prompted to login again, preserving their local history.

Dependencies (Optional)

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

Notes (Optional)

Note

This approach seems "more correct", since if we try to create a new device only -as the ticket suggested- we will run into the issue of the refresh token not being valid anymore, since it was associated with the broken client that we were trying to migrate. And we can't associate the previous refresh token with a different client, we get a 403.

  • We will avoid other edge cases that we might not sure.
  • All login cases will be covered (2FA, SCIM, etc.)
  • We can expand this handling in the future (if we want) to other cases that we want to recover.

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

Copy link
Contributor

Test Results

863 tests   863 ✅  9m 15s ⏱️
119 suites    0 💤
119 files      0 ❌

Results for commit f3049fe.

Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

Copy link

sonarcloud bot commented Nov 28, 2024

@yamilmedina yamilmedina merged commit 340a103 into release/cycle-4.6 Nov 28, 2024
13 of 14 checks passed
@yamilmedina yamilmedina deleted the chore/bulletproofing-cbox-ccmigration-zulu branch November 28, 2024 14:51
Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants