Implementing checksum validation for single-part and multipart downloads#3641
Implementing checksum validation for single-part and multipart downloads#3641
Conversation
…le-part downloads
…into download-checksums
be9c560 to
c469928
Compare
… into download-checksums
c469928 to
ee58639
Compare
…hmap of multipart download part checksums and updating the check lock for full body checksum
… into download-checksums
767a686 to
6ff87ee
Compare
32aef6a to
960c424
Compare
… into download-checksums
960c424 to
1b1feaf
Compare
dbbb1a0 to
52768a5
Compare
| Aws::String errMsg{handle->WritePartToDownloadStream(bufferStream, partState->GetRangeBegin())}; | ||
| if (errMsg.empty()) { | ||
| if (!outcome.GetResult().GetChecksumCRC32().empty()) { | ||
| partState->SetChecksum(outcome.GetResult().GetChecksumCRC32()); |
There was a problem hiding this comment.
do we still need this part now? we are double reading the stream as required now?
There was a problem hiding this comment.
I put this back to avoid reading the stream for unit tests. Is there a cleaner approach?
There was a problem hiding this comment.
I've updated the tests to handle this properly, so I was able to remove this code.
| @@ -1,13 +1,23 @@ | |||
| #ifdef _WIN32 | |||
There was a problem hiding this comment.
why do we need this? feels like this test shoudlnt need to know if its on windows or not
| HeadObjectResult result; | ||
| result.SetContentLength(78643200); | ||
| result.SetChecksumCRC64NVME(FULL_OBJECT_CHECKSUM); | ||
| result.SetChecksumType(Aws::S3::Model::ChecksumType::FULL_OBJECT); // This is key! |
There was a problem hiding this comment.
// This is key!
Lets improve the comment or remove it
| config.bufferSize = 5242880; // 5MB to ensure multipart | ||
| auto transferManager = TransferManager::Create(config); | ||
|
|
||
| // Create a temporary file for download since multipart needs seekable stream |
There was a problem hiding this comment.
oh we have a type for a "temp file" so you can remove this all together, see TempFile for usage. We use it in tests in loads of places.
i think you should be able to get rid of your windows specific paths if you use that instead.
1699cc9 to
3361c0f
Compare
3361c0f to
8f8a410
Compare
Description of changes:
Implemented per-part checksum validation for downloads in TransferManager. Added validateChecksums flag (default: true) to TransferManagerConfiguration. Downloads now validate checksums for both single-part (via file read after download) and multipart transfers (per-part validation). Created GetChecksumFromResult() helper to reduce code duplication. Downloads fail immediately on checksum mismatch.
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.