Skip to content

Add decryption functionality to presto#17728

Closed
shangxinli wants to merge 1 commit intoprestodb:masterfrom
shangxinli:column_indexes_dev_new_4
Closed

Add decryption functionality to presto#17728
shangxinli wants to merge 1 commit intoprestodb:masterfrom
shangxinli:column_indexes_dev_new_4

Conversation

@shangxinli
Copy link
Copy Markdown
Collaborator

Co-authored-by: ggershinsky ggershinsky@users.noreply.github.com

Summary: This is to port parquet-mr decryption funtionality. The main commits in parquet-mr for encryption/decryption is apache/parquet-java@65b95fb and several other fixes. This change only port the decryption only.

Test plan - (Please fill in how you tested your changes)

Please make sure your submission complies with our Development, Formatting, and Commit Message guidelines. Don't forget to follow our attribution guidelines for any code copied from other projects.

Fill in the release notes towards the bottom of the PR description.
See Release Notes Guidelines for details.

== RELEASE NOTES ==

General Changes
* ...
* ...

Hive Changes
* ...
* ...

If release note is NOT required, use:

== NO RELEASE NOTE ==

@shangxinli shangxinli requested a review from a team as a code owner May 4, 2022 05:27
@shangxinli shangxinli requested a review from presto-oss May 4, 2022 05:27
@shangxinli shangxinli force-pushed the column_indexes_dev_new_4 branch 5 times, most recently from 18e2f98 to 3535aa3 Compare May 5, 2022 15:22
@shangxinli
Copy link
Copy Markdown
Collaborator Author

shangxinli commented May 5, 2022

@beinan @zhenxiao I just opened this new PR because of the conflict. I close the old PR.

BTW, the CI build sometime has the error 'No configuration was found in your project. Please refer to https://circleci.com/docs/2.0/ to get started with your configuration.', which seems unrelated to my change. Please let me know if this is not the case.

@shangxinli shangxinli force-pushed the column_indexes_dev_new_4 branch 2 times, most recently from 4932cb3 to 3283ad8 Compare May 6, 2022 14:40
@highker highker requested a review from kewang1024 May 8, 2022 08:05
Copy link
Copy Markdown
Collaborator

@zhenxiao zhenxiao left a comment

Choose a reason for hiding this comment

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

nice work, @shangxinli
mostly looks good. A few minor things

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is it possible we import MAGIC and EMAGIC from Parquet code?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think we can do.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how about we add comment for aad:
additional authenticated data for AES cipher

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea! Just added for this one and PageReader.java

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the comment is misleading, how about:
detect files not encrypted but with fileDecryptor set

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changed it to 'Detect that the file is not encrypted by mistake'.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how about adding comment to this case:
plaintext footer, with file is crypt

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added the comments "Reader attached fileDecryptor. The file could be encrypted with plaintext footer or the whole file is plaintext".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

keep this line before encryptedFooter and fileDecryptor check

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

...improve it later

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shall we add a log in case of KeyAccessDeniedException?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, Let me figure out how to add it. Not see log4j being used in Presto-Parquet project.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It seems we need to add the following dependency to the subproject if we want to log in presto-parquet. I am afraid of doing that because just for adding this line of log, we need to add a new dependency. Please let me know you. thoughts

com.facebook.airlift log

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

static import AesCipher.NONCE_LENGTH and AesCipher.GCM_TAG_LENGTH?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Make sense!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

put final variables together

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yeah

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/colDecSetup/columnDecryption/g

Copy link
Copy Markdown
Collaborator Author

@shangxinli shangxinli May 9, 2022

Choose a reason for hiding this comment

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

make sense!

Copy link
Copy Markdown
Member

@beinan beinan left a comment

Choose a reason for hiding this comment

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

lgtm except a couple of very minor issues

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unnecessary this

Suggested change
return this.fileName;
return fileName;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unnecessary this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

removed

Comment on lines 47 to 48
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

inline fileSize?

Suggested change
long fileSize = path.getFileSystem(new Configuration()).getFileStatus(path).getLen();
return fileSize;
return path.getFileSystem(new Configuration()).getFileStatus(path).getLen();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

sure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unnecessary this

Suggested change
throw new HiddenColumnException(this.path.toArray(), this.filePath);
throw new HiddenColumnException(path.toArray(), filePath);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changegd

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unnecessary this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

channged

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unnecessary this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (null != headerBlockDecryptor) {
if (headerBlockDecryptor != null) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changed

@shangxinli
Copy link
Copy Markdown
Collaborator Author

@zhenxiao @beinan Any idea why "ci/circleci: Build Error". The error says 'No configuration was found in your project', but my change doesn't change anything in terms of the project's configuration. I only changed java code. Any idea on how to fix that?

@shangxinli
Copy link
Copy Markdown
Collaborator Author

shangxinli commented May 16, 2022

I just created a very simple PR and then revert it. So everything should pass, but I still get the same error "ci/circleci: Build Error". I assume this error is not related to my change. Given all other tests and checks passed, I assume my change should be clean now. Let me know if this is not the case.

@zhenxiao
Copy link
Copy Markdown
Collaborator

hi @shangxinli I think your code should be good. While, we do require all tests passed before any code could merge. Could you please squash all commits into one, and submit under this PR again?

Co-authored-by: ggershinsky <ggershinsky@users.noreply.github.com>

Summary: This is to port parquet-mr decryption funtionality. The main commits in parquet-mr for encryption/decryption are apache/parquet-java@65b95fb and several other fixes. This change only port the decryption only.
@shangxinli shangxinli force-pushed the column_indexes_dev_new_4 branch from 56031ca to 475c896 Compare May 17, 2022 18:59
@shangxinli
Copy link
Copy Markdown
Collaborator Author

Just did it, thanks @zhenxiao @beinan for review.

@beinan
Copy link
Copy Markdown
Member

beinan commented May 18, 2022

the ci/circleci is still failing, hmmm I cannot rerun this one. But the code looks good to me. @zhenxiao are you able to rerun the ci/circleci?

@zhenxiao
Copy link
Copy Markdown
Collaborator

the same to me. Could not rerun it. maybe we submit the code as a new PR, and see how it goes? @shangxinli @beinan

@shangxinli
Copy link
Copy Markdown
Collaborator Author

@zhenxiao I have created another PR with no change. The ci/circleci still failed.

@aweisberg Can you help with the ci/circleci issue?

@mshang816 Do you think it could be related to 59f86ca?

@shangxinli
Copy link
Copy Markdown
Collaborator Author

Re-created a new PR #17791

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