S3 fixture should report 404 on unknown bucket (#31782)
Today, `AmazonS3Fixture` returns 403 on attempts to access any inappropriate bucket, whether known or otherwise. In fact, S3 reports 404 on nonexistent buckets and 403 on inaccessible ones. This change enhances `AmazonS3Fixture` to distinguish these cases.
This commit is contained in:
parent
3f2a241b7f
commit
18c17dfb35
|
@ -96,8 +96,13 @@ public class AmazonS3Fixture extends AbstractHttpFixture {
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
final String bucket = request.getParam("bucket");
|
final String bucket = request.getParam("bucket");
|
||||||
if (bucket != null && permittedBucket.equals(bucket) == false) {
|
if (bucket != null && permittedBucket.equals(bucket) == false) {
|
||||||
// allow a null bucket to support bucket-free APIs
|
// allow a null bucket to support the multi-object-delete API which
|
||||||
|
// passes the bucket name in the host header instead of the URL.
|
||||||
|
if (buckets.containsKey(bucket)) {
|
||||||
return newError(request.getId(), RestStatus.FORBIDDEN, "AccessDenied", "Bad bucket", "");
|
return newError(request.getId(), RestStatus.FORBIDDEN, "AccessDenied", "Bad bucket", "");
|
||||||
|
} else {
|
||||||
|
return newBucketNotFoundError(request.getId(), bucket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return handler.handle(request);
|
return handler.handle(request);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -183,10 +183,6 @@ setup:
|
||||||
---
|
---
|
||||||
"Register a repository with a non existing bucket":
|
"Register a repository with a non existing bucket":
|
||||||
|
|
||||||
- skip:
|
|
||||||
version: all
|
|
||||||
reason: to be fixed
|
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
catch: /repository_exception/
|
catch: /repository_exception/
|
||||||
snapshot.create_repository:
|
snapshot.create_repository:
|
||||||
|
|
|
@ -183,10 +183,6 @@ setup:
|
||||||
---
|
---
|
||||||
"Register a repository with a non existing bucket":
|
"Register a repository with a non existing bucket":
|
||||||
|
|
||||||
- skip:
|
|
||||||
version: all
|
|
||||||
reason: to be fixed
|
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
catch: /repository_exception/
|
catch: /repository_exception/
|
||||||
snapshot.create_repository:
|
snapshot.create_repository:
|
||||||
|
|
Loading…
Reference in New Issue