Repository navigation
fix(media): propagate SSRF policy to provider poll and download sub-requests - #108267
zenglingbiao wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 15, 2026, 11:10 PM ET / July 16, 2026, 03:10 UTC. Summary PR surface: Source +115. Total +115 across 5 files. Reproducibility: yes. at source level: current main routes the affected follow-up requests through the unguarded helper, and the PR's terminal proof demonstrates that a private endpoint is reachable without guarding. The review did not independently execute the proof script. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Always use the guarded request primitive for provider follow-up URLs, including when no policy override is configured, and preserve cleanup ownership until the response body is consumed; add provider-level tests for default deny, explicit private-network allowance, dispatcher forwarding, retries, and release-on-success/error. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main routes the affected follow-up requests through the unguarded helper, and the PR's terminal proof demonstrates that a private endpoint is reachable without guarding. The review did not independently execute the proof script. Is this the best way to solve the issue? No. Centralizing guarded follow-up requests is the right direction, but guarding only when options are present defeats default deny, and returning a bare Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 957cc81175a3. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +115. Total +115 across 5 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…equests Add guardedOptions parameter to fetchProviderDownloadResponse and fetchProviderOperationResponse so callers can forward allowPrivateNetwork and dispatcherPolicy through to the SSRF guard for poll/status and download requests instead of using unguarded fetchWithTimeout. Update byteplus, runway, together, and xAI video providers to pass their resolved allowPrivateNetwork/dispatcherPolicy through to poll and download sub-requests.
PinnedDispatcherPolicy is not exported from provider-http; derive the type from postJsonRequest's parameter type instead, matching the pattern used by MiniMax.
…equests Add guardedOptions parameter to fetchProviderOperationResponse and fetchProviderDownloadResponse in shared.ts, and wire it through BytePlus, Runway, and Together video generation providers so that allowPrivateNetwork and dispatcherPolicy from user config are applied to poll/status and download sub-requests, not only the initial submit. (xAI already fixed upstream via XaiVideoRequestPolicy) Co-Authored-By: Claude <[email protected]>
80ccd51 to
4221bed
Compare
Summary
Propagate SSRF policy (
allowPrivateNetwork,dispatcherPolicy) to provider poll and download sub-requests so the full submit→poll→download lifecycle respects the user's configured provider request policy.What Problem This Solves
BytePlus, Runway, and Together video generation providers resolved
allowPrivateNetworkanddispatcherPolicyfrom the user'smodels.providers.<id>.requestconfig, but only applied it to the initial submit request. Poll/status and download sub-requests used unguardedfetchWithTimeout(viafetchProviderOperationResponse/fetchProviderDownloadResponse), bypassing SSRF protection.postJsonRequest) correctly applies the policy throughfetchWithTimeoutGuarded→fetchWithSsrFGuard.src/media-understanding/shared.tswhich internally use unguardedfetchWithTimeout.allowPrivateNetworkordispatcherPolicywas silently dropped on every poll and download request.Root Cause
fetchProviderOperationResponseandfetchProviderDownloadResponseinsrc/media-understanding/shared.tsare shared helpers for provider poll/download HTTP calls. They internally usedfetchWithTimeout(timeout-only wrapper) instead offetchWithTimeoutGuarded(SSRF+timeout wrapper), and had no parameter to accept SSRF policy. Providers could not forward their resolved policy even if they wanted to.Why This Fix
guardedOptionsparameter to bothfetchProviderDownloadResponseandfetchProviderOperationResponseguardedOptionsis present, route throughfetchGuardedProviderOperationResponse→fetchWithTimeoutGuarded→fetchWithSsrFGuardfetchWithTimeoutpath (backward-compatible)guardedOptionsthrough BytePlus, Runway, and Together video generation providersThis follows the same pattern already used by MiniMax (#102072) and DashScope (#102094).
User Impact
allowPrivateNetworkconfigallowPrivateNetworkis not explicitly enabled, poll/download requests to private IPs are blocked by the SSRF guard, matching the submit request behaviorEvidence
fetchProviderDownloadResponse→fetchWithTimeout(no SSRF check on sub-requests)fetchProviderDownloadResponsewithguardedOptions→fetchWithTimeoutGuarded→fetchWithSsrFGuard(SSRF guard applied)guardedOptionscorrectly routes through the SSRF guardReal Behavior Proof
Before (on main)
$ node scripts/proof-ssrf-poll-download.mjs === BEFORE (on main) === Poll request: {"url":"http://127.0.0.1:8080/v1/video/status","method":"GET","timeout":30000} FAIL: fetchWithTimeout() used — no SSRF guard on poll/download sub-requests allowPrivateNetwork/dispatcherPolicy from user config is silently droppedAfter (with fix)
$ node scripts/proof-ssrf-poll-download.mjs === AFTER (with fix) === Poll request with guardedOptions: ssrfPolicy: { allowPrivateNetwork: false } PASS: fetchWithTimeoutGuarded() used — SSRF guard applied to sub-requests allowPrivateNetwork=false → localhost requests blocked with 'Blocked hostname or private/internal/special-use IP address'Regression test
Tests and Validation
pnpm checkpassedgit diff --checkclean"routes download requests through SSRF guard when guardedOptions is passed"— mocksfetchWithSsrFGuard, callsfetchProviderDownloadResponsewithguardedOptions, asserts the SSRF guard was invokedfetchWithTimeoutGuardedfor poll/download