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

S3Mock returns wrong error for invalid bucket names #935

Closed
afranken opened this issue Nov 24, 2022 · 1 comment · Fixed by #941
Closed

S3Mock returns wrong error for invalid bucket names #935

afranken opened this issue Nov 24, 2022 · 1 comment · Fixed by #941
Assignees
Labels

Comments

@afranken
Copy link
Member

In 2.4.16, S3Mock started enforcing valid bucket names.

400 - InvalidBucketName is returned as expected when creating a new bucket, but the other handler methods are using a simplified regular expression to match bucket names, and Spring will reply with a generic
"Error making request with Error Code MethodNotAllowed and Http Status Code MethodNotAllowed" because no suitable handler method can be found.

This alone is a problem already, but for example, if a test would request some key from some bucket without creating the bucket first, if the bucket name is invalid, S3Mock does not even check if the bucket exists, so the client never receives a valid error message.


We could either:
Remove the regex from the path patterns of all handler methods
or:
Add a fallback handler method for all HTTP methods that do not apply the regex pattern and therefore check the bucket name and return a correct error message.

@afranken
Copy link
Member Author

example issues: #928, #874

@afranken afranken self-assigned this Nov 24, 2022
@afranken afranken added the bug label Nov 24, 2022
afranken added a commit that referenced this issue Nov 24, 2022
This makes it possible to return real S3 errors if buckets have invalid
names.

Fixes #935
afranken added a commit that referenced this issue Dec 16, 2022
This makes it possible to return real S3 errors if buckets have invalid
names.

Fixes #935
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant