mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +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()
|
newKeyring := b.keyring.Clone()
|
||||||
err := b.persistKeyringBestEffort(ctx, newKeyring)
|
err := b.persistKeyringBestEffort(ctx, newKeyring)
|
||||||
if err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
b.UnaccountedEncryptions.Sub(newEncs)
|
b.UnaccountedEncryptions.Sub(newEncs)
|
||||||
|
|||||||
Reference in New Issue
Block a user