Skip to content
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

fix: Update DecryptionMaterials code to support legacy custom CMMs #2037

Merged
merged 19 commits into from
Jun 11, 2024

Conversation

lucasmcdonald3
Copy link
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@lucasmcdonald3 lucasmcdonald3 marked this pull request as ready for review June 10, 2024 23:48
@lucasmcdonald3 lucasmcdonald3 requested a review from a team as a code owner June 10, 2024 23:48
texastony
texastony previously approved these changes Jun 11, 2024
Copy link
Contributor

@texastony texastony left a comment

Choose a reason for hiding this comment

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

Lucas, you nailed it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Praise: These are excellent unit tests with clear and concise docs strings to describe what they test and how.

seebees
seebees previously approved these changes Jun 11, 2024
Copy link
Contributor

@seebees seebees left a comment

Choose a reason for hiding this comment

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

I know you will need it again, but it looks good

Comment on lines 30 to 44
/*
This is a copy-paste of the DefaultCryptoMaterialsManager implementation
from the final commit of the V2 ESDK: 1870a082358d59e32c60d74116d6f43c0efa466b
ESDK V3 implicitly changed the contract between CMMs and the ESDK.
After V3, DecryptMaterials has an `encryptionContext` attribute,
and CMMs are expected to set this attribute.
The V3 commit modified this DefaultCMM's `decryptMaterials` implementation
to set encryptionContext on returned DecryptionMaterials objects.
However, there are custom implementations of the legacy native CMM
that do not set encryptionContext.
This CMM is used to explicitly assert that the V2 implementation of
the DefaultCMM is compatible with V3 logic,
which implicitly asserts that custom implementations of V2-compatible CMMs
are also compatible with V3 logic.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice comment.

@lucasmcdonald3 lucasmcdonald3 dismissed stale reviews from seebees and texastony via abfc8d9 June 11, 2024 16:10
@lucasmcdonald3 lucasmcdonald3 changed the title fix: DecryptionMaterials defaults to empty encryption context fix: Update DecryptionMaterials code to support legacy custom CMMs Jun 11, 2024
Copy link
Contributor

@seebees seebees left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 18 to 21

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Test;
Copy link
Contributor

Choose a reason for hiding this comment

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

TBH, I prefer that we keep these. But I don't know how to make that work, or want to block on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are keeping these! They just got moved to the top of the file in checkstyle reformatting

@lucasmcdonald3 lucasmcdonald3 merged commit 8807d79 into master Jun 11, 2024
45 checks passed
@lucasmcdonald3 lucasmcdonald3 deleted the fix-2x-cmm branch June 11, 2024 17:29
josecorella pushed a commit that referenced this pull request Jun 12, 2024
## [3.0.1](v3.0.0...v3.0.1) (2024-06-12)

### Fixes

* Add Locale.ROOT to String uppercase conversions ([#1880](#1880)) ([9a9950e](9a9950e)), closes [#1879](#1879)
* Update DecryptionMaterials code to support legacy custom CMMs ([#2037](#2037)) ([8807d79](8807d79))

### Maintenance

* deprecate getMasterKeyIds() in CryptoResult ([#1976](#1976)) ([1890ebb](1890ebb))
* **deps:** bump bcprov-jdk18on from 1.77 to 1.78.1 ([#2032](#2032)) ([713ca11](713ca11))
* **deps:** udpate org.bouncycastle to bcprov-jdk18on ([#1891](#1891)) ([32a92a9](32a92a9))
* **deps:** update dependencies ([#1973](#1973)) ([800bd01](800bd01))
* **Examples:** Customize KMS Client ([#2001](#2001)) ([e94ee85](e94ee85))
* fix release script ([#1912](#1912)) ([57e8a0b](57e8a0b))
* **README:** update README.md ([#1940](#1940)) ([7a0899e](7a0899e))
* update node version in version step ([#1959](#1959)) ([905385d](905385d))
* Update SUPPORT_POLICY.rst ([#1924](#1924)) ([57e40b5](57e40b5))
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