Skip to content

fix(media): guard generated video result downloads - #182425

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-103083
Oct 24, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-103083

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: generated-video downloads skip the SSRF guard when a provider task succeeds and returns a result URL or redirects that download.

User Impact

Generated videos from BytePlus, Runway, Together, Novita, Z.AI, and Kie AI are now downloaded only through the guarded network path, so a returned result URL can no longer reach private or internal addresses.

Why This Change Was Made

BytePlus and Runway guarded their task requests, but the returned download URL and its redirects went through a raw fetch, and the shared default downloader exposed Together, Novita, Z.AI, and Kie AI the same way. The shared generated-video asset owner now acquires a guarded response handle in strict mode, keeps download retries, the absolute deadline, HTTP status checks, and byte caps, releases the handle after reading or failure, and the raw response-only path is removed. BytePlus and Runway route through their existing fetchResponse callback so they keep their resolved proxy transport, while result downloads inherit neither task credentials nor task-specific private-network trust; MiniMax, xAI, and Vydra already used guarded downloads and are unchanged.

Production LOC +104/-12 (net +92); tests +269/-3; test support +2/-2; docs +7/-1. No SDK signature, config key, dependency, schema, or allowed-network policy is added.

Evidence

  • Red on main: the new BytePlus and Runway download-policy tests failed 5 cases, including a synthetic local HTTP server that received the result download, and the shared-owner regression failed 6 cases.
  • Green: 147 tests passed across 10 files covering the shared asset owner, the SSRF dispatcher contract, and the BytePlus, Runway, Together, Novita, Z.AI, and Kie AI video providers, with private and link-local result URLs, a public-to-private redirect, zero requests reaching the local server, public result success, HTTP status propagation, byte caps, and handle release; after later test-only corrections, the two affected files passed 16 tests.
  • Targeted typecheck, oxlint, oxfmt, and git diff --check passed.
  • Independent review found that the guarded helper could auto-select its trusted environment-proxy mode and skip DNS validation; an added DNS-boundary regression failed 1 of 10 before explicit strict mode and passed 10 of 10 after it, and the final re-review was clean with no actionable findings.
  • Gap: no paid provider generation or live channel delivery was run; proof uses controlled task results and an isolated synthetic HTTP server, so PR CI remains the broad proof. Re-evaluating the existing private-network trust that MiniMax, xAI, and Vydra already apply to their guarded downloads is a separate follow-up, since it would change currently allowed behavior.

Fixes #103083

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T08:27:58.359473Z 672d92b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: byteplus extensions: runway size: M labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR guards generated-video result downloads while preserving provider proxy routing, deadlines, retries, size limits, and cleanup.

Example: BytePlus returns http://127.0.0.1:41733/video.mp4 as its completed video URL.

  • Before: The downloader can connect to the loopback service and return its bytes as a video.
  • After: The downloader rejects the URL with SsrFBlockedError before connecting.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful, focused security repair with passing exact-head CI and no identified code defect, but incomplete final-effect evidence.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An attacker-influenced video provider response can make OpenClaw fetch internal services and return their bytes as a generated video.
Reason: The source confirms the missing security boundary, and this maintainer-authored repair implements the established separation between task trust and third-party result URLs.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this maintainer-authored PR addresses a verified SSRF gap that remains on main; no definite introduced code defect was found.

Priority: P2
Reviewed head: 672d92bd6306b9ad0dac400711068a74e85203dd

Before merge

  • Add real behavior proof - Authority-chain proof required: the changed download owners have a real-server loopback-denial regression, but allowed public downloads and redirects use mocked fetch, and the DNS regression injects lookup results; supply recorded after-fix real-transport evidence for successful allowed downloads and rejection of private result URLs and redirects, including provider proxy routing, with secrets and non-public endpoints redacted. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve merge risk - The author must establish the allowed-destination side of the changed strict/proxy security boundary before merge; supplied successful-download cases bypass the real transport.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a redacted real-transport trace showing an allowed result download succeeds while private URLs and public-to-private redirects are rejected before forbidden I/O, with configured proxy routing exercised.
Agent review details

How this fits together

Video providers turn completed task URLs into bounded video assets; the shared downloader and provider transport callbacks acquire responses, validate bytes, and release network resources.

flowchart TD
  A[Video generation request] --> B[Provider task submission and polling]
  B --> C[Provider returned result URL]
  C --> D[Shared downloader or provider transport callback]
  D --> E[SSRF and redirect guard]
  E --> F[Bounded video response reader]
  F --> G[Generated video asset]
Loading

Technical review

Best possible solution:

Retain the existing shared downloader and provider transport callbacks, with strict result-URL checks and complete final-effect evidence.

Do we have a high-confidence way to reproduce the issue?

Yes: current main routes returned URLs through raw fetch, and yetval's linked report records loopback connections through the production provider path; this review executed no target code.

Is this the best way to solve the issue?

The repair uses the established asset owner and callback seam, preserves provider routing and bounded response handling, and avoids the public SDK expansion proposed by the earlier closed candidate.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 23f3b4ffcbae.

Merge-risk options

Maintainer options:

  1. Complete the transport-boundary evidence (recommended)
    The author supplies a recorded successful guarded download and private-target rejection through the real transport, including configured proxy routing and a public-to-private redirect.

Provenance checked

  • Shared generated-video acquisition changes intended behavior with a stated reason (bc0c3fc: Consolidate bounded asset reading while keeping provider-specific transport, retry, SSRF policy, and release ownership.)
  • Runway task and result policy separation keeps the original intent (41532e1: Honor task request configuration without granting task credentials or private-network trust to generated third-party downloads.)
  • Provider HTTP test transport setup keeps the original intent (1690803: Exercise shared polling and bounded response owners with fixture network transport.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit bc0c3fc adds src/media-generation/provider-assets.ts:41 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bc0c3fcd634b; files: src/media-generation/provider-assets.ts)
  • Yiğit ERDOĞAN: Raw commit 9ebaa82 adds src/media-generation/provider-assets.ts:38 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9ebaa82502ca; files: src/media-generation/provider-assets.ts)

PR surface

Source +92, Tests +266, Docs +6. Total +364 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 104 12 +92
Tests 4 271 5 +266
Docs 2 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 382 18 +364

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +104/-12; tests +269/-3; test support +2/-2. Production growth supplies guarded acquisition and cleanup while retaining distinct provider transport policies; tests cover URL rejection, redirects, DNS, response errors, and release behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #103083
Summary: This PR repairs the remaining BytePlus and Runway result-download gap tracked by the canonical issue and also protects other default-downloader consumers.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: This fixes a bounded SSRF exposure in optional video providers, requiring an attacker-influenced provider response or endpoint.
  • add merge-risk: 🚨 security-boundary: The diff changes which provider-returned destinations reach network I/O, and successful real-transport behavior remains unproven.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: This fixes a bounded SSRF exposure in optional video providers, requiring an attacker-influenced provider response or endpoint.
  • merge-risk: 🚨 security-boundary: The diff changes which provider-returned destinations reach network I/O, and successful real-transport behavior remains unproven.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add real-transport proof for an allowed result destination and the nearest forbidden private destination, including redirect and proxy routing.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 24, 2026, 4:40 AM ET / 08:40 UTC.

@steipete
steipete merged commit 9a97d4c into main Oct 24, 2026
140 of 142 checks passed
@steipete
steipete deleted the steipete/fix-103083 branch October 24, 2026 17:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
RomneyDa pushed a commit that referenced this pull request Oct 26, 2026
(cherry picked from commit 9a97d4c)

Adapted for 2026.9.x: ports only the core default-download path in src/media-generation/provider-assets.ts (guarded strict fetch with env-proxy transport, release on rejection) and the shared provider-http test mock. createProviderOperationTimeoutError is exported from the internal src/media-understanding/shared.ts module only; no plugin SDK export is added. The BytePlus and Runway fetchResponse overrides (which need createProviderOperationTimeoutError through openclaw/plugin-sdk/provider-http) and their tests are dropped; on 9.x both providers use the default download path, so they are covered by the core guard with env-proxy transport instead of their configured dispatcher policy. The Runway docs hunk is dropped and the video-generation docs note is reworded to match.
KrasimirKralev added a commit to KrasimirKralev/openclaw that referenced this pull request Oct 28, 2026
…rust

MiniMax video (video_url and file download_url) and music (audio_url) result downloads reused the task's request policy, so request.allowPrivateNetwork granted for a private MiniMax relay also let provider-returned URLs and their redirects reach private hosts. Route them through a strict guarded download that keeps the configured proxy, matching BytePlus and Runway (openclaw#182425).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: byteplus extensions: runway merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Video-generation providers fetch the result URL with no SSRF guard (byteplus, minimax, xai, runway, vydra)

1 participant