Skip to content

fix(client): cap batch fetch concurrency#112

Merged
chaliy merged 2 commits into
mainfrom
2026-05-17-fix-unbounded-concurrency-in-batch-fetch-api
May 17, 2026
Merged

fix(client): cap batch fetch concurrency#112
chaliy merged 2 commits into
mainfrom
2026-05-17-fix-unbounded-concurrency-in-batch-fetch-api

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 17, 2026

Motivation

  • Prevent unbounded caller-controlled concurrency in the public batch APIs that could exhaust runtime resources and enable application-level DoS.

Description

  • Add MAX_BATCH_CONCURRENCY constant set to 20 to impose a conservative upper bound.
  • Clamp effective concurrency with .clamp(1, MAX_BATCH_CONCURRENCY) in batch_fetch_with_options instead of only enforcing a minimum.
  • Add a unit test test_batch_fetch_caps_caller_concurrency that passes usize::MAX to verify oversized caller input is safely handled.

Testing

  • Ran targeted unit tests for batch fetching; the following tests passed: test_batch_fetch_caps_caller_concurrency, test_batch_fetch_respects_concurrency_limit, test_batch_fetch_multiple_urls, test_batch_fetch_partial_failure, and test_batch_fetch_empty_input (all OK).
  • Executed cargo test --workspace batch_fetch which completed successfully for the relevant test suites.

Codex Task

@chaliy chaliy merged commit 5956929 into main May 17, 2026
11 checks passed
@chaliy chaliy deleted the 2026-05-17-fix-unbounded-concurrency-in-batch-fetch-api branch May 17, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant