1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

[PM-26302] Extension when launching a website from a vault item autofill fills wrong cipher (#16810)

* PM-26302 create helper that will assign local data to ciphers and cached ciphers on decryption

* remove helper and call local data only on get cipher for url to make operation less expensive

* add tests for local data using functions that call the getcipherforurl function

* reorder to have early null check
This commit is contained in:
Daniel Riera
2025-10-20 10:34:21 -04:00
committed by GitHub
parent 44ce303181
commit 7dcd3fa603
2 changed files with 83 additions and 2 deletions

View File

@@ -1947,13 +1947,23 @@ export class CipherService implements CipherServiceAbstraction {
autofillOnPageLoad: boolean,
): Promise<CipherView> {
const cacheKey = autofillOnPageLoad ? "autofillOnPageLoad-" + url : url;
if (!this.sortedCiphersCache.isCached(cacheKey)) {
let ciphers = await this.getAllDecryptedForUrl(url, userId);
if (!ciphers) {
if (!ciphers?.length) {
return null;
}
const localData = await firstValueFrom(this.localData$(userId));
if (localData) {
for (const view of ciphers) {
const data = localData[view.id as CipherId];
if (data) {
view.localData = data;
}
}
}
if (autofillOnPageLoad) {
const autofillOnPageLoadDefault = await this.getAutofillOnPageLoadDefault();