[v9.3.x] Encryption: Cache new DEKs (only) after a caution period (#62177)

Encryption: Cache new DEKs (only) after a caution period (#60664)

* Encryption: Cache new DEKs (only) after commit

* Fix typo

* Update secrets manager tests with new failing case

* Update secrets manager tests with new clarifications (comments)

* Correct broken method calls

* Unify methods

* Cache data keys only after a caution period

* Caution period for data keys caching only for encrypt ops

(cherry picked from commit c4e067d49d)

Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-01-26 11:31:42 +01:00
committed by GitHub
co-authored by Joan López de la Franca Beltran
parent 7ea31b5173
commit 6991330eda
7 changed files with 301 additions and 114 deletions
-6
View File
@@ -4,7 +4,6 @@ import (
"context"
"github.com/grafana/grafana/pkg/services/secrets"
"xorm.io/xorm"
)
type FakeSecretsStore struct {
@@ -47,11 +46,6 @@ func (f FakeSecretsStore) CreateDataKey(_ context.Context, dataKey *secrets.Data
return nil
}
func (f FakeSecretsStore) CreateDataKeyWithDBSession(_ context.Context, dataKey *secrets.DataKey, _ *xorm.Session) error {
f.store[dataKey.Id] = dataKey
return nil
}
func (f FakeSecretsStore) DisableDataKeys(_ context.Context) error {
for id := range f.store {
f.store[id].Active = false