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) 🍒 #3678

Merged
merged 3 commits into from
Nov 28, 2024

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.

@echoes-hq echoes-hq bot added the echoes/initiative: federation-wire-cloud Activate Federation with MLS on Wire Cloud label Nov 27, 2024
@yamilmedina yamilmedina changed the title chore: bulletproofing crypto box to cc migration (WPB-14250) chore: bulletproofing crypto box to cc migration (WPB-14250) 🍒 Nov 27, 2024
Copy link

sonarcloud bot commented Nov 28, 2024

@yamilmedina yamilmedina added this pull request to the merge queue Nov 28, 2024
Copy link
Contributor

Built wire-android-staging-compat-pr-3678.apk is available for download

Copy link
Contributor

Built wire-android-dev-debug-pr-3678.apk is available for download

Merged via the queue into develop with commit bbded96 Nov 28, 2024
12 of 13 checks passed
@yamilmedina yamilmedina deleted the chore/bulletproofing-cbox-ccmigration-dev branch November 28, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes/initiative: federation-wire-cloud Activate Federation with MLS on Wire Cloud size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants