1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

Use local storage for browser's secure storage (#8231)

UI warns the user whenever using secure storage in browser that it's
insecure. This is not a change from the current background behavior,
just uses the already existing services in each context.
This commit is contained in:
Matt Gibson
2024-03-11 16:51:09 -05:00
committed by GitHub
parent 747e6cebe2
commit 51df81393d
2 changed files with 2 additions and 2 deletions

View File

@@ -352,7 +352,7 @@ export default class MainBackground {
this.cryptoFunctionService = new WebCryptoFunctionService(self); this.cryptoFunctionService = new WebCryptoFunctionService(self);
this.keyGenerationService = new KeyGenerationService(this.cryptoFunctionService); this.keyGenerationService = new KeyGenerationService(this.cryptoFunctionService);
this.storageService = new BrowserLocalStorageService(); this.storageService = new BrowserLocalStorageService();
this.secureStorageService = new BrowserLocalStorageService(); this.secureStorageService = this.storageService; // secure storage is not supported in browsers, so we use local storage and warn users when it is used
this.memoryStorageService = BrowserApi.isManifestVersion(3) this.memoryStorageService = BrowserApi.isManifestVersion(3)
? new LocalBackedSessionStorageService( ? new LocalBackedSessionStorageService(
new EncryptServiceImplementation(this.cryptoFunctionService, this.logService, false), new EncryptServiceImplementation(this.cryptoFunctionService, this.logService, false),

View File

@@ -417,7 +417,7 @@ function getBgService<T>(service: keyof MainBackground) {
}, },
{ {
provide: SECURE_STORAGE, provide: SECURE_STORAGE,
useFactory: getBgService<AbstractStorageService>("secureStorageService"), useExisting: AbstractStorageService, // Secure storage is not available in the browser, so we use normal storage instead and warn users when it is used.
}, },
{ {
provide: MEMORY_STORAGE, provide: MEMORY_STORAGE,