Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist checksums for parts, validate on multipart completion #1205

Closed
afranken opened this issue Jul 4, 2023 · 6 comments
Closed

Persist checksums for parts, validate on multipart completion #1205

afranken opened this issue Jul 4, 2023 · 6 comments
Assignees
Labels

Comments

@afranken
Copy link
Member

afranken commented Jul 4, 2023

While implementing support for checksums for objects (see #1123 ), I could not implement checksum support for parts as well without major refactorings.

S3Mock currently does not store metadata for parts during a multipart upload, multipart handling (in the MultipartService / MultipartStore) needs to be completely refactored so checksum support can be implemented.

See
https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html
https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html#AmazonS3-ListParts-response-Parts
https://docs.aws.amazon.com/AmazonS3/latest/API/API_Part.html
https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompletedPart.html

@afranken afranken self-assigned this Jul 4, 2023
afranken added a commit that referenced this issue Jul 4, 2023
Can't finish Multipart support for checksums, we currently do not
persist metadata for parts in a way that would let me add checksums.
See #1205
afranken added a commit that referenced this issue Jul 4, 2023
Can't finish Multipart support for checksums, we currently do not
persist metadata for parts in a way that would let me add checksums.
See #1205
@marshalhagen
Copy link

Is this work going to get finished?

Also, in your related work - #1123, you stated, "First I thought that the S3 backend would need to calculate the checksum, but it's actually the client that calculates the checksum and then sends it to the backend - as part of the request body."

This is partially correct. The back end should also calculate the checksum and throw an error if the supplied checksum doesn't match.

From https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/s3-checksums.html

...If Amazon S3 determines the checksum value is incorrect for the specified algorithm, the service returns an error response.

@afranken
Copy link
Member Author

@marshalhagen
Nobody asked for this, I just added this issue when I worked on general checksum persistence.
I'm looking into StorageClass support right now, this could be the next issue to look into.
Since S3Mock currently does not persist metadata for parts at all, it could be a lengthy process to add checksums for parts.

@afranken
Copy link
Member Author

@marshalhagen with #1827, I implemented checksum validation for parts and uploads. Thanks for making me aware that I overlooked this at first.

We still do not persist checksums for parts, and do not validate on multipart completion yet.

@afranken afranken changed the title Support checksums for parts Persist checksums for parts, validate on multipart completion May 1, 2024
@ocostello
Copy link

Just putting my oar in to see I'd appreciate this feature. The past few days I've been trying to work out why validation on multiparts was giving me false positives, only just thought to check the s3mock

@afranken
Copy link
Member Author

fixed with #1864 and #1890

@afranken
Copy link
Member Author

I just released 3.9.1 which correctly implements checksums for multipart uploads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants