versitygw
versitygw copied to clipboard
forward message content length and checksum to s3 backend uploads when provided from frontend
Describe the solution you'd like We are currently limited to unsigned payloads for the backend S3 service for put object and put part because the content body is set to streaming mode. In streaming mode, the body is not seekable, and the s3 sdk is unable to compute the checksums correctly.
So currently we have put object and put part set to use unsigned payloads to the backend to workaround the streaming body: https://github.com/versity/versitygw/blob/main/backend/s3proxy/s3.go#L312
output, err := client.PutObject(ctx, input, s3.WithAPIOptions(
v4.SwapComputePayloadSHA256ForUnsignedPayloadMiddleware,
))
and https://github.com/versity/versitygw/blob/main/backend/s3proxy/s3.go#L275
output, err := client.UploadPart(ctx, input, s3.WithAPIOptions(
v4.SwapComputePayloadSHA256ForUnsignedPayloadMiddleware,
))
Since we have the content length and content checksum from the incoming request, we should be able to pass this along to the backend request. We need to investigate if the s3 sdk allows us to provide these values to the backend instead of setting the request to be unsigned.
This might either be some other middleware that allows providing these, or maybe we have to write that middleware?