-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the bug
The withOriginAccessControl method only has functionality to add GetObject, PutObject or DeleteObject permissions to the provided bucket resource policy. When using CloudFront to host a SPA app (Single Page App) its common to require to put a custom error response to translate HTTP 404 (page not found) to HTTP 200 responses, this is support deep linking within the SPA app.
To allow for this the S3 bucket must provide ListBucket permission to CloudFront, allowing CloudFront to identify the file doesnt exist and actually omit a HTTP 404. Currently this is not exposed via withOriginAccessControl and a user has no understand this and then add the permission manally to the bucket policy
Given the code for withOriginAccessControl is already modifiing the bucket resource policy it should be expected that it also handles this use case
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
N/A
Expected Behavior
Bucket Policy has the ability to have ListBucket permissions granted to CloudFront
Current Behavior
Only GetObject permissions added to the /* resource ARN - ListBucket needs to be to the bucket resource not a Key resource
Reproduction Steps
use withOriginAccessControl and see that ListBucket permission cannot be added
Possible Solution
Expose functionality (extra prop) to withOriginAccessControl to allow for ListBucket permission adding
Additional Information/Context
N/A
CDK CLI Version
2.160.0
Framework Version
No response
Node.js Version
v20.14.0
OS
osx
Language
TypeScript
Language Version
No response
Other information
No response