Skip to content

Conversation

@etseidl
Copy link
Contributor

@etseidl etseidl commented Apr 1, 2025

Which issue does this PR close?

None

Rationale for this change

While working on #7369 I found an issue with doing suffix reads of the metadata coupled with encryption.

What changes are included in this PR?

Slice the footer off the buffer before passing it on to the decode function, as is done several lines below.

Added a test that fails if the change around line 713 is reverted.

Are there any user-facing changes?

No

@github-actions github-actions bot added the parquet Changes to the parquet crate label Apr 1, 2025
Comment on lines +714 to +716
// need to slice off the footer or decryption fails
self.decode_footer_metadata(&meta.slice(0..length), &footer)?,
None,
Copy link
Member

Choose a reason for hiding this comment

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

Does this indeed fail the added test if not changed? So it's not just adding a test it's fixing a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes...without this change the added test fails.

Copy link
Contributor

Choose a reason for hiding this comment

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

I verified that without this change the new test fails like this:

---- file::metadata::reader::async_tests::test_suffix_with_encryption stdout ----

thread 'file::metadata::reader::async_tests::test_suffix_with_encryption' panicked at parquet/src/file/metadata/reader.rs:1458:14:
called `Result::unwrap()` on an `Err` value: General("Provided footer key and AAD were unable to decrypt parquet footer")

@etseidl etseidl added the bug label Apr 1, 2025
@etseidl etseidl changed the title add test of suffix reads with encryption Fix bug in ParquetMetaDataReader and add test of suffix metadata reads with encryption Apr 1, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Comment on lines +714 to +716
// need to slice off the footer or decryption fails
self.decode_footer_metadata(&meta.slice(0..length), &footer)?,
None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I verified that without this change the new test fails like this:

---- file::metadata::reader::async_tests::test_suffix_with_encryption stdout ----

thread 'file::metadata::reader::async_tests::test_suffix_with_encryption' panicked at parquet/src/file/metadata/reader.rs:1458:14:
called `Result::unwrap()` on an `Err` value: General("Provided footer key and AAD were unable to decrypt parquet footer")

@etseidl etseidl merged commit ae524e7 into apache:main Apr 2, 2025
17 checks passed
@etseidl
Copy link
Contributor Author

etseidl commented Apr 2, 2025

Thanks everyone.

@etseidl etseidl deleted the suffix_read_with_encryption branch April 2, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants