fix: bound response reads in workflow catalog fetch - #3813
Open
Quratulain-bilal wants to merge 1 commit into
Open
fix: bound response reads in workflow catalog fetch#3813Quratulain-bilal wants to merge 1 commit into
Quratulain-bilal wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Bounds workflow and step catalog response reads to mitigate oversized-response denial-of-service risks.
Changes:
- Applies the 1 MiB metadata limit to both catalog fetch paths.
- Raises catalog-specific errors for oversized responses.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/workflows/catalog.py |
Adds bounded reads for workflow and step catalogs. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
src/specify_cli/workflows/catalog.py:1219
- Please cover the step-catalog path independently with an oversized streamed response and assert that JSON parsing is not attempted. This is a separate fetch implementation, and the existing
read_response_limitedunit tests do not verify that this call site continues to enforce the catalog-size boundary.
read_response_limited(resp, max_bytes=MAX_JSON_METADATA_BYTES, error_type=StepCatalogError)
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Medium
| _validate_catalog_url(resp.geturl()) | ||
| data = json.loads(resp.read().decode("utf-8")) | ||
| data = json.loads( | ||
| read_response_limited(resp, max_bytes=MAX_JSON_METADATA_BYTES, error_type=WorkflowCatalogError) |
mnriem
requested changes
Jul 28, 2026
mnriem
left a comment
Collaborator
There was a problem hiding this comment.
Please address Copilot feedback and resolve conflicts
…ver reached on oversized responses - Add test_fetch_skips_json_parse_on_oversized_response for WorkflowCatalog - Add test_fetch_skips_json_parse_on_oversized_response for StepCatalog - Both tests patch json.loads to verify it is never called when response exceeds limit Fixes github#3813
Quratulain-bilal
force-pushed
the
fix/unbounded-workflow-catalog-read
branch
from
July 28, 2026 23:01
79d4f70 to
499de73
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace 2 unbounded
esp.read() calls with
ead_response_limited() in workflows/catalog.py (WorkflowCatalog and StepCatalog fetch paths) to prevent DoS via oversized catalog responses.