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

Cannot presign url for s3 delete_objects operation #1510

Open
NyanHelsing opened this issue Jul 30, 2018 · 11 comments
Open

Cannot presign url for s3 delete_objects operation #1510

NyanHelsing opened this issue Jul 30, 2018 · 11 comments
Labels
feature-request This issue requests a feature. p3 This is a minor priority issue s3

Comments

@NyanHelsing
Copy link

NyanHelsing commented Jul 30, 2018

So far as I can tell, the endpoint requires a query parameter, delete in the url.
See https://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html for documentation.
generate_presigned_post has no way to provide this query parameter, and so cannot correctly sign a url to be used with this api.

generate_presigned_url does not work either, as it has no way to add what the hash of the body will be when signing the url.

Hopefully I am missing something here.

@NyanHelsing
Copy link
Author

NyanHelsing commented Jul 30, 2018

think this is the relevant code:

operation_model = self.meta.service_model.operation_model(
'CreateBucket')

@JordonPhillips
Copy link
Contributor

generate_presigned_post is specifically for the put_objects operation, what you want to use is generate_presigned_url with the POST method. The difference is the way that the signatures are generated, afaik S3 only supports PutObject with the presigned_post way of signing.

@NyanHelsing
Copy link
Author

That's the case I found, and what I've ended up using. There is still a problem here however, generate_presigned_url doesn't have a way to pass headers in like generate_presigned_post does.

@NyanHelsing
Copy link
Author

We were forced to write a modified version of this function in order to sign delete operations.
https://github.com/CenterForOpenScience/waterbutler/pull/351/files#diff-74bbac431e282383494483a4d0af3031R48

@NyanHelsing NyanHelsing changed the title Cannot presign posts for s3 delete_objects operation Cannot presign url for s3 delete_objects operation Aug 14, 2018
@NyanHelsing
Copy link
Author

See #1516 for a pr that allows headers to be passed into the url signing process.

@NyanHelsing
Copy link
Author

Bump for a response

@swetashre
Copy link
Contributor

@ExProbitasFiducia - There is no parameter for custom headers in boto3's generate_presigned_url. The headers get added based on the parameters that you would normally pass to the client's method.

Please let me know if you have any questions.

@no-response
Copy link

no-response bot commented Sep 23, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Sep 23, 2019
@tim-finnigan tim-finnigan reopened this May 1, 2023
@tim-finnigan tim-finnigan added feature-request This issue requests a feature. p2 This is a standard priority issue p3 This is a minor priority issue and removed closing-soon p2 This is a standard priority issue labels May 1, 2023
@NyanHelsing
Copy link
Author

NyanHelsing commented May 4, 2023

@tim-finnigan appreciate the follow up on this! iirc the url generated here does not include any headers that were passed to it, so the signature generated by boto cannot be validated by s3, because when s3 checks the signature, it does take into account headers.

this isn't about enabling custom headers i think it was to make the functionality work at all.

@NyanHelsing
Copy link
Author

NyanHelsing commented May 4, 2023

https://github.com/CenterForOpenScience/waterbutler/pull/351/files#diff-e343fe1cb1d426f8d1f366e29e565554bb2d55cd77055b69e92e94b776d1216aR48-R114 for a use case/ link to the line numbers with the monkeypatch i'd written

in file waterbutler/providers/s3/provider.py
ln 48 -114

@NyanHelsing
Copy link
Author

NyanHelsing commented May 4, 2023

@felliott @mfraezz @Johnetordoff might be interested in any progress here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue requests a feature. p3 This is a minor priority issue s3
Projects
None yet
Development

No branches or pull requests

5 participants