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

fix(object_store): Include Content-MD5 header for S3 DeleteObjects #5415

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

paraseba
Copy link
Contributor

S3 API specification requires the presence of this header for all DeleteObjects requests to general purpose buckets:

The Content-MD5 request header is required for all Multi-Object Delete requests

Some platforms, such as MinIO, enforce this requirement, rejecting requests that don't include the header.

I have successfully tested the change locally against MinIO.

What changes are included in this PR?

  • Add an optional dependency on md5 crate
  • Make that dependency part of the aws feature
  • Include the Content-MD5 header unconditionally for all DeleteObjects requests
  • No changes to any other checksums in the operation

No breaking changes, platforms not interested in the header will ignore it.

Closes #5414

S3 API [specification](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html)
requires the presence of this header for all `DeleteObjects` requests to
general purpose buckets:

> The Content-MD5 request header is required for all Multi-Object Delete requests

Some platform, such as MinIO, enforce this requirement, failing requests
that don't include the header.
@github-actions github-actions bot added the object-store Object Store Interface label Feb 21, 2024
@@ -54,6 +54,7 @@ reqwest = { version = "0.11", default-features = false, features = ["rustls-tls-
ring = { version = "0.17", default-features = false, features = ["std"], optional = true }
rustls-pemfile = { version = "2.0", default-features = false, features = ["std"], optional = true }
tokio = { version = "1.25.0", features = ["sync", "macros", "rt", "time", "io-util"] }
md5 = { version = "0.7.0", default-features = false, features = ["std"], optional = true }
Copy link
Contributor

@tustvold tustvold Feb 21, 2024

Choose a reason for hiding this comment

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

Is this a new dependency?

https://crates.io/crates/md-5 is perhaps better maintained

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, new dependency, I couldn't find any other existing dependencies that supports md5. Good catch, I'll switch to md-5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

md-5 seems better maintained.
Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

The additional dependency saddens me, but I don't see a way around it

@tustvold tustvold merged commit ef63fb9 into apache:master Feb 21, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
object-store Object Store Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

delete_stream fails in MinIO
2 participants