xanderbailey opened a new pull request, #3700:
URL: https://github.com/apache/iceberg-rust/pull/3700

   ## Which issue does this PR close?
   
   - Part of #3506. PyIceberg checks the AGS1 header today, so moving its 
stream decryption onto pyiceberg-core would otherwise drop the check.
   
   ## What changes are included in this PR?
   
   `AesGcmFileRead` never read the 8-byte AGS1 header, so a stream with the 
wrong magic or an unsupported plaintext block size decrypted as if it were 
valid. Java's 
[`AesGcmInputStream.validateHeader`](https://github.com/apache/iceberg/blob/d31f6435926425ad1e4216871e405cacf10cd6b3/core/src/main/java/org/apache/iceberg/encryption/AesGcmInputStream.java#L71-L85)
 rejects both.
   
   The header is not authenticated, so a read that covers the first block now 
includes the header in its single I/O call and checks it before decrypting. 
Reads that start past the first block are unchanged.
   
   ## Are these changes tested?
   
   Yes, a unit test for a wrong magic and an unsupported block size.
   
   ## AI Disclosure
   
   Written with Claude Code. The main assumption to check: the header is only 
checked on reads that cover block 0, not once per reader, because 
`FileRead::read` takes `&self`. Whole-file reads such as manifests and manifest 
lists always cover block 0.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to