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) #3658

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented Nov 22, 2024

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


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

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

@@ -29,7 +29,7 @@
"default_backend_url_blacklist": "https://clientblacklist.wire.com/staging",
"default_backend_url_website": "https://wire.com",
"default_backend_title": "wire-staging",
"encrypt_proteus_storage": true,
"encrypt_proteus_storage": false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for dev this should be fine since it is not used as a daily driver by anyone

Copy link
Contributor

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

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.33%. Comparing base (740c99f) to head (6905f1c).
Report is 2 commits behind head on release/candidate.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           release/candidate    #3658      +/-   ##
=====================================================
- Coverage              45.34%   45.33%   -0.02%     
=====================================================
  Files                    471      471              
  Lines                  15842    15848       +6     
  Branches                2655     2656       +1     
=====================================================
  Hits                    7184     7184              
- Misses                  7885     7891       +6     
  Partials                 773      773              
Files with missing lines Coverage Δ
...n/com/wire/android/feature/AccountSwitchUseCase.kt 60.21% <ø> (ø)
...otlin/com/wire/android/ui/WireActivityViewModel.kt 71.33% <ø> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 740c99f...6905f1c. Read the comment docs.

Copy link
Contributor

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

@saleniuk saleniuk added this pull request to the merge queue Nov 27, 2024
Merged via the queue into release/candidate with commit a0c500a Nov 27, 2024
13 of 14 checks passed
@saleniuk saleniuk deleted the chore/bulletproofing-cc-migration-rc0 branch November 27, 2024 09:06
yamilmedina added a commit that referenced this pull request Nov 27, 2024
yamilmedina added a commit that referenced this pull request Nov 27, 2024
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.

5 participants