Bug #80921
openrgw: S3 APIs that RGW does not implement run as another bucket or object operation
0%
Description
Found by comparing RGW's S3 dispatch against AWS's published Smithy model of S3 (aws/api-models-aws, models/s3/service/2006-03-01 at f9dcea01). Reproduced on main at 7ed73efc1be on a single-host vstart cluster, with new s3-tests cases. By code review, tentacle has the same code.
The op_get, op_put, op_delete and op_post methods of RGWHandler_REST_Bucket_S3 and RGWHandler_REST_Obj_S3 (rgw_rest_s3.cc:5416-5670) test the query arguments they know. For anything else they run the plain operation for the method. A request for an S3 API that RGW does not implement therefore runs as a different operation, and is answered success:
| SDK call | Request | What RGW does |
|---|---|---|
| DeleteBucketMetricsConfiguration, DeleteBucketAnalyticsConfiguration, DeleteBucketInventoryConfiguration, DeleteBucketIntelligentTieringConfiguration | DELETE /{bucket}?metrics&id=... etc. |
DeleteBucket: an empty bucket is deleted, 204 |
| DeleteBucketMetadataConfiguration, DeleteBucketMetadataTableConfiguration (by code review) | DELETE /{bucket}?metadataConfiguration, ?metadataTable |
the same |
| DeleteObjectAnnotation | DELETE /{bucket}/{key}?annotation |
DeleteObject: the object is deleted, 204 |
| PutObjectAnnotation | PUT /{bucket}/{key}?annotation |
PutObject: the object's data is replaced by the annotation, 200 |
| UpdateObjectEncryption | PUT /{bucket}/{key}?encryption |
PutObject: the object's data is replaced by the request's XML, 200 |
| RenameObject | PUT /{bucket}/{key}?renameObject |
PutObject with no body: a 0-byte object at the destination, over any object there; the source is left; 200 |
| GetBucketMetricsConfiguration, and the Get and List calls for analytics, inventory, intelligent-tiering, accelerate, ABAC and metadata configurations; CreateSession | GET /{bucket}?metrics&id=... etc. |
ListObjects, 200 |
| GetObjectAnnotation (by code review) | GET /{bucket}/{key}?annotation |
GetObject: the object's data |
Tools that manage bucket configuration, such as Terraform, call the Delete*Configuration APIs when they remove a configuration. #46263 reported this for DeleteBucketEncryption and DeleteBucketReplication. Its fix added those two sub-resources to the dispatch, so each API added to S3 since then falls through the same way.
Reproducers, ins3tests/functional/test_s3.py, each marked fails_on_rgw:
test_bucket_config_delete_keeps_bucket, one case each for metrics, analytics, inventory and intelligent-tiering: the bucket is gone afterwards.test_object_annotation_put_keeps_objectandtest_update_object_encryption_keeps_data: the object's data is replaced.test_object_annotation_delete_keeps_object: the object is deleted.test_rename_object_keeps_destination: the rename answers success, and the destination is empty.test_bucket_metrics_configuration_get_unconfigured: answered 200.
An S3 implementation that lacks an API refuses it, with 501 NotImplemented, and changes nothing. A fix could answer 501 for a request that names an S3 sub-resource the handler does not serve, checked against a list of S3's sub-resources, rather than adding guards one API at a time.
KB Updated by Kyle Bader 2 months ago
- Related to Bug #46263: S3 API DELETE /{bucket}?encryption or DELETE /{bucket}?replication remove bucket added
MH Updated by Matthew Heler 2 months ago
- Status changed from New to Fix Under Review
- Assignee set to Kyle Bader
- Backport changed from tentacle to umbrella, tentacle, squid
- Pull request ID set to 72114