-
-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't run migration for Rust crypto if the legacy store is empty (#4218)
* Don't run migration for Rust crypto if the legacy store is empty Fixes element-hq/element-web#27447 * Add copyright for the TypeScript files in legacy DB dumps * Provide a type for the accountPickle we check for before migration * Remove redundant backup response This is unused * Simplify keys response * Downgrade log message. --------- Co-authored-by: Richard van der Hoff <[email protected]>
- Loading branch information
1 parent
7c87625
commit 909caab
Showing
8 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Dump of an empty libolm indexeddb cryptostore to test skipping migration | ||
|
||
A dump of an account which is almost completely empty, and totally unsuitable | ||
for use as a real account. | ||
|
||
This dump was manually created by copying and editing full_account. | ||
|
||
Created to test | ||
["Unable to restore session" error due due to half-initialised legacy indexeddb crypto store #27447](https://github.com/element-hq/element-web/issues/27447). | ||
We should not launch the Rust migration code when we find a DB in this state. |
14 changes: 14 additions & 0 deletions
14
spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/dump.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"account": [], | ||
"device_data": [], | ||
"inbound_group_sessions": [], | ||
"inbound_group_sessions_withheld": [], | ||
"notified_error_devices": [], | ||
"outgoingRoomKeyRequests": [], | ||
"parked_shared_history": [], | ||
"rooms": [], | ||
"session_problems": [], | ||
"sessions": [], | ||
"sessions_needing_backup": [], | ||
"shared_history_inbound_group_sessions": [] | ||
} |
35 changes: 35 additions & 0 deletions
35
spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Copyright 2024 The Matrix.org Foundation C.I.C. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import { DumpDataSetInfo } from "../index"; | ||
|
||
/** | ||
* A key query response containing the current keys of the tested user. | ||
* To be used during tests with fetchmock. | ||
*/ | ||
const KEYS_QUERY_RESPONSE = { device_keys: { "@emptyuser:example.com": {} } }; | ||
|
||
/** | ||
* A dataset containing the information for the tested user. | ||
* To be used during tests. | ||
*/ | ||
export const EMPTY_ACCOUNT_DATASET: DumpDataSetInfo = { | ||
userId: "@emptyuser:example.com", | ||
deviceId: "EMPTYDEVIC", | ||
pickleKey: "+/bcdefghijklmnopqrstu1/zyxvutsrqponmlkjih2", | ||
keyQueryResponse: KEYS_QUERY_RESPONSE, | ||
dumpPath: "spec/test-utils/test_indexeddb_cryptostore_dump/empty_account/dump.json", | ||
}; |
16 changes: 16 additions & 0 deletions
16
spec/test-utils/test_indexeddb_cryptostore_dump/full_account/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
spec/test-utils/test_indexeddb_cryptostore_dump/no_cached_msk_dump/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
spec/test-utils/test_indexeddb_cryptostore_dump/unverified/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters