Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

ModuleAPI: overwrite_login action was not stopping the existing client resulting in the action failing with rust-sdk #12272

Merged
merged 8 commits into from
Feb 22, 2024

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Feb 21, 2024

The rust-sdk is holding an active connection to the indexeddb database, so if the current crypto backend is not stopped it is not possible to delete the exisiting databases.
It works with the legacy crypto as it is just opening the database when needed.

Module using this API will have issues with rust crypto until this fix has landed.
The fix is to just call stopMatrixClient before calling doSetLoggedIn, like other flows are already doing it.

Fixes https://github.com/element-hq/crypto-internal/issues/175

References:
https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/deleteDatabase
When deleteDatabase() is called, any other open connections to this particular database will get a versionchange event.
=> The rust opened connection gets this event but doesn't react to it. So the delete action will call the onblocked callback and nothing will happen.

Additional note

The overwrite_login action is not going through the regular login flow, as it is hot-swaping credentials, so some crypto bootstrap flows are not currently executed (like bootstrap cross-signing or backup, and probably verification). For now users have to go to the settings to perforn them.

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

@BillCarsonFr BillCarsonFr added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems label Feb 21, 2024
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner February 21, 2024 17:27
@BillCarsonFr BillCarsonFr added this pull request to the merge queue Feb 22, 2024
Merged via the queue into develop with commit 8a70260 Feb 22, 2024
22 checks passed
@BillCarsonFr BillCarsonFr deleted the valere/fix_module_api_overwrite_login branch February 22, 2024 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants