aws-s3: blockPublicAccess
has a counterintuitive behaviour
#32811
Labels
@aws-cdk/aws-s3
Related to Amazon S3
bug
This issue is a bug.
investigating
This issue is being investigated and/or work is in progress to resolve the issue.
p2
Describe the bug
When a bucket is created without specifying the
blockPublicAccess
property:It is equivalent to explicitly setting all
BlockPublicAccess
options totrue
:This might lead you to assume that all
BlockPublicAccess
options default totrue
. However, that's not the case. For example, if you deploy a bucket like this:You would get this configuration:
This happens because all options within
BlockPublicAccess
areundefined
by default, which is equivalent tofalse
.This behavior is counterintuitive. If you do not define
blockPublicAccess
, all options default totrue
. However, if you define aBlockPublicAccess
, any unspecified options default tofalse
.This seemingly paradoxical situation stems from a change introduced a couple of years ago.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
see above.
Current Behavior
see above.
Reproduction Steps
see above.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.174.1
Framework Version
No response
Node.js Version
22.12.0
OS
Ubuntu 24.04.1
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: