Fix cipher filter

This commit is contained in:
Bernd Schoolmann 2023-08-21 19:53:17 +02:00
parent 22072a7a05
commit 917f875a42
No known key found for this signature in database
1 changed files with 10 additions and 2 deletions

View File

@ -305,7 +305,11 @@ func (vault *Vault) GetLoginByFilter(uuid string, orgId string, name string, use
log.Warn().Err(err).Msg("Failed to get key for cipher " + cipher.ID.String())
continue
}
if name != "" && !cipher.Name.IsNull() {
if name != "" {
if cipher.Name.IsNull() {
continue
}
decryptedName, err := crypto.DecryptWith(cipher.Name, key)
if err != nil {
log.Warn().Err(err).Msg("Failed to decrypt name for cipher " + cipher.ID.String())
@ -316,7 +320,11 @@ func (vault *Vault) GetLoginByFilter(uuid string, orgId string, name string, use
}
}
if username != "" && !cipher.Login.Username.IsNull() {
if username != "" {
if cipher.Login.Username.IsNull() {
continue
}
decryptedUsername, err := crypto.DecryptWith(cipher.Login.Username, key)
if err != nil {
log.Warn().Err(err).Msg("Failed to decrypt username for cipher " + cipher.ID.String())