Skip to content

Conversation

@G1gg1L3s
Copy link
Contributor

Right now every call to the GetPoison* creates keys, if they don't exist. These results in a superfluous side effect, unexpected behaviour and delays in decryption (because we try to check records with fresh keys, which obviously do nothing useful).

Change this, by:

  • Introducing new interface, which is responsible for poison key generation
  • Removing creation of keys in Get methods

Also, keep this behaviour for poisonrecordmaker, but do this explicitly.

Checklist

G1gg1L3s added 18 commits March 23, 2022 16:55
Double checked that it's not used anywhere
Right now it includes only one method:
`GeneratePoisonRecordSymmetricKey`, and it is a part of
`SymmetricEncryptionKeyStoreGenerator`. This interface in turn is
a part of:
- `StorageKeyGenerator`
- `KeyMaking`
- `ServerKeyStore`

Only `KeyMaking` uses the method for generating keys in keymaker.

So, extract separate interface dedicated solely to generation of
poison keys, in the same way as
`SymmetricEncryptionKeyStoreGenerator` is used for encryption
key generation.
And a bunch of stubs to implementors
Rename GeneratePoisonRecordSymmetricKey into
GeneratePoisonSymmetricKey to be more consistent with naming.
Also replace Get with Create in business logic code. Tests are not
touched yet.
Get* methods generate keys, if they don't find any. So, make them
return ErrKeysNotFound instead of generating keys in keystore v1.

Also, fix tests that rely on this behaviour.
The same as a previous commit, but for the keystore v2.
Copy link
Collaborator

@Lagovas Lagovas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@G1gg1L3s G1gg1L3s merged commit 9f0fc63 into master Mar 24, 2022
@G1gg1L3s G1gg1L3s deleted the G1gg1L3s/T2439-dont-generate-poison-keys branch March 24, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants