Skip to content

fix(Examples): Validate EC on decrypt #697

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

Merged
merged 10 commits into from
Aug 19, 2024
Merged

fix(Examples): Validate EC on decrypt #697

merged 10 commits into from
Aug 19, 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 requested a review from a team as a code owner August 12, 2024 22:17
Copy link
Contributor

@RitvikKapila RitvikKapila left a comment

Choose a reason for hiding this comment

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

This looks good overall.
Two things:
First, do we not want to make the changes of providing the encryption context during decrypt in other migration examples? For instance:

  • migration_raw_rsa_key_example.py
  • migration_raw_aes_key_example.py
  • migration_aws_kms_key_example.py

I think we should, to point out explicitly that they should provide the encryption context while calling decrypt.

Second, I left another comment about the wording of the comment when providing encryption context.

Comment on lines 159 to 160
# Verify that the encryption context in the result contains the
# encryption context supplied to the encrypt method
Copy link
Contributor

Choose a reason for hiding this comment

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

According to Ryan, we want to tell the customer to always provide the encryption context during decrypt. I wonder if it'll be better if we remove the word "Verify" and just say "Enter the encryption context supplied to the encrypt method".

Same goes for Line #192 in this file and all other examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, I slightly preferred "Provide" instead of "Enter"

Good catch on migration examples, I updated those to supply EC on decrypt if decrypting with keyring.
I also added manual EC validation if decrypting with MKP since MKPs don't support EC validation on decrypt.

Copy link
Contributor

@RitvikKapila RitvikKapila left a comment

Choose a reason for hiding this comment

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

very small nit: I would change the name of the encrypted header, e.g., enc_header_mkp to encrypted_header_mkp just because we have the decrypted header variable as decrypted_header_keyring_using_mkp. However, it's not a big thing if we keep this as is.

Otherwise this LGTM. Approved.

@lucasmcdonald3 lucasmcdonald3 merged commit 1df7dbc into mpl-reviewed Aug 19, 2024
227 checks passed
@lucasmcdonald3 lucasmcdonald3 deleted the fix-ec branch August 19, 2024 20:06
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.

2 participants