Skip to content

fix(http): bound remote media downloads - #13705

Draft
furionw wants to merge 1 commit into
mainfrom
qiwa/video-reference-download-limits
Draft

fix(http): bound remote media downloads#13705
furionw wants to merge 1 commit into
mainfrom
qiwa/video-reference-download-limits

Conversation

@furionw

@furionw furionw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Why

Dynamo fetches user-supplied remote media through shared HTTP clients, but response size was only known after buffering the complete body. Large or unbounded responses could therefore consume arbitrary memory before callers rejected them. Enforcing an optional limit inside both streaming clients keeps existing uncapped callers unchanged while giving media paths a reliable resource boundary, including across redirects.

What Change

  • Add opt-in response byte limits to both HTTP client implementations.
  • Reject oversized headers and streaming bodies with a shared typed error.
  • Revalidate limits after redirects.
classDiagram
    HttpClient <|-- AiohttpClient
    HttpClient <|-- HttpxClient
    AiohttpClient ..> HttpBodyTooLargeError : rejects oversized streams
    HttpxClient ..> HttpBodyTooLargeError : rejects oversized streams

    note for HttpClient "Defines the optional max-bytes contract"
    note for HttpBodyTooLargeError "Reports one backend-neutral limit failure"
Loading

Test Plan

  • Run focused aiohttp and httpx client tests.
  • Run pre-commit on all changed files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant