mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-21 11:35:34 +01:00
Auth/PM-5501 - VaultTimeoutSettingsSvc State Provider Migration - Cleanup desktop orphaned data (#9277)
* PM-5501 - Remove global vault timeout data on desktop to avoid orphaning the data. * PM-5501 - Test new migration logic.
This commit is contained in:
parent
56c4be4f1a
commit
00db087cee
@ -13,6 +13,10 @@ import {
|
||||
// Represents data in state service pre-migration
|
||||
function preMigrationJson() {
|
||||
return {
|
||||
// desktop only global data format
|
||||
"global.vaultTimeout": -1,
|
||||
"global.vaultTimeoutAction": "lock",
|
||||
|
||||
global: {
|
||||
vaultTimeout: 30,
|
||||
vaultTimeoutAction: "lock",
|
||||
@ -267,6 +271,10 @@ describe("VaultTimeoutSettingsServiceStateProviderMigrator", () => {
|
||||
otherStuff: "otherStuff",
|
||||
});
|
||||
|
||||
// Expect we removed desktop specially formatted global data
|
||||
expect(helper.remove).toHaveBeenCalledWith("global\\.vaultTimeout");
|
||||
expect(helper.remove).toHaveBeenCalledWith("global\\.vaultTimeoutAction");
|
||||
|
||||
// User data
|
||||
expect(helper.set).toHaveBeenCalledWith("user1", {
|
||||
settings: {
|
||||
|
@ -122,10 +122,15 @@ export class VaultTimeoutSettingsServiceStateProviderMigrator extends Migrator<6
|
||||
|
||||
await Promise.all([...accounts.map(({ userId, account }) => migrateAccount(userId, account))]);
|
||||
|
||||
// Delete global data
|
||||
// Delete global data (works for browser extension and web; CLI doesn't have these as global settings).
|
||||
delete globalData?.vaultTimeout;
|
||||
delete globalData?.vaultTimeoutAction;
|
||||
await helper.set("global", globalData);
|
||||
|
||||
// Remove desktop only settings. These aren't found by the above global key removal b/c of
|
||||
// the different storage key format. This removal does not cause any issues on migrating for other clients.
|
||||
await helper.remove("global\\.vaultTimeout");
|
||||
await helper.remove("global\\.vaultTimeoutAction");
|
||||
}
|
||||
|
||||
async rollback(helper: MigrationHelper): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user