Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
After PR #87982 enabled trusted generated text/html for host-read outbound, Telegram delivery still drops the attachment because the staged copy under ~/.openclaw/media/outbound/<uuid>.html is no longer inside /tmp/openclaw/, so the second loadWebMedia call fails the isTrustedGeneratedHostReadHtmlPath root-check.
Steps to reproduce
- Run OpenClaw 2026.6.1 with a Telegram bot account configured.
- From an agent reply, emit an absolute
MEDIA:/tmp/openclaw/<file>.htmldirective (file is a real generated HTML report, owned by the same uid as the gateway, mode 0644, nlink=1, valid UTF-8, doctype<!doctype html>). - Observe gateway log:
OutboundDeliveryError: hostReadCapability permits only validated plain-text documents and trusted generated HTML reports for local reads. No file is delivered.
I instrumented dist/web-media-B4RFpB_P.js (isTrustedGeneratedHostReadHtmlPath + the gate602 site) with console.error probes and confirmed the exact flow:
[HTMLDBG] isTrustedPath {
filePath: "/tmp/openclaw/unread-fetch-report.html",
resolvedFilePath: "/private/tmp/openclaw/unread-fetch-report.html",
resolvedTmpRoot: "/private/tmp/openclaw",
inside: true
}
[HTMLDBG] gate602 { hostReadCapability: true, hostReadDeclaredMime: "text/html", trustedGeneratedHtmlPath: true }
[HTMLDBG] isTrustedHtml OK
# same outbound flow, second loadWebMedia call:
[HTMLDBG] isTrustedPath {
filePath: "/Users/<user>/.openclaw/media/outbound/unread-fetch-report---<uuid>.html",
resolvedFilePath: "/Users/<user>/.openclaw/media/outbound/unread-fetch-report---<uuid>.html",
resolvedTmpRoot: "/private/tmp/openclaw",
inside: false
}
[HTMLDBG] gate602 { hostReadCapability: true, hostReadDeclaredMime: "text/html", trustedGeneratedHtmlPath: false }
→ throw OutboundDeliveryError: hostReadCapability permits only validated plain-text documents and trusted generated HTML reports
Expected behavior
Per PR #87982, a .html file whose realpath is inside /tmp/openclaw/ should be deliverable as a Telegram document. PDF works in the exact same surface (verified at 12:23 with a 1.34 MB PDF: operation=sendDocument deliveryKind=document). HTML should work analogously. The PR description even says "valid generated .html reports under the OpenClaw temp root load as text/html documents for host-read delivery" — which is true on the first call but the staging step then re-invokes loadWebMedia on the staged copy, which is not under the temp root.
Actual behavior
Telegram outbound is rejected with OutboundDeliveryError: hostReadCapability permits only validated plain-text documents and trusted generated HTML reports for local reads. No "Media failed" placeholder reaches the chat — the message is silently dropped. PDF/PNG attachments through the same code path succeed because they don't go through the text/html trusted-root branch at all.
Reproduced 4 times today across different filenames, permission modes (0600 / 0644), and gateway restarts; every attempt logs the same error at the same web-media.ts site.
OpenClaw version
2026.6.1 (commit 2e08f0f)
Operating system
macOS 26.4 (Darwin 25.4.0, arm64)
Install method
npm global
Model
claude-cli/Claude-Opus-4.7
Provider / routing chain
Direct Telegram Bot API (polling), bot @yoyo_li_bot
Additional provider/model setup details
Channel: telegram plugin built-in. No proxy on outbound (only inbound polling proxy).
Logs, screenshots, and evidence
Source: ~/Library/Logs/openclaw/gateway.log and /tmp/openclaw/openclaw-2026-06-05.log.
2026-06-05T13:06:35 [HTMLDBG] isTrustedPath inside=true (original /tmp/openclaw/...html)
2026-06-05T13:06:35 [HTMLDBG] gate602 trustedGeneratedHtmlPath=true
2026-06-05T13:06:36 [HTMLDBG] isTrustedHtml OK
2026-06-05T13:06:37 [HTMLDBG] isTrustedPath inside=false (staged ~/.openclaw/media/outbound/...html)
2026-06-05T13:06:37 [HTMLDBG] gate602 trustedGeneratedHtmlPath=false
2026-06-05T13:06:37 ERROR channels/telegram: OutboundDeliveryError: hostReadCapability permits only validated plain-text documents and trusted generated HTML reports for local reads
The contrast in the same trace is decisive: the first isTrustedPath evaluation passes; the second one (after staging) fails because resolvedFilePath no longer lives under resolvedTmpRoot=/private/tmp/openclaw.
Suspected fix region: either (a) resolveOutboundAttachmentFromUrl (or whichever staging step copies /tmp/openclaw/*.html to ~/.openclaw/media/outbound/) should preserve the trusted-root marker through the post-stage loadWebMedia, or (b) isTrustedGeneratedHostReadHtmlPath should also accept the ~/.openclaw/media/outbound/ staging root as trusted (with the same nlink/symlink guards).
PR #87982 explicitly notes: "What was not tested: live Telegram Bot API delivery". This issue is the missed e2e case.
Impact and severity
Affected channel: Telegram. Severity: blocks workflow (HTML attachments unsendable). Frequency: always. Workaround: render HTML to PDF via headless Chrome — PDF goes through HOST_READ_ALLOWED_DOCUMENT_MIMES and survives staging.
Additional information
- Both
realpath(filePath)andrealpath(resolvePreferredOpenClawTmpDir())resolve identically through/private/tmpsymlink, so the symlink follow itself isn't the bug — the staging-copy origin is. - Same surface delivers PDF (
operation=sendDocument, message Discord slash commands in threads fail with "This channel is not allowed." when using per-channel allowlist #1122 verified). PNG also works (different code path —image/pngdoesn't enterHOST_READ_DECLARED_TEXT_MIMES). - 100% reproducible on a clean gateway restart.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 5, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 7:40 AM ET / 11:40 UTC.
Summary
Keep open: current main and v2026.6.9 still trust generated host-read HTML only when the file being loaded is under the OpenClaw temp root, while the reported Telegram flow stages the file under media/outbound and reloads it there. The open closing PR at #90579 owns the repair path, so this issue should remain canonical until that PR or an equivalent fix lands.
Reproducibility: yes. at source level. Current main stages local reply media into media/outbound and Telegram later reloads that staged .html through a host-read gate that only trusts temp-root realpaths; I did not run a live Telegram repro in this read-only review.
Root-cause cluster
Relationship:
canonicalCanonical: #90557
Summary: This issue is the canonical user report; the open linked PR is the current fix candidate and the earlier merged PR is partial regression context.
Members:
fixed_by_candidate: fix: allow trusted host-read html after outbound staging #90579 - The PR uses closing syntax for this issue and targets the exact trusted generated HTML outbound staging failure reported here.partial_overlap: fix(media): allow trusted generated html attachments #87982 - That merged PR introduced the temp-root trusted generated HTML behavior but explicitly did not cover live Telegram delivery after staging.adjacent_distinct: Media generation succeeds but completion delivery fails and looks like generation failure #86034 - It also concerns media delivery failure symptoms, but the remaining mechanism is not proven to be this host-read HTML staging gate.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
No new ClawSweeper fix PR should be queued because an open closing PR already owns this security-sensitive repair path.
Security
Needs attention: The issue is security-sensitive because the repair must allow staged generated HTML without trusting arbitrary staged or host-local HTML.
Review details
Best possible solution:
Land #90579 or an equivalent provenance-preserving repair, then close this issue after the fix is merged and validated.
Do we have a high-confidence way to reproduce the issue?
Yes, at source level. Current main stages local reply media into media/outbound and Telegram later reloads that staged .html through a host-read gate that only trusts temp-root realpaths; I did not run a live Telegram repro in this read-only review.
Is this the best way to solve the issue?
Yes for keeping the issue open, but not for closing it yet. The best path is to review and land the linked PR or a focused replacement that preserves the trusted-HTML security boundary through staging.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against d1cbe29f3d52.
Label changes
Label justifications:
P1: The issue reports a released Telegram outbound regression that blocks generated HTML attachment delivery in a security-sensitive host-read path.impact:security: The affected behavior is the trusted local HTML host-read gate that controls which HTML files may be read and delivered.impact:message-loss: The reported failure drops the Telegram outbound attachment instead of delivering the generated report.Evidence reviewed
Security concerns:
src/media/web-media.ts:292A repair should not trust every .html file under the outbound media store; it needs to carry or revalidate the original generated-file trust decision so arbitrary staged host-local HTML remains blocked.
Confidence: 0.9
What I checked:
src/media/web-media.ts:292, d1cbe29f3d52)src/media/web-media.ts:1023, d1cbe29f3d52)src/media/outbound-attachment.ts:16, d1cbe29f3d52)src/auto-reply/reply/reply-media-paths.ts:129, d1cbe29f3d52)extensions/telegram/src/send.ts:961, d1cbe29f3d52)src/media/web-media.test.ts:667, d1cbe29f3d52)Likely related people:
src/media/web-media.ts,src/media/outbound-attachment.ts,src/auto-reply/reply/reply-media-paths.ts)src/media/web-media.ts,src/media/outbound-attachment.ts,src/media/store.ts)extensions/telegram/src/send.ts,extensions/telegram/src/bot/delivery.replies.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.