mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-09 00:33:28 -04:00
Backport Detect errors when writing totp keys to storage into release/2.x.x+ent into ce/release/2.x.x (#14786)
Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
This commit is contained in:
parent
b62aa75129
commit
af9b72717c
2 changed files with 6 additions and 3 deletions
3
changelog/_14778.txt
Normal file
3
changelog/_14778.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
core: Fix failure to detect errors during storage writes of totp keys.
|
||||
```
|
||||
|
|
@ -1097,13 +1097,13 @@ func (c *Core) PersistTOTPKey(ctx context.Context, methodID, entityID, key strin
|
|||
}
|
||||
val, err := jsonutil.EncodeJSON(ks)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("error encoding TOTP key: %w", err)
|
||||
}
|
||||
if c.barrier.Put(ctx, &logical.StorageEntry{
|
||||
if err := c.barrier.Put(ctx, &logical.StorageEntry{
|
||||
Key: fmt.Sprintf("%s%s/%s", mfaTOTPKeysPrefix, methodID, entityID),
|
||||
Value: val,
|
||||
}); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("error persisting TOTP key to storage: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue