Repository navigation
fix(xai): apply request policy to video generation requests - #104836
Solvely-Colin merged 27 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 14, 2026, 7:08 AM ET / 11:08 UTC. Summary PR surface: Source +90, Tests +309. Total +399 across 5 files. Reproducibility: yes. at source level: current main hardcodes caller-level private-network denial, omits sanitized xAI request config, and uses unguarded poll/download helpers, so configured headers, proxy policy, and private-network policy cannot consistently reach all three stages. The review did not execute a failing current-main live xAI request. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Keep the shared sanitized request-policy resolver and guarded fetch path, preserve header isolation for generated-media URLs, and merge only after the provider owner explicitly accepts default-deny private-network behavior with explicit opt-in as the supported upgrade contract. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main hardcodes caller-level private-network denial, omits sanitized xAI request config, and uses unguarded poll/download helpers, so configured headers, proxy policy, and private-network policy cannot consistently reach all three stages. The review did not execute a failing current-main live xAI request. Is this the best way to solve the issue? Yes, conditionally: resolving the existing provider request policy at the xAI plugin boundary and using shared guarded HTTP primitives is the narrow maintainable fix. The remaining question is intentional upgrade policy, not a known implementation defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 236a6b815c18. Label changesLabel justifications:
Evidence reviewedPR surface: Source +90, Tests +309. Total +399 across 5 files. View PR surface stats
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
Review history (22 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Current head 08bdeda fixes the real xAI video request-policy gap found by local transport proof: request.allowPrivateNetwork is no longer overridden, and the PR now includes a controlled local xAI API/download harness. PR body Proof records git diff check, focused oxlint, and node scripts/run-vitest.mjs extensions/xai/video-generation-provider.transport.test.ts extensions/xai/video-generation-provider.test.ts passing 2 files / 20 tests. The harness proves create/poll receive the configured custom header while generated-video download remains headerless. This is controlled local endpoint proof, not a live xAI request. |
…ownloads The byteplus and runway video-generation providers fetched the generated video from a URL taken out of the provider's own completion response using an unguarded download call, never re-applying the SSRF guard (DNS pinning, private/loopback/link-local blocking) they already apply to submit and poll. A compromised, MITM'd, or malicious-base-URL provider could point that result URL at an internal address and OpenClaw would fetch it and save the bytes as the generated video (CWE-918), with default configuration. Add a canonical fetchGuardedProviderDownloadResponse helper that mirrors fetchProviderDownloadResponse but always routes the download through the SSRF guard, blocking private targets by default while honoring the resolved allowPrivateNetwork and dispatcherPolicy operator opt-in. Thread the resolved policy into both providers' download step. This matches the always-on guard already used by fal and openrouter and closes the default-configuration gap. minimax (openclaw#102072) and xai (openclaw#104836) are already guarded; vydra is covered by open PR openclaw#105884. Closes openclaw#103083
What Problem This Solves
Fixes an issue where users generating video with xAI could configure provider request policy, such as custom headers or proxy settings, but xAI video generation requests ignored that policy.
Why This Change Was Made
The xAI video provider now sanitizes
cfg.models.providers.xai.requestand passes it into the existing provider HTTP resolver used by the create, poll, and download flow. The poll and download flow now always uses the guarded provider fetch path; private-network access is enabled only when explicitly configured. The change leaves generation parameters, polling semantics, idempotency headers, and media parsing unchanged.User Impact
Users who depend on configured provider transport policy can expect xAI video generation to honor those request settings. With no request policy, provider-controlled xAI video status/download URLs now stay on the default SSRF-protected path instead of being fetched through an unguarded fallback.
Evidence
Additional exact-head local controlled transport proof (redacted):
9ed880e8aa71node scripts/run-vitest.mjs extensions/xai/video-generation-provider.transport.test.ts --reporter verboseObservation: the exact-head controlled loopback transport proof covers configured-policy forwarding plus zero loopback server reachability for both unset/default request policy and explicit
allowPrivateNetwork: false. This is local controlled proof, not a live xAI provider run.node scripts/run-vitest.mjs extensions/xai/video-generation-provider.test.tspassed: 19 tests.git diff --checkpassed..agents/skills/autoreview/scripts/autoreview --mode local --engine claude --model claude-fable-5 --thinking highreported no accepted/actionable findings.2026-07-12 follow-up: local controlled request-policy proof
523f5999e4fixes the review gap by passing the resolved xAI request policy through video create, poll, and generated-video download. The poll/download stages now use guarded provider fetches whenallowPrivateNetworkor a dispatcher/proxy policy is configured, while preserving the existing unconfigured fast path and bounded xAI JSON/media readers.node scripts/run-vitest.mjs extensions/xai/video-generation-provider.test.tspassed: 19 tests.2026-07-13 follow-up: default-deny SSRF guard repair
0ba4e54026includes3edeec9ec3and removes the unguarded xAI video poll/download fallback.fetchXaiVideoResponsenow always callsfetchWithTimeoutGuarded;allowPrivateNetworkis passed only when explicitly true, and dispatcher policy/header behavior remains preserved.request.allowPrivateNetwork: false: each case points xAIbaseUrlat a local loopback HTTP server and assertsserver.requestsremains0, proving the guard blocks before the server receives a connection.git diff HEAD --check— passed.17ad46ac16merges latestupstream/maininto the branch with theprovider-http-mocks.tsconflict resolved by keeping the current SDKdispatcherPolicyreturn type while preserving the xAI guarded-fetch mock support.0ba4e54026removes unused test helper code and restores the mockedfetchWithTimeouttimeout assertion type after the main merge.Proof
2026-07-12 exact-head local transport proof after CI-refresh update-branch
Exact head tested after normal
gh pr update-branch:4ffb626175e89d694394ae655a69128245807ef0.Scope: controlled local provider-path proof for xAI video generation create, poll, and generated-video download. This is not a live xAI API call.
Commands run:
Result: PASS.
git diff --checkpassed; focused oxlint exited 0; Vitest passed 1 shard, 2 files, 20 tests in 22.02s total wall time. Vitest duration: 14.47s.Transcript excerpt:
Observation:
extensions/xai/video-generation-provider.transport.test.tsstarts a local HTTP server and drives the real provider path through video create, poll, and generated-video download. The configuredX-Xai-Traceheader and Authorization header reach only xAI API-origin create/poll requests; the generated-video download request is a plainGETand does not include the custom header or Authorization. The companion unit test also asserts the download init remains headerless and the provider no longer overrides request-policy private-network opt-in with caller-levelallowPrivateNetwork:false.Not tested: no live xAI account, real API key, external proxy/TLS route, real video generation job, or external provider endpoint was exercised.