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

S3: bucket gets deployed with incorrect public access settings #27190

Closed
piotrwalczak1 opened this issue Sep 19, 2023 · 5 comments
Closed

S3: bucket gets deployed with incorrect public access settings #27190

piotrwalczak1 opened this issue Sep 19, 2023 · 5 comments
Labels
@aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@piotrwalczak1
Copy link

piotrwalczak1 commented Sep 19, 2023

Describe the bug

When deploying the s3 bucket with all 4 options for blockPublicAccess set to false, the bucket is deployed only with two false options. S3 block public access for account is set to all 4 options as false as false.

Per account setting:
image

S3 bucket configuration:
image
S3 for bucket after deployment:
image

Expected Behavior

If I am deploying a public bucket with all 4 blockPublicAccess flags set to false, I expect it to be deployed with all disabled flags. Per account flags are turned off for block public access.

Current Behavior

I gets deployed with 2 false options instead of 4.

Reproduction Steps

    const helloworldbucket = new s3.Bucket(this, "HelloWorldBucketMin", {
      websiteIndexDocument: "index.html",
      publicReadAccess: true,
      blockPublicAccess: {
        blockPublicAcls: false,
        blockPublicPolicy: false,
        ignorePublicAcls: false,
        restrictPublicBuckets: false,
      },
    });

    new BucketDeployment(this, "hello-world-min-depl", {
      sources: [Source.asset("./dist")],
      destinationBucket: helloworldbucket,
    });

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.72.1 (build ddbfac7)

Framework Version

No response

Node.js Version

18.x.x

OS

Ubuntu

Language

Typescript

Language Version

No response

Other information

No response

@piotrwalczak1 piotrwalczak1 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 19, 2023
@github-actions github-actions bot added the @aws-cdk/aws-s3 Related to Amazon S3 label Sep 19, 2023
@khushail khushail added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Sep 19, 2023
@khushail
Copy link
Contributor

Hi @piotrwalczak1 , thanks for reaching out. i tried to reproduce the scenario and it works for me with code shared by you.

Screenshot 2023-09-19 at 11 22 53 AM

I changed the setting to true and hence all public access were blocked like this -

Screenshot 2023-09-19 at 11 16 47 AM

Then I reverted it back to see if there is an issue but it was working as expected.

Could you try rerunning the code and see if its still an issue?

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Sep 19, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 21, 2023
@piotrwalczak1
Copy link
Author

d see if its still an issue

Hi, Can you please try to redeploy the stack after you deployed it? It seems to me it happens on redeploy. It was only on first deployment when it worked, but on any subsequent deployments those 2 options are marked again.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Sep 25, 2023
@pahud pahud added p2 effort/medium Medium work item – several days of effort labels Nov 30, 2023
@pahud
Copy link
Contributor

pahud commented Nov 30, 2023

Resource handler returned message: "The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint."

Did you mean it only happens when you redeploy exactly the same stack? I doesn't seem to make any sense. If you didn't modify any CDK code, the redeploy will simply be ignored because cdk diff should be empty. Please clarify and let me know what the cdk diff returns.

@pahud pahud added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 30, 2023
Copy link

github-actions bot commented Dec 2, 2023

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Dec 2, 2023
@github-actions github-actions bot closed this as completed Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants