Skip to content

Commit

Permalink
[PM-9619] Fix broken vault upon saving empty URI (#10037)
Browse files Browse the repository at this point in the history
* [PM-9619] Add null check for URI before validating checksum

* [PM-9619] Prevent saving empty string login URIs

(cherry picked from commit 2fe07f3)
  • Loading branch information
shane-melton committed Jul 9, 2024
1 parent 7230cb2 commit 5b41189
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions libs/common/src/vault/models/domain/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ export class Login extends Domain {
if (this.uris != null) {
view.uris = [];
for (let i = 0; i < this.uris.length; i++) {
// If the uri is null, there is nothing to decrypt or validate
if (this.uris[i].uri == null) {
continue;
}

const uri = await this.uris[i].decrypt(orgId, encKey);
// URIs are shared remotely after decryption
// we need to validate that the string hasn't been changed by a compromised server
Expand Down
2 changes: 1 addition & 1 deletion libs/common/src/vault/services/cipher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,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);
model.login.uris = model.login.uris.filter((u) => u.uri != null && u.uri !== "");
for (let i = 0; i < model.login.uris.length; i++) {
const loginUri = new LoginUri();
loginUri.match = model.login.uris[i].match;
Expand Down

0 comments on commit 5b41189

Please sign in to comment.