-
Notifications
You must be signed in to change notification settings - Fork 4k
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(s3): default BlockPublicAccess class properties to true (under feature flag) #33001
base: main
Are you sure you want to change the base?
fix(s3): default BlockPublicAccess class properties to true (under feature flag) #33001
Conversation
… consistent behavior
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 fails with the following errors:
❌ The title of the pull request should omit 'aws-' from the name of modified packages. Use 's3' instead of 'aws-s3'.
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.
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.
Thanks 👍
A couple of notes:
- I think the PR should be classified as a
fix
and an integration test should be created/updated to cover the scenario. - More importantly, I assume this could change the visibility of deployed buckets without users noticing. If so, a feature flag is needed.
Thanks @lpizzinidev for reviewing the change. I'll make the suggested changes and send out a revision. |
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.
Thanks for the adjustment 👍 Left comments for minor syntax adjustments.
Thanks for the suggestion. Co-authored-by: Luca Pizzini <[email protected]>
Co-authored-by: Luca Pizzini <[email protected]>
Co-authored-by: Luca Pizzini <[email protected]>
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue # aws-s3: blockPublicAccess has a counterintuitive behaviour #32811
Closes #32811.
Reason for this change
S3 Bucket construct when initialized without specifying the
blockPublicAccess
property results in all the members of classBlockPublicAccess
set totrue
. However if some properties are set tofalse
during initialization, then all remaining properties are also set tofalse
. Reason for this is because the unspecified properties are treated asundefined
, which evaluates tofalse
. This causes an inconsistent behavior and leads to confusion.Description of changes
Inside the constructor of
BlockPublicAccess
class inaws-s3/lib/bucket.ts
, we use the nullish coalescing operator??
to check if the properties are not explicitly set by the customer. If they are not, then we set them totrue
. This will create a consistent default for those properties totrue
.Description of how you validated changes
Added a unit test to validate the changes.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license