Skip to content

fix: bound response reads in preset catalog and download - #3778

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/unbounded-presets-catalog-read
Open

fix: bound response reads in preset catalog and download#3778
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/unbounded-presets-catalog-read

Conversation

@Quratulain-bilal

@Quratulain-bilal Quratulain-bilal commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace unbounded
esponse.read()\ calls with
ead_response_limited()\ in \presets/init.py\ to prevent DoS via oversized catalog or preset archive responses.

Changes

Three call sites fixed:

  • _fetch_single_catalog\ JSON read (catalog metadata) - uses \MAX_JSON_METADATA_BYTES\ (1 MiB)
  • _fetch_catalog\ JSON read (legacy path) - uses \MAX_JSON_METADATA_BYTES\ (1 MiB)
  • \download_preset\ ZIP read (binary download) - uses \MAX_DOWNLOAD_BYTES\ (50 MiB)

Added \ rom .._download_security import MAX_DOWNLOAD_BYTES, MAX_JSON_METADATA_BYTES, read_response_limited.

Replace unbounded response.read() calls with read_response_limited()
in presets/__init__.py to prevent DoS via oversized catalog or preset
archive responses.

Three call sites fixed:
- _fetch_single_catalog JSON read (catalog metadata)
- _fetch_catalog JSON read (legacy path)
- download_preset ZIP read (binary download)
@Quratulain-bilal
Quratulain-bilal requested a review from mnriem as a code owner July 28, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant