Skip to content

providers: bound error-body reads with httpware max_error_body_bytes#26

Merged
lesnik512 merged 6 commits into
mainfrom
feat/httpware-max-error-body-bytes
Jun 16, 2026
Merged

providers: bound error-body reads with httpware max_error_body_bytes#26
lesnik512 merged 6 commits into
mainfrom
feat/httpware-max-error-body-bytes

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Adopt httpware 0.11.0's max_error_body_bytes cap to bound provider error-body reads — a defensive guard against a hostile or malfunctioning forge endpoint returning an oversized error body.

  • 1 MiB cap on both clients. _MAX_ERROR_BODY_BYTES in semvertag/ioc.py, passed to _build_gitlab_client and _build_github_client. httpware raises ResponseTooLargeError on a 4xx/5xx whose declared Content-Length exceeds the cap, before reading the body.
  • Translation. ResponseTooLargeError (a ClientError, not a StatusError) routes through _translate_transport, which now maps it to a clear ProviderAPIError naming the byte counts; guarded for a None content-length.
  • Docs. architecture/providers.md documents the cap; also corrects a stale send_with_response reference left by the 0.12 bump (now get_with_response).

1 MiB is ~200× the largest plausible GitLab/GitHub JSON error body, so normal operation is unchanged; only pathological responses trip the cap. Closes the planning/deferred.md "httpware bounded-error-body adoption" item.

Test Plan

  • just test — 443 passed, 100% branch coverage (new translation branch + None path + both client-wiring assertions)
  • just lint-ci — eof-fixer, ruff format, ruff check, ty all clean
  • just docs-build — strict mkdocs build clean

🤖 Generated with Claude Code

lesnik512 and others added 6 commits June 16, 2026 16:49
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pagination moved to get_with_response in the httpware 0.12 bump (#24); the
HTTP-client section still named the old helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mark the bundle shipped (status: shipped, pr: 26, outcome filled), move it to
changes/archive/, move its Index line to Archived, and clear the now-resolved
httpware item from deferred.md. architecture/providers.md was promoted in this
PR's earlier commits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit d5046e6 into main Jun 16, 2026
6 checks passed
@lesnik512 lesnik512 deleted the feat/httpware-max-error-body-bytes branch June 16, 2026 14:11
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.

1 participant