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

Element-R: Fix rust migration when ssss secret are stored not encryted in cache (old legacy behavior) #4168

Merged

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Apr 17, 2024

Fixes element-hq/element-desktop#1603

Some old session might have stored the ssss cached secret in clear form (raw UInt8Array). The existing migration code will fail on such sessions with

TypeError: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined
    ...
    at async getAndDecryptCachedSecretKey (vector://vector/webapp/bundles/1d2e934471ebcb41f3e7/865.js:4549:44)

Updated the migration's getAndDecryptCachedSecretKey to support both cases similar to

if (key && key.ciphertext) {

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

@BillCarsonFr BillCarsonFr changed the title Fix rust migration when ssss secret not encrypted Element-R: Fix rust migration when ssss secret are stored not encryted in cache (old legacy behavior) Apr 17, 2024
@BillCarsonFr BillCarsonFr marked this pull request as ready for review April 17, 2024 13:37
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner April 17, 2024 13:37
Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@BillCarsonFr BillCarsonFr added this pull request to the merge queue Apr 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 26, 2024
@BillCarsonFr BillCarsonFr added this pull request to the merge queue Apr 26, 2024
Merged via the queue into develop with commit 65d858f Apr 26, 2024
57 checks passed
@BillCarsonFr BillCarsonFr deleted the valere/element-r/migration_support_clear_ssss_secret branch April 26, 2024 13:21
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.

"Unable to restore session" on 2024040401 nightly
2 participants