Skip to content

Commit

Permalink
JCLOUDS-1644: Create AWS S3 buckets with ownership and public access …
Browse files Browse the repository at this point in the history
…block

AWS changed the defaults when creating buckets to prevent public-read
and other canned ACLs.  Background:
https://stackoverflow.com/a/76102067/2800111
  • Loading branch information
gaul committed Jan 22, 2025
1 parent dd6cb51 commit 26338e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ protected URL getObjectURL(String containerName, String key) throws Exception {
public void testPutCannedAccessPolicyPublic() throws Exception {
String containerName = getContainerName();
try {
allowPublicReadable(containerName);

String key = "hello";
S3Object object = getApi().newS3Object();
object.getMetadata().setKey(key);
Expand Down Expand Up @@ -236,6 +238,8 @@ public void run() {
public void testUpdateObjectACL() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerName = getContainerName();
try {
allowPublicReadable(containerName);

String objectKey = "private-acl";

// Private object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public void testUpdateBucketACL() throws InterruptedException, ExecutionExceptio
assertEquals(acl.getGrants().size(), 1);
assertTrue(acl.hasPermission(ownerId, FULL_CONTROL));

allowPublicReadable(bucketName);
addGrantsToACL(acl);
assertEquals(acl.getGrants().size(), 4);
assertTrue(getApi().putBucketACL(bucketName, acl));
Expand Down

0 comments on commit 26338e3

Please sign in to comment.