Skip to content

Commit

Permalink
fix: remove double entry key use
Browse files Browse the repository at this point in the history
We called the use method of entry key twice: once from the
entrykeymanager and also when a read was successfull from the
entrymanager.
That caused an issue, that if the maxRead was not 1, then group members
might got no access to the key, because the remaining read counter was
zeroed before
  • Loading branch information
Ajnasz committed Apr 15, 2024
1 parent fb2ea97 commit 66eca62
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
4 changes: 0 additions & 4 deletions internal/services/entrykeymanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ func (e *EntryKeyManager) GetDEKTx(ctx context.Context, tx *sql.Tx, entryUUID st
return nil, nil, errors.New("model is nil")
}

if err := e.model.Use(ctx, tx, entryKeyModel.UUID); err != nil {
return nil, nil, err
}

return dek, modelEntryKeyToEntryKey(entryKeyModel), nil

}
Expand Down
1 change: 0 additions & 1 deletion internal/services/entrykeymanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ func TestEntryKeyManager_GetDEK(t *testing.T) {
Created: time.Now(),
},
}, nil)
model.On("Use", ctx, mock.Anything, "test-uuid").Return(nil)

crypto := func(key []byte) Encrypter {
return encrypter
Expand Down

0 comments on commit 66eca62

Please sign in to comment.