Skip to content

Commit b8f8932

Browse files
committed
rgw: handle destination bucket as an ARN in ReplicationConfiguration
The S3 ReplicationConfiguration's destination bucket must be treated as an ARN, per the AWS S3 documentation: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Destination.html#AmazonS3-Type-Destination-Bucket Fixes: https://tracker.ceph.com/issues/69568 Signed-off-by: Seena Fallah <[email protected]>
1 parent 05b1cc2 commit b8f8932

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/rgw/rgw_rest_s3.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,14 @@ struct ReplicationConfiguration {
13151315
// Here we are sure that s->owner.id is of type rgw_user
13161316
const auto& tenant_owner = std::get_if<rgw_user>(&s->owner.id)->tenant;
13171317

1318+
auto dest_bk_arn = ARN::parse(destination.bucket);
1319+
if (!dest_bk_arn || dest_bk_arn->service != rgw::Service::s3 || dest_bk_arn->resource.empty()) {
1320+
s->err.message = "Invalid bucket ARN";
1321+
return -EINVAL;
1322+
}
1323+
13181324
rgw_bucket_key dest_bk(tenant_owner,
1319-
destination.bucket);
1325+
dest_bk_arn->resource);
13201326

13211327
if (source && !source->zone_names.empty()) {
13221328
pipe->source.zones = get_zone_ids_from_names(driver, source->zone_names);
@@ -1383,7 +1389,7 @@ struct ReplicationConfiguration {
13831389
}
13841390

13851391
if (pipe.dest.bucket) {
1386-
destination.bucket = pipe.dest.bucket->get_key();
1392+
destination.bucket = ARN(*pipe.dest.bucket).to_string();
13871393
}
13881394

13891395
filter.emplace();

0 commit comments

Comments
 (0)