Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New S3 bucket ownership default breaks the S3 streamwrapper mkdir method. #2674

Open
tbenice opened this issue Apr 13, 2023 · 2 comments
Open
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@tbenice
Copy link

tbenice commented Apr 13, 2023

Describe the bug

April 2023 S3 started defaulting all new buckets to 'Bucket owner enforced' ownership setting (https://aws.amazon.com/about-aws/whats-new/2022/12/amazon-s3-automatically-enable-block-public-access-disable-access-control-lists-buckets-april-2023/) . Because of this, any createbucket call with acl settings returns a 400 error "InvalidBucketAclWithObjectOwnership".

This would be fine except that the streamwrapper class mkdir method uses acls by default, and so any use of mkdir returns the 400 error.

Expected Behavior

Using mkdir method of the streamwrapper class should create a bucket successfully.

Current Behavior

mkdir method always returns a 'InvalidBucketAclWithObjectOwnership' error.

Reproduction Steps

mkdir("s3://my-bucket-name");

Possible Solution

in the mkdir method try creating the bucket using 'DeleteBucketOwnershipControls' to allow acls, or remove any acl setting from the method.

Additional Information/Context

No response

SDK version used

^3.0

Environment details (Version of PHP (php -v)? OS name and version, etc.)

php 8, macos, Pantheon hosting environment.

@tbenice tbenice added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 13, 2023
@stobrien89
Copy link
Member

stobrien89 commented Apr 14, 2023

Hi @tbenice,

Sorry to hear about the issues. I imagine we can just unset the ACL option for the CreateBucket method, but how we handle createSubfolder will require a little more thought. Ideally we'd want to find out when the bucket was created and proceed from there, but for that we'll need to talk with the S3 team to see if we can pin down an exact date. I'll try to have a fix out for both of these issues soon.

@stobrien89 stobrien89 self-assigned this Apr 14, 2023
@stobrien89 stobrien89 removed the needs-triage This issue or PR still needs to be triaged. label Apr 14, 2023
@yenfryherrerafeliz yenfryherrerafeliz added the p2 This is a standard priority issue label May 22, 2023
@stof
Copy link

stof commented Jun 27, 2023

Given that the configuration of the bucket can still be changed, createSubfolder should probably choose its behavior based on the metadata of the bucket rather than choosing it based on the default value of the bucket creation at the time of creation of the bucket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

4 participants