-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix: log buckets don't have acls enabled #25303
Conversation
Adds `objectOwnership` to s3 server access log delivery buckets that are created in cdk applications with the `@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy` feature flag disabled. This will allow users to keep creating new buckets within those apps for storing logs. This is only set if the user has not configured `objectOwnership` manually on the log bucket. `ObjectWriter` was essentially the default behavior before the change to disable ACLs by default for new buckets so though this will update existing buckets it should not cause any breakage or replacement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Changed my mind -- I think we should set
If the user does supply |
private parseOwnershipControls( | ||
objectOwnership?: ObjectOwnership, | ||
accessControl?: BucketAccessControl, | ||
): CfnBucket.OwnershipControlsProperty | undefined { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For style, since this function is only ever called with this.whatever
as its arguments anyway, it doesn't need to take these as parameters.
It could just read them from the object immediately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
return undefined; | ||
} | ||
|
||
if (accessControlRequiresObjectOwnership && objectOwnership === ObjectOwnership.BUCKET_OWNER_ENFORCED) { | ||
throw new Error (`objectOwnership cannot be set to "${ObjectOwnership.BUCKET_OWNER_ENFORCED}" when accessControl is "${accessControl}"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new Error (`objectOwnership cannot be set to "${ObjectOwnership.BUCKET_OWNER_ENFORCED}" when accessControl is "${accessControl}"`); | |
throw new Error (`objectOwnership must be set to ObjectOwnership.OBJECT_WRITER when accessControl is "${accessControl}"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provisional approval with some small requests
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
@Mergifyio refresh |
✅ Pull request refreshed |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Set ObjectOwnership: ObjectWriter automatically if and only if: - It is not provided by the user - AccessControl ACLs are configured (only if AccessControl != PRIVATE) If the user does supply ObjectOwnership != ObjectWriter AND they try to set ACLs, we should error. `ObjectWriter` was essentially the default behavior before the change to disable ACLs by default for new buckets so though this will update existing buckets it should not cause any breakage or replacement. Closes #25288 --------- Co-authored-by: corymhall <43035978+corymhall@users.noreply.github.com>
Set ObjectOwnership: ObjectWriter automatically if and only if:
If the user does supply ObjectOwnership != ObjectWriter AND they try to set ACLs, we should error.
ObjectWriter
was essentially the default behavior before the change to disable ACLs by default for new buckets so though this will update existing buckets it should not cause any breakage or replacement.Closes #25288
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license