Repository navigation
fix: bound response reads in workflow catalog fetch - #3813
Quratulain-bilal wants to merge 2 commits into
Conversation
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
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback and resolve conflicts
79d4f70 to
499de73
Compare
…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
…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
499de73 to
5cd8d6b
Compare
There was a problem hiding this comment.
Review details
Suppressed comments (1)
tests/test_workflows.py:6721
- The described production fix is absent from the proposed changes: this PR only adds tests, while both
read_response_limited()calls inworkflows/catalog.pyare already present and the immediately preceding regression tests already verify oversized responses are rejected. As submitted, these additions neither perform the stated replacement nor add distinct coverage. Please either include the intended production diff (if it is still needed) or revise the PR scope and avoid duplicating the existing tests.
def test_fetch_skips_json_parse_on_oversized_response(
self, project_dir, monkeypatch
):
"""Regression: json.loads must never be reached when the response
exceeds MAX_JSON_CATALOG_BYTES — the bounded reader must reject it
first."""
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Balanced
…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
5cd8d6b to
f6d288a
Compare
There was a problem hiding this comment.
Review details
Suppressed comments (1)
tests/test_workflows.py:7742
- The production change described by this PR is absent from the diff: only regression tests are added, while the adjacent pre-existing oversized-response tests already verify the same size-limit error for both catalog paths. Please include the intended
workflows/catalog.pyreplacements, or update the PR scope and consolidate this assertion into the existing tests if that fix has already landed elsewhere.
def test_fetch_skips_json_parse_on_oversized_response(
self, project_dir, monkeypatch
):
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
Please address test & lint errors |
|
This pull request has been automatically marked as stale because it has had no activity for 60 days. It will be closed in 30 days unless there is a substantive update. If you intend to continue, please describe the current status, address or acknowledge outstanding feedback, and confirm whether the branch can be updated and the change remains ready for review. A comment that only states that the pull request is "still relevant" does not provide enough context for maintainers. |
| from specify_cli.workflows import catalog as catalog_module | ||
| from specify_cli.workflows.catalog import ( | ||
| StepCatalog, | ||
| StepCatalogEntry, | ||
| StepCatalogError, | ||
| ) |
|
Please address Copilot feedback |

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.