48d0e27136
* fix: SSRF in Image/Gallery SVG and Audio postprocess via safehttpx `image_utils.extract_svg_content` (Image/Gallery SVG postprocess) and `Audio` streaming postprocess fetched user-influenced URLs with bare `httpx`, with no SSRF protection (no private-IP filter, domain allow-list, or redirect re-validation), inlining/returning internal responses to the client (read-SSRF, CWE-918, GHSA-3xvj-7669-6whx). Route both through a new `processing_utils.async_ssrf_protected_get` helper that uses `safehttpx` with `PUBLIC_HOSTNAME_WHITELIST` and redirect re-validation, consistent with `async_ssrf_protected_download`. Add a semgrep rule (`no-bare-httpx-url-fetch-ssrf`) banning bare `httpx` request functions in `gradio/components/`, `image_utils.py`, and `processing_utils.py` to prevent regressions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Apply suggestion from @abidlabs * Apply suggestion from @abidlabs * changes * Harden SSRF-protected redirect handling per review - Bound the redirect loop in async_ssrf_protected_get with MAX_REDIRECTS to prevent an attacker-controlled redirect cycle from looping indefinitely. - Resolve each redirect Location with urljoin against the URL that produced it, so relative/scheme-relative redirects and cross-host hops resolve per RFC 3986 (the previous string-concat used the stale original host). - Refactor async_ssrf_protected_download to reuse async_ssrf_protected_get, removing the duplicate redirect loop. - Update test_extract_svg_content_from_url to patch the SSRF-protected helper, since extract_svg_content no longer calls httpx.get directly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Apply ruff format to test_image_utils Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test: cover SSRF-protected GET private requests * fix: handle redirects without Location header --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>