feat: update presigned url api to support visibility, svg image#100
feat: update presigned url api to support visibility, svg image#100lethanhdat762003 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the S3 presigned URL generation service by introducing a serializer for input validation, changing the upload URL endpoint to a POST request, and allowing dynamic file paths for retrieval. While these changes improve the API structure, several critical security and reliability issues were identified. Specifically, the retrieval endpoint is vulnerable to arbitrary S3 bucket access and needs path validation and authentication. Additionally, the upload serializer should restrict allowed MIME types to prevent unrestricted file uploads, input filenames should be sanitized to prevent path traversal, and settings access should be made safer to avoid potential AttributeErrors. Finally, it is recommended to use S3 Bucket Policies instead of deprecated Object ACLs for public files.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if visibility == "public": | ||
| params["ACL"] = "public-read" |
There was a problem hiding this comment.
S3 Object ACLs Deprecation / Block Public Access: Setting ACL='public-read' requires S3 Object ACLs to be enabled on the bucket and 'Block Public Access' to be disabled. AWS now strongly discourages the use of ACLs and enables 'Bucket owner enforced' (which disables ACLs) by default for new buckets.\n\nIf ACLs are disabled on your bucket, the client will receive a 403 Forbidden error when attempting to upload using this presigned URL.\n\nRecommendation: Instead of using Object ACLs, manage public visibility via an S3 Bucket Policy that grants s3:GetObject permission to anonymous users for any keys starting with the public/ prefix. This allows you to keep ACLs disabled and 'Block Public Access' enabled (except for the specific bucket policy allowance).
cb4cc84 to
6957df4
Compare
58a87ec to
cf58043
Compare
d2e8e80 to
dc87978
Compare
What?
Why?
POST /api/presigned-url
GET /api/presigned-url/public/550e8400-e29b_avatar.png
How?
Testing?
Anything Else?