YusefSyed opened a new pull request, #51693: URL: https://github.com/apache/arrow/pull/51693
### Rationale for this change Fixes #51669. With `AES_GCM_CTR_V1` and a plaintext footer, the writer encrypts data pages with CTR but records `AES_GCM_V1` in `FileMetaData.encryption_algorithm`. A reader consequently uses the wrong file algorithm and cannot read an otherwise successful write. ### What changes are included in this PR? Record the configured file algorithm in plaintext-footer metadata. Footer signing and verification continue to use the existing metadata cipher path. Add native checks for the recorded algorithm, synchronous/asynchronous reads, wrong-key rejection, and tampered footer signatures; extend the Python direct-key test across both algorithms and footer modes. ### Are these changes tested? - Compiled the unchanged native baseline with the new regression: it failed on the CTR algorithm metadata and data read. - Compiled the correction: the native encryption suite passed **34 tests**, including existing encrypted-footer and AAD controls. The focused regression also passed after the final comment clarification. - Verified the test executable loads the locally built Arrow and Parquet libraries. - C++ formatting, repository-configured Python lint, and `git diff --check` passed. - The exact-source PyArrow build and Python regression matrix are still running locally; this PR remains draft during that validation. The installed-wheel reproduction is not counted as validation of the C++ correction. Native test command, after building `parquet-encryption-test` with encryption enabled: ```sh PARQUET_TEST_DATA=/path/to/parquet-testing/data /path/to/build/release/parquet-encryption-test ``` Validation so far is on macOS arm64. No Windows/Linux local result or live KMS result is claimed. ### Are there any user-facing changes? New plaintext-footer files written with `AES_GCM_CTR_V1` carry the correct algorithm metadata. Existing malformed files are not repaired automatically. Public APIs are unchanged. **This PR contains a "Critical Fix"** under the template's invalid-data criterion: affected writes produced inconsistent encryption metadata and unreadable files. This is not a claim of a newly demonstrated security vulnerability. ### Was AI used for this PR? **PR code and description written by:** - [ ] Human - [x] AI **Reviewed before submission by:** - [ ] Human - [x] AI - [ ] Not reviewed Codex assisted with investigation, implementation, regression tests, and this description. The main Codex agent reviewed the production/test diff, the file-algorithm versus metadata-cipher distinction, and the recorded native test results. No human review or test execution is asserted on the submitter's behalf. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
