Skip to content

fix(external): guard AlibabaCloud image downloads - #9525

Open
wunianze666-netizen wants to merge 1 commit into
invoke-ai:mainfrom
wunianze666-netizen:codex/fix-alibabacloud-image-ssrf
Open

fix(external): guard AlibabaCloud image downloads#9525
wunianze666-netizen wants to merge 1 commit into
invoke-ai:mainfrom
wunianze666-netizen:codex/fix-alibabacloud-image-ssrf

Conversation

@wunianze666-netizen

Copy link
Copy Markdown
Contributor

Summary

  • route AlibabaCloud image URLs returned by DashScope through InvokeAI's socket-level SSRF-guarded session instead of the module-level requests.get() path
  • reject loopback/private peers at the connected socket, preserving protection across redirects and DNS rebinding
  • retain the existing streamed 32 MiB response cap and translate refused URLs into the provider error boundary
  • add a regression that fails if provider-response downloads fall back to unguarded requests

The submit and task-poll requests are unchanged; this patch only hardens the follow-up fetch of provider-generated image URLs.

Related Issues / Discussions

Refs #9493, specifically follow-up item 4.

This PR intentionally does not close #9493 because that issue tracks several independent security follow-ups.

QA Instructions

  • confirmed the new regression fails on unmodified main because _download_image() calls unguarded requests.get()
  • python -m pytest tests/app/services/external_generation/test_alibabacloud_provider.py -q — 9 passed
  • python -m pytest tests/app/services/external_generation -q — 46 passed
  • focused socket-guard coverage for loopback, DNS rebinding, percent-encoded hosts, and both URL schemes — 4 passed
  • Ruff check and format-check passed for both changed files
  • git diff --check passed

Reviewer focus: build_guarded_session() intentionally ignores ambient proxy variables so destination resolution remains in-process and the connected peer can be checked. This matches the existing download security boundary.

Merge Plan

No special merge steps are required. The patch is limited to the AlibabaCloud provider and its focused tests; it changes no schemas, generated assets, configuration, or release metadata.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Redux migration is not applicable; no Redux state changed
  • Documentation is not applicable; no public API or configuration changed
  • What's New copy is not applicable; this is not a release PR

@github-actions github-actions Bot added python PRs that change python files services PRs that change app services python-tests PRs that change python tests labels Aug 22, 2026
@lstein lstein self-assigned this Aug 24, 2026
@lstein lstein added the 6.14.1 label Aug 24, 2026
@lstein lstein moved this to 6.14.1: Bug fixes to 6.14.0 in Invoke - Community Roadmap Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.14.1 python PRs that change python files python-tests PRs that change python tests services PRs that change app services

Projects

Status: 6.14.1: Bug fixes to 6.14.0

Development

Successfully merging this pull request may close these issues.

Download-queue SSRF follow-ups (from #9492 review)

2 participants