Skip to content

fix: bound response read in extension download command - #3776

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/unbounded-extension-download
Open

fix: bound response read in extension download command#3776
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/unbounded-extension-download

Conversation

@Quratulain-bilal

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

Copy link
Copy Markdown
Contributor

Summary

Replace unbounded
esponse.read()\ with
ead_response_limited()\ in \extensions/_commands.py\ to prevent DoS via oversized ZIP downloads from user-supplied URLs.

Changes

  • Added \ rom .._download_security import MAX_DOWNLOAD_BYTES, read_response_limited\ import
  • Replaced \zip_data = response.read()\ with \zip_data = read_response_limited(response, max_bytes=MAX_DOWNLOAD_BYTES)\ at line 536

Replace unbounded response.read() with read_response_limited() in
extensions/_commands.py to prevent DoS via oversized ZIP downloads
from user-supplied URLs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Bounds ZIP downloads from custom extension URLs to mitigate memory-exhaustion attacks.

Changes:

  • Imports the shared download-size limiter.
  • Caps downloaded ZIP responses at 50 MiB.
Show a summary per file
File Description
src/specify_cli/extensions/_commands.py Applies bounded reads to custom extension downloads.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Medium

download_url, timeout=60, extra_headers=extra_headers
) as response:
zip_data = response.read()
zip_data = read_response_limited(response, max_bytes=MAX_DOWNLOAD_BYTES)
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.

3 participants