CSP connect-src blocks S3 signed uploads from admin UI
#1747
khoinguyenpham04
announced in
Roadmap
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
This Roadmap discussion mirrors #205: CSP
connect-srcblocks S3 signed uploads from admin UI.Use this discussion to upvote the roadmap item and discuss priority, use cases, and product feedback. Keep implementation tracking, reproduction details, and PR-specific feedback on the source issue.
bug,area/core,roadmap/1.0,roadmap/securityOriginal Issue
Description
When using S3-compatible storage (AWS S3, Cloudflare R2, Clever Cloud Cellar, etc.), the admin UI cannot upload media files. The browser blocks the PUT request to the S3 endpoint because it violates the Content Security Policy.
Cause
buildEmDashCsp()inpackages/core/src/astro/middleware/auth.tshardcodesconnect-src 'self':When the admin UI uploads media via signed URLs, the browser makes a PUT request directly to the S3 endpoint. This cross-origin request is blocked by the CSP.
The
img-srcdirective already handles external origins (for marketplace), butconnect-srcdoes not account for the storage endpoint.Suggested fix
Add the storage endpoint origin to
connect-src(andimg-srcfor displaying uploaded images):Then pass the endpoint from the storage config at both call sites:
Steps to reproduce
Environment
Logs / error output
All reactions