fix: reject a ListBuckets bucket-region other than the gateway region
S3 never lists an empty result for another region: a valid region other than the endpoint's own gets 400 InvalidArgument, "Requests with bucket-region specified must be made to the corresponding regional endpoint", with no ArgumentValue. The gateway is a single regional endpoint, so it now does the same instead of clearing the listing. Match the region case-insensitively like S3, and check an empty bucket-region= too by looking for the query argument itself, since an empty value is not a valid AWS region either.
This commit is contained in:
1 parent
5d293b1316
commit
e1d2284906
7 files changed
+104
-56
No files matched your search
@@ -285,12 +285,16 @@ export RUN_USERS=true
|
||||
run setup_bucket "$bucket_name"
|
||||
assert_success
|
||||
|
||||
local params=()
|
||||
if [ "$DIRECT" == "true" ]; then
|
||||
params+=("-url" "https://s3.$test_region.amazonaws.com" "-awsRegion" "$test_region")
|
||||
# the regional endpoint of that region lists only its own buckets
|
||||
run list_buckets_bucket_not_in_list "$bucket_name" "$test_region" "-url" "https://s3.$test_region.amazonaws.com" "-awsRegion" "$test_region"
|
||||
assert_success
|
||||
return
|
||||
fi
|
||||
|
||||
run list_buckets_bucket_not_in_list "$bucket_name" "$test_region" "${params[@]}"
|
||||
# the gateway is a single regional endpoint, so any other region is rejected
|
||||
run send_rest_go_command_expect_error_with_specific_arg_name_value "400" "InvalidArgument" "Requests with bucket-region specified must be made to the corresponding regional endpoint" \
|
||||
"ArgumentName" "bucket-region" "-query" "bucket-region=$test_region"
|
||||
assert_success
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user