Skip to content

fix(opencode): allow blob frames and objects in embedded UI CSP - #51636

Closed
Serenity-2026 wants to merge 1 commit into
anomalyco:devfrom
Serenity-2026:fix-embedded-ui-csp
Closed

Serenity-2026 wants to merge 1 commit into
anomalyco:devfrom
Serenity-2026:fix-embedded-ui-csp

Conversation

@Serenity-2026

@Serenity-2026 Serenity-2026 commented Sep 27, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #50828

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

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, so affected icons showed the browser's blocked-content placeholder; PDF previews are blocked the same way (#52591). Added frame-src 'self' blob: and object-src 'self' blob:. img-src and connect-src already allowed blob:.

How did you verify your code works?

Added packages/opencode/test/server/ui-csp.test.ts asserting the generated policy (with and without a theme-preload hash) contains both directives. From packages/opencode: bun test test/server/ui-csp.test.ts and bun 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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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
@Serenity-2026
Serenity-2026 force-pushed the fix-embedded-ui-csp branch 2 times, most recently from d02f9c5 to cbaf017 Compare October 2, 2026 15:34
@Serenity-2026

Copy link
Copy Markdown
Author

Done — added object-src 'self' blob: alongside frame-src 'self' blob: and asserted both in the test, so this should also cover the PDF case from #52591. A test build on your side would be welcome.

@Serenity-2026 Serenity-2026 changed the title fix(opencode): allow blob frames in embedded UI CSP fix(opencode): allow blob frames and objects in embedded UI CSP Oct 2, 2026
@Serenity-2026

Copy link
Copy Markdown
Author

Confirmed the second copy is v2-only — packages/cli/src/services/web-ui.ts doesn't exist on dev, so I couldn't fold it into this PR. Opened #52948 against v2 with the same frame-src 'self' blob:; object-src 'self' blob: change, and extended packages/cli/test/web-ui.test.ts to assert both. Thanks for the pointer.

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@thdxr thdxr closed this Oct 10, 2026
@Serenity-2026

Copy link
Copy Markdown
Author

Covered by #52948, which is now based on dev — on the current tree the web UI CSP lives in packages/cli/src/services/web-ui.ts, and that PR adds frame-src 'self' blob: + object-src 'self' blob: there with test assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web-ui: CSP missing frame-src blocks blob: iframes ("This content is blocked")

2 participants