openclaw - 💡(How to fix) Fix Control UI CSP blocks blob: avatar URLs generated by avatar fetch path [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#71729Fetched 2026-04-26 05:09:14
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
0
Author
Timeline (top)
commented ×2closed ×1

Control UI still serves a Content Security Policy that does not allow blob: images:

img-src 'self' data:

This can block avatar rendering in frontend paths that fetch /avatar/<agentId> and then render the result via URL.createObjectURL(await response.blob()).

This is related to #70700, but narrower and not the same issue. #70700 was closed as implemented because workspace-relative avatar paths are now normalized to /avatar/<agentId>. This issue is specifically about the CSP still rejecting blob: image URLs when the frontend uses blob object URLs for avatars.

Root Cause

This is related to #70700, but narrower and not the same issue. #70700 was closed as implemented because workspace-relative avatar paths are now normalized to /avatar/<agentId>. This issue is specifically about the CSP still rejecting blob: image URLs when the frontend uses blob object URLs for avatars.

Code Example

img-src 'self' data:

---

Content-Security-Policy: default-src 'self'; base-uri 'none'; object-src 'none'; frame-ancestors 'none'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data:; font-src 'self' https://fonts.gstatic.com; connect-src 'self' ws: wss:

---

"img-src 'self' data:"

---

const u = URL.createObjectURL(await response.blob())
img.src = u

---

img-src 'self' data: blob:

---

img-src 'self' data:

---

curl -sSI http://127.0.0.1:18789/ | grep -i content-security-policy

---

Content-Security-Policy: ... img-src 'self' data:; ...

---

"img-src 'self' data:"

---

"img-src 'self' data: blob:"
RAW_BUFFERClick to expand / collapse

Summary

Control UI still serves a Content Security Policy that does not allow blob: images:

img-src 'self' data:

This can block avatar rendering in frontend paths that fetch /avatar/<agentId> and then render the result via URL.createObjectURL(await response.blob()).

This is related to #70700, but narrower and not the same issue. #70700 was closed as implemented because workspace-relative avatar paths are now normalized to /avatar/<agentId>. This issue is specifically about the CSP still rejecting blob: image URLs when the frontend uses blob object URLs for avatars.

Environment

  • OpenClaw: 2026.4.23 (a979721)
  • Control UI served by Gateway
  • Local Gateway URL checked: http://127.0.0.1:18789/

Current behavior

On 2026.4.23, the live Control UI response still contains:

Content-Security-Policy: default-src 'self'; base-uri 'none'; object-src 'none'; frame-ancestors 'none'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data:; font-src 'self' https://fonts.gstatic.com; connect-src 'self' ws: wss:

So blob: is not allowed for images.

The built CSP helper also still emits:

"img-src 'self' data:"

Why this is separate from #70700

The workspace-relative path normalization part appears implemented. In 2026.4.23, the built bundle contains resolveAssistantAvatarUrl, which maps workspace-relative avatar values to /avatar/<agentId>.

That addresses the raw workspace-relative path issue.

However, the CSP issue remains if any Control UI avatar path does this:

const u = URL.createObjectURL(await response.blob())
img.src = u

Under the current CSP, the browser is allowed to fetch /avatar/<agentId>, but it is not allowed to render the resulting blob: URL as an image.

Expected behavior

If Control UI uses blob: URLs for fetched avatar images, its CSP should allow blob: in img-src, for example:

img-src 'self' data: blob:

Alternatively, Control UI should avoid converting avatar responses into blob: URLs and use the resolved /avatar/<agentId> route directly everywhere.

Actual behavior

The live page CSP in 2026.4.23 still omits blob::

img-src 'self' data:

This means browser rendering of avatar blob: URLs is blocked by CSP even when:

  • the configured avatar path is valid
  • /avatar/<agentId>?meta=1 resolves
  • /avatar/<agentId> returns the correct image bytes
  • workspace-relative path normalization has already happened

Minimal verification

curl -sSI http://127.0.0.1:18789/ | grep -i content-security-policy

Observed on 2026.4.23:

Content-Security-Policy: ... img-src 'self' data:; ...

Suggested fix

If blob: avatar rendering is still used anywhere in Control UI, update the CSP builder from:

"img-src 'self' data:"

to:

"img-src 'self' data: blob:"

or remove the blob: conversion from avatar rendering paths and consistently use resolved /avatar/<agentId> URLs.

extent analysis

TL;DR

Update the Content Security Policy (CSP) to include blob: in the img-src directive to allow rendering of avatar images.

Guidance

  • Verify the current CSP configuration using the provided curl command to check if blob: is included in the img-src directive.
  • Update the CSP builder to include blob: in the img-src directive, for example: "img-src 'self' data: blob:".
  • Alternatively, consider removing the blob: conversion from avatar rendering paths and consistently use resolved /avatar/<agentId> URLs.
  • Test the updated CSP configuration to ensure that avatar images are rendered correctly.

Example

// Updated CSP builder
"img-src 'self' data: blob:"

Notes

The suggested fix assumes that blob: avatar rendering is still used in the Control UI. If this is not the case, removing the blob: conversion from avatar rendering paths may be a more suitable solution.

Recommendation

Apply the workaround by updating the CSP builder to include blob: in the img-src directive, as this is a more straightforward solution that allows for continued use of blob: avatar rendering.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

If Control UI uses blob: URLs for fetched avatar images, its CSP should allow blob: in img-src, for example:

img-src 'self' data: blob:

Alternatively, Control UI should avoid converting avatar responses into blob: URLs and use the resolved /avatar/<agentId> route directly everywhere.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Control UI CSP blocks blob: avatar URLs generated by avatar fetch path [2 comments, 3 participants]