1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

Vault/pm-4185/checksum uris (#6485)

* Validate checksum on decrypt of URI

* Add uri checksum to domain during encryption

* Move hash to stateless encrypt service

* Add checksum field to all the other models necessary for syncing with server

* Remove old test in favor of `describe` block

* PM-4185 Added a boolean to control checksum validation

* PM-4185 Fi unit tests

* [PM-4810][PM-4825][PM-4880] Fix encrypted import and add null check (#6935)

* PM-4810 Bumped up version

* PM-4880 Add null check

* PM-4825 Fix encrypted export

* PM-5462 Fix item saving with blank URI (#7640)

* PM-4185 Add back uriChecksum setting

---------

Co-authored-by: Carlos Gonçalves <cgoncalves@bitwarden.com>
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: gbubemismith <gsmithwalter@gmail.com>
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
This commit is contained in:
Matt Gibson
2024-01-24 12:22:58 -05:00
committed by GitHub
parent 622791307a
commit af0d2f515d
14 changed files with 192 additions and 46 deletions

View File

@@ -50,7 +50,7 @@ import { CipherView } from "../models/view/cipher.view";
import { FieldView } from "../models/view/field.view";
import { PasswordHistoryView } from "../models/view/password-history.view";
const CIPHER_KEY_ENC_MIN_SERVER_VER = new SemVer("2023.9.1");
const CIPHER_KEY_ENC_MIN_SERVER_VER = new SemVer("2023.12.0");
export class CipherService implements CipherServiceAbstraction {
private sortedCiphersCache: SortedCiphersCache = new SortedCiphersCache(
@@ -1127,6 +1127,7 @@ export class CipherService implements CipherServiceAbstraction {
if (model.login.uris != null) {
cipher.login.uris = [];
model.login.uris = model.login.uris.filter((u) => u.uri != null);
for (let i = 0; i < model.login.uris.length; i++) {
const loginUri = new LoginUri();
loginUri.match = model.login.uris[i].match;
@@ -1138,6 +1139,8 @@ export class CipherService implements CipherServiceAbstraction {
},
key,
);
const uriHash = await this.encryptService.hash(model.login.uris[i].uri, "sha256");
loginUri.uriChecksum = await this.cryptoService.encrypt(uriHash, key);
cipher.login.uris.push(loginUri);
}
}