Skip to content

test(video): require SSRF denial in transport cases - #134879

Merged
steipete merged 1 commit into
mainfrom
steipete/frosty-shtern-11ea5f
Sep 1, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/frosty-shtern-11ea5f

Conversation

@steipete

@steipete steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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 SsrFBlockedError identity and the private/internal/special-use IP denial reason. The SDK documents this error; src/infra/net/ssrf.ts produces 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 was 82f3784cd5e541c910be62b40398b749b53f1471; exact candidate bytes were verified before and after the temporary fault injection. The lease was stopped and its terminal state verified.

Proof variant Observed result
Unmodified candidate, both complete transport files 7 passed
Existing negative cases with the old generic matcher and a one-shot ordinary Error injected through the existing auth mock All 4 passed, including zero-request assertions
Same injected error with the tightened matcher All 4 failed at the intended asymmetric-matcher assertion; verbose output showed the ordinary deadline-shaped error rather than SSRF denial
Exact candidate restored, both transport files plus both provider unit suites and xAI TTS SSRF transport siblings 43 passed, 0 skipped, 0 errors

The 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:

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

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.

@steipete steipete self-assigned this Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review September 1, 2026 05:35
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 1:42 AM ET / 05:42 UTC.

ClawSweeper review

What this changes

The PR tightens DeepInfra and xAI video transport tests so private-network cases must reject with the documented SSRF-denial error and reason.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep 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
Reviewed head: e37ee5e7303d06b63b75dcec901c68d7c434f640

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned test hardening change with credible boundary-level evidence and no actionable defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR changes only test assertions and no user-visible runtime behavior; its PR body nevertheless supplies a detailed Testbox transport-boundary fault-injection trace.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR changes only test assertions and no user-visible runtime behavior; its PR body nevertheless supplies a detailed Testbox transport-boundary fault-injection trace.
Evidence reviewed 7 items Current main still has the coverage gap: The DeepInfra loopback cases on current main use a generic rejection matcher, so any earlier failure can satisfy the test before the SSRF guard is reached.
Second provider has the same current-main gap: The xAI loopback cases likewise use only a generic rejection matcher on current main.
Shared guard defines the asserted contract: The shared SSRF owner constructs SsrFBlockedError and uses the asserted private/internal/special-use IP wording for blocked literal hosts.
Findings None None.
Security None None.

How this fits together

Video 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]
Loading

Before merge

  • Complete next step (P2) - The branch is a needed, focused coverage improvement; remaining work is normal maintainer handling and exact-head CI completion rather than an automated repair.
Agent review details

Security

None.

PR surface

Tests +10. Total +10 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 12 2 +10
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 2 +10

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; tests +12/-2 The branch strengthens two existing security-boundary assertions without changing runtime behavior or public configuration.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a narrow test-hardening improvement with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR changes only test assertions and no user-visible runtime behavior; its PR body nevertheless supplies a detailed Testbox transport-boundary fault-injection trace.

Label justifications:

  • P3: This is a narrow test-hardening improvement with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR changes only test assertions and no user-visible runtime behavior; its PR body nevertheless supplies a detailed Testbox transport-boundary fault-injection trace.

Evidence

What I checked:

Likely related people:

  • Alix-007: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

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 SsrFBlockedError with the asserted private-network reason. This is the bounded repair at the existing real transport boundary. Production +0/-0; tests +12/-2 (net +10) across two files, preserving servers, auth setup, zero-request checks and deadlines.

Actual clean Linux proof: Testbox run 33473362777, lease tbx_01m1dppjs1xcp7xnc3eczv0x2v (stopped/completed). Candidate transport: 7 passed. Old generic matcher plus a synthetic one-shot ordinary auth error: 4 negatives passed, including zero requests. Same fault with tightened assertions: all 4 failed at the intended matcher mismatch. Restored exact candidate plus sibling suites: 43 passed, 0 skipped/errors; tree and file hashes verified. A scratch collector parsing retry was corrected and the complete ordered sequence rerun.

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 -t 'blocks .*loopback', testing each tightened provider separately. This synthetic pre-transport rejection does not reproduce or fix the separate historical first-POST deadline failure in CI33419303058/job99577833447; why that run's negative cases passed remains unknown. Proceeding through native prepare/merge, subject to its fresh admission checks.

@steipete
steipete merged commit 1d54f21 into main Sep 1, 2026
182 checks passed
@steipete
steipete deleted the steipete/frosty-shtern-11ea5f branch September 1, 2026 06:20
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: deepinfra extensions: xai maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant