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

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()) log.Warn().Err(err).Msg("Failed to get key for cipher " + cipher.ID.String())
continue continue
} }
if name != "" && !cipher.Name.IsNull() { if name != "" {
if cipher.Name.IsNull() {
continue
}
decryptedName, err := crypto.DecryptWith(cipher.Name, key) decryptedName, err := crypto.DecryptWith(cipher.Name, key)
if err != nil { if err != nil {
log.Warn().Err(err).Msg("Failed to decrypt name for cipher " + cipher.ID.String()) 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) decryptedUsername, err := crypto.DecryptWith(cipher.Login.Username, key)
if err != nil { if err != nil {
log.Warn().Err(err).Msg("Failed to decrypt username for cipher " + cipher.ID.String()) log.Warn().Err(err).Msg("Failed to decrypt username for cipher " + cipher.ID.String())