Skip to content

fix: bound response reads in workflow catalog fetch - #3813

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

fix: bound response reads in workflow catalog fetch#3813
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/unbounded-workflow-catalog-read

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

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.

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 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_limited unit 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

Comment thread src/specify_cli/workflows/catalog.py Outdated
_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 mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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
Quratulain-bilal force-pushed the fix/unbounded-workflow-catalog-read branch from 79d4f70 to 499de73 Compare July 28, 2026 23:01
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