-
Notifications
You must be signed in to change notification settings - Fork 20
chore(dafny): Test hv1 to hv2 mutation #1461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ws/aws-cryptographic-material-providers-library into rishav/hv-2/M2/addhv1tohv2Test
…ws/aws-cryptographic-material-providers-library into rishav/hv-2/M2/addhv1tohv2Test
This reverts commit e202c04.
| const KmsSrkConfigWest : Types.KMSConfiguration := Types.KMSConfiguration.kmsKeyArn(MrkArnWest) | ||
| const KmsMrkConfigAP : Types.KMSConfiguration := Types.KMSConfiguration.kmsMRKeyArn(MrkArnAP) | ||
| const KmsMrkEC : Types.EncryptionContext := map[UTF8.EncodeAscii("abc") := UTF8.EncodeAscii("123")] | ||
| const RobbieEC : Types.EncryptionContext := map[UTF8.EncodeAscii("Robbie") := UTF8.EncodeAscii("is a dog.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This did not break any test because this was only used in create keys
| var encryptRes :- expect KMSKeystoreOperations.EncryptKey( | ||
| plainTextTuple, | ||
| HVUtils.SelectKmsEncryptionContextForHv2(terminalBKC), | ||
| item.EncryptionContext[Structure.KMS_FIELD], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item will be overwritten with new mutation properties on Structure.ConstructEncryptedHierarchicalKey (line 605). So, using item.* won't work
| expect "type" in item.EncryptionContext, "Decrypt Only item is missing 'type' from EC!!"; | ||
| verifyTerminalProperties(item.EncryptionContext, expectedEncryptionContext, expectedKmsArn); | ||
|
|
||
| // Get branchKeyVersion from storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keystore returns EC send to KMS (customer send EC without transformation) but storage returns a "actual" EC (with transformation)
| include "AdminFixtures.dfy" | ||
| include "Mutations/TestMutationHappyPath.dfy" | ||
|
|
||
| // TODO-HV-2-M2: Move this to ./Mutations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did it in this PR but the Github was showing diff as whole file which makes reviewer's life hard. So, doing this right after this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay removing dead code
| HVUtils.SelectKmsEncryptionContextForHv2(terminalBKC), | ||
| item.EncryptionContext[Structure.KMS_FIELD], | ||
| KmsUtils.KmsSymmetricKeyArnToKMSConfiguration(Types.KmsSymmetricKeyArn.KmsKeyArn(item.KmsArn)), | ||
| terminalBKC[Structure.KMS_FIELD], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would move
terminalBKC[Structure.KMS_FIELD] to a variable above
and call it
var terminalBKCKmsArn := terminalBKC[Structure.KMS_FIELD]
josecorella
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Issue #, if available:
Description of changes:
Squash/merge commit message, if applicable:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.