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

Question about PresignedPutObject API #1535

Closed
ABNER-1 opened this issue Aug 24, 2021 · 7 comments
Closed

Question about PresignedPutObject API #1535

ABNER-1 opened this issue Aug 24, 2021 · 7 comments
Labels

Comments

@ABNER-1
Copy link

ABNER-1 commented Aug 24, 2021

Thanks for the prefect open source tools.

When I use minio SDK, I try to get a PresignedPutObject for others (not controlled by me) to put object into it.

I think I need some limits about the presigned url.
I found the header like 'x-amz-content-sha256' can do that. I can limit the user of the presigned put object url that they can only upload specific file. Of course, the object will not been shown before it has been already uploaded.

However, there are no chance in minio go sdk PresignedPutObject API for me to make it.
I think the feature may be very fantastic.

Thanks for any suggestions or answers.

@harshavardhana
Copy link
Member

https://pkg.go.dev/github.com/minio/minio-go/v7?utm_source=godoc#Client.Presign use this to construct whatever you like.

@ABNER-1
Copy link
Author

ABNER-1 commented Aug 24, 2021

Thanks for your answer.
I tried this API.
However it can not add a header like 'x-amz-content-sha256' and signature including this header.

@ABNER-1
Copy link
Author

ABNER-1 commented Aug 24, 2021

I found that there is a PR #1449 like my question.
However it's open and can not make it because it doesn't add this feature to Presign API.

@harshavardhana
Copy link
Member

I found that there is a PR #1449 like my question.
However it's open and can not make it because it doesn't add this feature to Presign API.

you can add the x-amz-content-sha256 as part of the url.Values{} query param.

@ABNER-1
Copy link
Author

ABNER-1 commented Aug 24, 2021

I tested and found that it just add a query kv into url. (Will this be inclued into signature?)

And I even can not use that url to put object. I am trying to solve this problem.
But I think query param isn't the best choice.

@ABNER-1
Copy link
Author

ABNER-1 commented Aug 26, 2021

I found that there is a PR #1449 like my question.
However it's open and can not make it because it doesn't add this feature to Presign API.

you can add the x-amz-content-sha256 as part of the url.Values{} query param.

I have tried to add the x-amz-content-sha256 as part of the url.Values{} query param.
However, I got 403 error with detail The request signature we calculated does not match the signature you provided. Check your key and signing method.
This is my kernel request code. And more details are in attachment.

// ok
//u, err := minioClient.PresignedPutObject(context.TODO(), "test", "hello", 10*time.Minute)
// ok
//u, err := minioClient.Presign(context.TODO(), "PUT", "test", "hello", 10*time.Minute, url.Values{"hh": []string{sha}})
// failed 403
//u, err := minioClient.Presign(context.TODO(), "PUT", "test", "hello", 10*time.Minute, url.Values{"X-Amz-Content-Sha256": []string{sha}})
// failed 403
u, err := minioClient.Presign(context.TODO(), "PUT", "test", "hello", 10*time.Minute, url.Values{"x-amz-content-sha256": []string{sha}})

main.go.txt

@minio-trusted
Copy link
Contributor

https://pkg.go.dev/github.com/minio/minio-go/v7#Client.PresignHeader - This the API that addresses x-amz-content-sha256 requirement.

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