fix(opencode): allow blob frames and objects in embedded UI CSP - #51636
Serenity-2026 wants to merge 1 commit into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Thanks for this — the diagnosis matches exactly what I see on 2.0.21 (HTML file preview blocked with the One suggestion so this closes the whole family: #52591 (closed as duplicate of #50828) reports PDF preview blocked as well, and its title notes Happy to test a build with the change on macOS + Chrome if useful. |
The embedded web UI CSP had no frame-src or object-src directive, so blob: iframes and objects fell back to default-src 'self' and were blocked. The icon renderer frames blob: URLs (icons showed the browser's blocked placeholder), and PDF previews are affected the same way. Add frame-src 'self' blob: and object-src 'self' blob:. Closes anomalyco#50828
d02f9c5 to
cbaf017
Compare
|
Done — added |
|
Heads-up before this merges: the fix needs to land on the The CSP string has a second copy on
Desktop 2.0.22 is built from Could you apply the same |
Issue for this PR
Closes #50828
Type of change
What does this PR do?
The embedded web UI CSP had no
frame-srcorobject-srcdirective, soblob:iframes and objects fell back todefault-src 'self'and were blocked. The icon renderer framesblob:URLs, so affected icons showed the browser's blocked-content placeholder; PDF previews are blocked the same way (#52591). Addedframe-src 'self' blob:andobject-src 'self' blob:.img-srcandconnect-srcalready allowedblob:.How did you verify your code works?
Added
packages/opencode/test/server/ui-csp.test.tsasserting the generated policy (with and without a theme-preload hash) contains both directives. Frompackages/opencode:bun test test/server/ui-csp.test.tsandbun run typecheck.Screenshots / recordings
CSP header change:
before:
... media-src 'self' data:; connect-src * data: blob:after:
... media-src 'self' data:; frame-src 'self' blob:; object-src 'self' blob:; connect-src * data: blob:Checklist
If you do not follow this template your PR will be automatically rejected.