Skip to content

fix(s3): Handle x-id for s3:DeleteObjects#3937

Merged
whummer merged 1 commit intomasterfrom
fix/3931/s3-delete-objects-with-x-id
Apr 28, 2021
Merged

fix(s3): Handle x-id for s3:DeleteObjects#3937
whummer merged 1 commit intomasterfrom
fix/3931/s3-delete-objects-with-x-id

Conversation

@pandomic
Copy link
Member

Summary

As reported by @arciisine in #3931 AWS has introduced x-id query parameter in their requests (just to say, I couldn't find any documentation). This makes DeleteObjects request look like the following:

POST /?delete=&x-id=DeleteObjects
...

This request is bypassed by moto (since DeleteObjects is unsupported) and our s3_response_is_delete_keys since underlying is_delete_keys is making a full string check for /?delete, whereas the path now includes x-id query parameter.

@pandomic pandomic requested a review from whummer April 27, 2021 22:53
return is_delete_keys(request, path, bucket_name)
# Temporary fix until moto supports x-id and DeleteObjects (#3931)
query = self._get_querystring(request.url)
is_delete_keys_v3 = (query and ('delete' in query) and get_safe(query, '$.x-id.0') == 'DeleteObjects')
Copy link
Member Author

@pandomic pandomic Apr 27, 2021

Choose a reason for hiding this comment

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

Maybe simply leave just get_safe(query, '$.x-id.0') == 'DeleteObjects', since it's very unlikely to receive non-delete request with x-id=DeleteObjects 🤔

@whummer
Copy link
Member

whummer commented Apr 28, 2021

Looks great, thanks @pandomic ! 👍

(Regarding your comment - I think what we have is good, better stay on the safe side..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@aws-sdk/client-s3 DeleteObjects command is breaking due to inclusion of x-id query param

2 participants