fix(s3): updating blockPublicAccess to enable default true settings (under feature flag) #33702
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
V3 but I think we got there
Issue
Closes #32811
Reason for this change
By default when you create an s3 bucket, all public access is already blocked. However if you then use CDK to specify 1 or more access point you want to unblock, all undefined block types will be auto set to false, and when it deploys you will see everything uncheck even if you only wanted to uncheck 1 thing.
So to fix this we should instead default all values to true when at least 1 option is specified, to mimic to experience when a user in the console unchecks the boxes.
Description of changes
deprecating
BLOCK_ACLS
method ofBlockPublicAccess
. AddingBLOCK_ACLS_ONLY
.This is just a general revamp to match what the feature will bring, it's separate from the feature itself. The point being that for any shortcut methods like this, we should be specifying all 4 options to ensure the default true behavior remains.
Created function
setBlockPublicAccessDefaults()
but this method is only called if the FF is enabled
Of course the FF itself was added.
The last few feature flags didn't have the big comment wall
//////////////////////////////////////////////////////////////////////
I like the big comment wall
//////////////////////////////////////////////////////////////////////
adding the big comment wall back
//////////////////////////////////////////:)//////////////////////////
Description of how you validated changes
Added tests that are duplicates of others, just testing for both behaviors with and without the FF.
Also added an integ that just tests different combinations of the blocking.
aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-block-access.ts
Lines 1 to 42 in 51ffe21
There was no
BlockPublicAccess
integ before so I did not add the context for the FF disabled anywhere. The tests should still be working since it's not used that often. But if the team needs me to, I can add a 2nd integ with the old behaviorChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license