Description
Starting in OpenCode 1.18.13, attachments in the web UI use blob: URLs after #40207.
The CSP sent by opencode serve currently allows:
img-src 'self' data: https:
connect-src * data:
It does not allow the blob: scheme.
As a result, the browser blocks both parts of the new attachment flow:
- Attachment previews use a
blob: URL as the image source.
- Submission fetches the
blob: URL to convert it into a data URL.
The browser reports the requests as blocked:csp, and the attachment cannot be previewed or submitted.
This also affects secure HTTPS deployments. I reproduced it while accessing opencode serve through a Cloudflare Tunnel.
Plugins
N/A
OpenCode version
1.18.13
Steps to reproduce
- Start
opencode serve.
- Access the web UI through HTTPS.
- Add an image attachment to the prompt composer.
- Observe that the preview or attachment submission is blocked by CSP.
- Check the browser developer tools and observe the blocked
blob: request.
Screenshot and/or share link
No response
Operating System
Ubuntu 22.04
Terminal
Ghostty
Description
Starting in OpenCode 1.18.13, attachments in the web UI use
blob:URLs after #40207.The CSP sent by
opencode servecurrently allows:It does not allow the
blob:scheme.As a result, the browser blocks both parts of the new attachment flow:
blob:URL as the image source.blob:URL to convert it into a data URL.The browser reports the requests as
blocked:csp, and the attachment cannot be previewed or submitted.This also affects secure HTTPS deployments. I reproduced it while accessing
opencode servethrough a Cloudflare Tunnel.Plugins
N/A
OpenCode version
1.18.13
Steps to reproduce
opencode serve.blob:request.Screenshot and/or share link
No response
Operating System
Ubuntu 22.04
Terminal
Ghostty