Skip to content

[Bug]: Feishu media fallback can expose local media references #98250

Description

@ooiuuii

Summary

Feishu media fallback paths can expose local or private media references to end users when upload/fetch fails. The affected paths include local-image auto-send fallback, sendMedia upload fallback, document-comment media fallback, and reply-dispatcher media fallback for final voice/media replies.

Real Environment Observed

  • Repository: openclaw/openclaw
  • Branch inspected: current main
  • Affected integration: Feishu outbound/reply delivery
  • Affected files:
    • extensions/feishu/src/outbound.ts
    • extensions/feishu/src/reply-dispatcher.ts

User-Visible Symptom

If OpenClaw tries to send Feishu media from a host-local path, a file:// URL, a relative media reference, a loopback/private URL, or a hostname that resolves to a private address, an upload/fetch failure can degrade into a plain text fallback containing that raw reference.

That can send values such as host temp paths, local filesystem paths, loopback URLs, or internal network media URLs to Feishu recipients instead of a safe failure message.

Source-Level Repro On Current Main

Current Feishu media fallback code appends the raw mediaUrl into user-visible text after a failed media send. The same class is reachable from multiple Feishu delivery surfaces:

  • Local image auto-send can catch sendMediaFeishu(...) failure and fall through to normal text sending.
  • sendMedia fallback can append 📎 ${mediaUrl} after upload failure.
  • Document-comment media fallback can include the raw media reference in comment text.
  • Reply dispatcher onError fallback can append the raw mediaUrl after sendMediaWithLeadingCaption(...) catches media-send failure.

Expected Behavior

Feishu fallback text should preserve the caption/reply text, but it should not send host-local paths, file:// URLs, relative references, loopback/private URLs, or DNS-private media URLs to recipients.

Public http:// or https:// URLs may remain available as fallback links only after they pass the shared SSRF/DNS policy.

Actual Behavior

Raw media references can be sent as Feishu text/comment fallback when media upload or media fetch fails.

Scope / Non-Goals

  • This is scoped to Feishu user-visible fallback text.
  • This does not change successful media upload behavior.
  • This does not change Feishu auth, account selection, TTS routing, or provider behavior.
  • This does not attempt to solve general media upload reliability.

Proposed Fix

Add a Feishu-local media fallback helper that:

  • only includes http:// or https:// fallback links after shared SSRF/DNS validation;
  • suppresses local/private media fetch failures;
  • preserves caption text;
  • emits a generic media upload failure message for unsafe or non-public media references;
  • reuses the same fallback policy across Feishu outbound and reply-dispatcher paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions