Repository navigation
test(video): require SSRF denial in transport cases - #134879
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 1:42 AM ET / 05:42 UTC. ClawSweeper reviewWhat this changesThe PR tightens DeepInfra and xAI video transport tests so private-network cases must reject with the documented SSRF-denial error and reason. Merge readinessKeep this focused maintainer PR open: current main still permits unrelated pre-transport errors to satisfy both loopback cases, while the branch requires the SSRF denial actually emitted by the shared guarded-fetch path. No introduced correctness or supply-chain issue was found. Priority: P3 Review scores
Verification
How this fits togetherVideo provider transports validate requested media URLs before issuing upstream API requests. These tests exercise that guard through each provider transport and assert that blocked targets never reach the local upstream server. flowchart LR
A[Video generation request] --> B[Provider transport]
B --> C[SSRF URL guard]
C --> D{Target allowed?}
D -->|No| E[Typed denial error]
D -->|Yes| F[Provider API request]
E --> G[Transport test assertion]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +10. Total +10 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the two assertion changes once exact-head required checks complete, retaining the existing real provider-transport test setup and zero-request checks. Do we have a high-confidence way to reproduce the issue? Yes, by source: both current-main cases accept any rejection despite provider preflight occurring before guarded fetch; the PR body also records a fault-injection run showing that distinction. Is this the best way to solve the issue? Yes: asserting the typed denial name and stable reason at the existing provider transport boundary closes the false-positive hole without adding a production seam or duplicate test flow. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ae2ffa29872d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer review complete for unchanged head e37ee5e. The latest ClawSweeper review has no findings; its normal maintainer handling and exact-head CI item is fulfilled. CI 33474205133, attempt 1 and the required openclaw/ci-gate job 99751120488 are complete and green on that head. Native review artifacts validate; fresh Codex autoreview is scoped-clean at P0. Current main still accepts any early rejection plus zero requests. Both provider callers and the SDK/shared HTTP/SSRF owner confirm that the guard emits and preserves Actual clean Linux proof: Testbox run 33473362777, lease Focused and changed-scope commands passed: node scripts/run-vitest.mjs extensions/deepinfra/video-generation-provider.transport.test.ts extensions/xai/video-generation-provider.transport.test.ts extensions/deepinfra/video-generation-provider.test.ts extensions/xai/video-generation-provider.test.ts extensions/xai/tts.ssrf-transport.test.ts --reporter=verbose --reporter=json
node scripts/check-changed.mjs -- extensions/deepinfra/video-generation-provider.transport.test.ts extensions/xai/video-generation-provider.transport.test.ts
git diff --check HEAD^Mutation selection used the same test wrapper with |
|
Merged via squash.
|
What Problem This Solves
Resolves a coverage hole where the DeepInfra and xAI video private-network rejection cases could pass on an unrelated pre-transport failure. A generic
rejects.toThrow()plus zero upstream requests does not establish that the SSRF guard denied the request.This is a maintainer-requested, bounded coverage follow-up—not a fix for the separate DeepInfra operation-deadline timeout. CI run 33419303058, attempt 1, job 99577833447 failed at the first POST's remaining-budget evaluation. Why its negative cases passed remains unknown.
Why This Change Was Made
Extend the existing default-policy and explicit-false cases to require both the documented
SsrFBlockedErroridentity and the private/internal/special-use IP denial reason. The SDK documents this error;src/infra/net/ssrf.tsproduces the denial and the guarded HTTP path rethrows it unchanged.Keep the proof at the real provider transport boundary rather than adding duplicate tests, mocked transport, or a production seam. Matching the error's name and reason avoids constructor-identity coupling across the suites' existing module resets. Local HTTP servers, zero-request assertions, auth setup, real clocks, and every deadline are unchanged.
User Impact
No runtime behavior changes. Developers get a failure instead of a false-positive security test when another error prevents the request from reaching the SSRF guard.
Production LOC: +0/-0. Tests: +12/-2 across exactly two existing files. No new tests, dependencies, configuration, or production exports.
Evidence
Clean Linux proof used Blacksmith Testbox
tbx_01m1dppjs1xcp7xnc3eczv0x2v, session run 33473362777, Node 24.19.0 and Vitest 4.1.11. The materialized candidate tree was82f3784cd5e541c910be62b40398b749b53f1471; exact candidate bytes were verified before and after the temporary fault injection. The lease was stopped and its terminal state verified.Errorinjected through the existing auth mockThe fault was synthetic and pre-transport; it was removed completely. It proves rejection discrimination in the actual cases, not real deadline exhaustion or the cause of the historical CI negatives. Negative-only runs deliberately filtered the three positive cases; the final five-file run had no skips. An initial scratch collector stopped because native JSON omitted the received-error diff; the collector was corrected to use verbose evidence and the entire ordered sequence was rerun successfully without changing source behavior or test settings.
Final focused command:
Mutation selection used the same wrapper with
-t 'blocks .*loopback', running each tightened-mutant file separately so fail-fast routing could not hide either provider.Also passed: full changed-scope checks for the two files, including extension-test typecheck, targeted lint, formatting, guards, and dead-export scans;
git diff --check; fresh Codex autoreview, scoped-clean at P0.Earlier local attempts were blocked before test bodies: xAI's unchanged provider-import hook timed out twice, and DeepInfra stalled in compiled-worker setup. Those are not counted as passing proof; the clean Linux runs above close the actual provider-case proof gap.