Skip to content

fix: bound fallback response read in preset download - #3777

Open
Quratulain-bilal wants to merge 3 commits into
github:mainfrom
Quratulain-bilal:fix/unbounded-preset-download-fallback
Open

fix: bound fallback response read in preset download#3777
Quratulain-bilal wants to merge 3 commits into
github:mainfrom
Quratulain-bilal:fix/unbounded-preset-download-fallback

Conversation

@Quratulain-bilal

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

Copy link
Copy Markdown
Contributor

Summary

Replace unbounded
esponse.read()\ fallback in \presets/_commands.py\ with
ead_response_limited()\ to prevent DoS via oversized preset archive downloads.

Changes

  • Added \MAX_DOWNLOAD_BYTES\ and
    ead_response_limited\ to the existing _download_security\ import
  • Replaced \output.write(response.read())\ with \output.write(read_response_limited(response, max_bytes=MAX_DOWNLOAD_BYTES))\ in the \TypeError\ fallback path at line 172

Replace unbounded response.read() fallback in presets/_commands.py
with read_response_limited() to prevent DoS via oversized preset
archive downloads.

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

Attempts to bound preset archive downloads using the shared response-size limiter.

Changes:

  • Imports the shared 50 MiB download limit and reader.
  • Applies the limiter in the TypeError fallback path.
Show a summary per file
File Description
src/specify_cli/presets/_commands.py Adds bounded fallback response reading.

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

Comment thread src/specify_cli/presets/_commands.py Outdated
@mnriem
mnriem requested a review from Copilot July 29, 2026 14:18

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.

Copilot wasn't able to review any files in this pull request.

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