fix: SSRF backstop on i2v image URL fetch#7
Open
Johan-de-R wants to merge 1 commit into
Open
Conversation
resolve_image_bytes fetched any customer-supplied http(s) URL server-side with no protection (the # noqa: S310 just silenced the linter), so an attacker could hit cloud metadata (169.254.169.254), localhost, or internal/private ranges -- directly or via redirect. Add _assert_public_host: resolve the host and require every address to be globally routable (rejects private/loopback/link-local/ reserved/multicast), validate before connecting, and re-validate every redirect hop via a custom opener. Residual: DNS-rebinding TOCTOU is not covered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Defense-in-depth backstop now that deepapi resolves the i2v image via MultimodalDownloader (backend ai-dynamo#3220) and the worker normally receives base64. If the worker ever does fetch a URL directly,
resolve_image_bytesnow validates the host resolves to a globally-routable address and re-validates redirects (rejects cloud metadata / localhost / private ranges). Follows #6 (merged).🤖 Generated with Claude Code