-
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
feat(cloudfront-origins): list access level for 404 response #32059
Conversation
packages/aws-cdk-lib/aws-cloudfront-origins/lib/s3-bucket-origin.ts
Outdated
Show resolved
Hide resolved
@gracelu0 Thank you for your review! |
I created an example CDK project. The root path returns the list of objects in the bucket: A missing object returns 404: Regular objects return 200 and their contents: A folder created by S3 console returns 200 and empty content (content-type: application/x-directory): Without a folder, S3 returns 404: |
Pull request has been modified.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32059 +/- ##
=======================================
Coverage 81.48% 81.48%
=======================================
Files 226 226
Lines 13768 13768
Branches 2416 2416
=======================================
Hits 11219 11219
Misses 2271 2271
Partials 278 278
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@Mergifyio update |
✅ Branch has been successfully updated |
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.
Thank you for contributing!
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #13983.
Closes #31689.
Reason for this change
When we want to receive HTTP 404 response where the requested object does not exist,
s3:ListBucket permission is needed in the S3 bucket policy.
Unlike
errorResponses
to convert 403 response to 404, This is useful to distinguish between responses blocked by WAF (403) and responses where the file does not exist (404).Description of changes
Added a new
AccessLevel.LIST
to allow s3:ListBucket.Description of how you validated changes
Unit test and integration test. The integ test also tests the response is 404.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license