mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
Undo additions to the barrier encryption count if persisting those encryptions fails (#29506)
* Undo additions to the barrier encryption count if persisting those encryptions fails * changelog
This commit is contained in:
3
changelog/29506.txt
Normal file
3
changelog/29506.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
core: Fix bug when if failing to persist the barrier keyring to track encryption counts, the number of outstanding encryptions remains added to the count, overcounting encryptions.
|
||||
```
|
||||
@@ -1281,6 +1281,8 @@ func (b *AESGCMBarrier) persistEncryptions(ctx context.Context) error {
|
||||
newKeyring := b.keyring.Clone()
|
||||
err := b.persistKeyringBestEffort(ctx, newKeyring)
|
||||
if err != nil {
|
||||
// because Keys are pointer addressed, we need to undo the update to the Encryption count here
|
||||
activeKey.Encryptions -= uint64(newEncs)
|
||||
return err
|
||||
}
|
||||
b.UnaccountedEncryptions.Sub(newEncs)
|
||||
|
||||
Reference in New Issue
Block a user