Repository navigation
Refuse S3 operations the server doesn't implement - #175
Merged
Merged
Conversation
S3 picks the operation from the query and headers as well as the
method, but the handlers only looked at the method. PutObjectTagging
and PutObjectAcl replaced the object with the request's XML,
DeleteObjectTagging deleted it, CopyObject answered 200 and stored an
empty object, and GET ?tagging or ?location returned the object or a
listing. Unrouted operations got an empty 404 or 405.
- Each handler checks its query against the parameters it reads, plus
presigned-URL authentication (SigV4 and SigV2) and the SDKs' x-id
tag, which must name the handler's operation. Anything else is
501 NotImplemented, so subresources added later fail closed.
- PUT refuses x-amz-copy-source, and an aws-chunked body, which would
have been stored with its chunk framing.
- PUT /{bucket}?versioning and the like no longer create the bucket.
- The router's fallbacks answer unrouted paths and methods (ListBuckets,
DeleteBucket, DeleteObjects, multipart uploads) with a NotImplemented
S3 error.
- GET /{bucket}?location answers GetBucketLocation with the default
region. Clients that call it got a listing they read as "no
constraint", so refusing it would have broken them.
- ListObjectsV2 accepts fetch-owner and ignores it; there are no owners.
- Tests: every row of the issue's table, plus bucket configuration and
unrouted operations, is refused and leaves the store unchanged;
presigned URLs, x-id, fetch-owner and ?location keep working.
- CHANGELOG entry.
Fixes #156
The README and the S3 quick start list GetBucketLocation and presigned URLs among what works, and name the operations that now get 501 NotImplemented (#156): multipart upload, CopyObject, tagging, ACLs, bucket configuration, ListBuckets, DeleteBucket, DeleteObjects, response-* overrides and aws-chunked bodies.
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
S3 picks the operation from the query and headers as well as the method, but the handlers only looked at the method. So:
200and stored an empty object (andaws s3 mvis CopyObject then DeleteObject);GET ?taggingandGET ?locationreturned the object or a listing;What changes:
x-idtag, which has to name that handler's operation. Anything else gets501<Code>NotImplemented</Code>, so subresources S3 adds later fail closed.x-amz-copy-sourceis refused. So is anaws-chunkedbody, which would have been stored with its chunk framing.PUT /{bucket}?versioningand the like) is refused and no longer creates the bucket.NotImplementedS3 error instead of an empty response.GET /{bucket}?locationreturns an emptyLocationConstraint(us-east-1). Clients that call it, such as the MinIO SDK, used to get a listing they read as "no constraint", so refusing it would have broken them. This departs from the issue's suggestion.fetch-owneron ListObjectsV2 is accepted and ignored; there are no owners.response-content-typeand the otherresponse-*overrides on GET are refused, as the issue proposed. A presigned link that sets them now gets501until they're implemented.Tested with boto3 1.43.94 against a running
serve-s3:put_object,upload_fileobj,get_object,head_object,head_bucket,list_objects, thelist_objects_v2paginator (withFetchOwnertoo),get_bucket_location,download_file, a presigned GET anddelete_object.NotImplementedand leave the data untouched:put_object_tagging,copy_object,delete_objects,delete_bucket,list_bucketsandcreate_multipart_upload.Fixes #156
Type
Checklist
Quality gates
cargo fmt --allcargo clippy --workspace --all-targets -- -D warningscargo test --workspace): 377 passed, 0 failed (2 of them new;unimplemented_operations_are_refused_not_misrunfails onmain)RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-depsDocumentation
Security
unsafeblocksDependency changes (skip if none)
None.
Independent of #174. Both add a CHANGELOG line under Fixed, a couple of lines apart, so they should merge in either order.