Skip to content

fix: bound response reads in preset catalog and download (import of github/spec-kit#3778) - #109

Open
one-kash wants to merge 4 commits into
mainfrom
import/pr-3778
Open

fix: bound response reads in preset catalog and download (import of github/spec-kit#3778)#109
one-kash wants to merge 4 commits into
mainfrom
import/pr-3778

Conversation

@one-kash

Copy link
Copy Markdown

Imported from upstream PR github#3778
Original author: @Quratulain-bilal
Original head branch: fix/unbounded-presets-catalog-read


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)
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.

2 participants