Skip to content

fix(api): bound authentication error response bodies - #23

Open
hostodo-hermes-operations[bot] wants to merge 1 commit into
mainfrom
fix/bound-auth-response-body
Open

hostodo-hermes-operations[bot] wants to merge 1 commit into
mainfrom
fix/bound-auth-response-body

Conversation

@hostodo-hermes-operations

@hostodo-hermes-operations hostodo-hermes-operations Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Summary

  • cap HTTP 401 authentication-error response reads at 2 MiB plus one byte before parsing
  • return ErrAuthenticationResponseTooLarge when an untrusted auth response exceeds the bound
  • preserve existing expired-token and revoked-session classification for bounded responses

Why

api.Client.doRequest previously called unbounded io.ReadAll(resp.Body) on every 401 before returning an authentication error. Commands using the shared client could therefore exhaust local memory on an unexpectedly large proxy or authentication-failure response. This also bypassed command-specific response caps in downstream callers such as odo-cli-admin node placement.

Verification

  • focused 401 tests, including oversized response — PASS
  • go test -count=1 ./... — PASS
  • go vet ./... — PASS
  • go build ./... — PASS
  • gofmt / git diff --check — PASS
  • independent frozen-diff pre-commit review at staged SHA-256 9349b49395aa5d21d75b1860199f651abc9547fb3e2d1fe3eda188c0c53305d1 — PASS

Dependency

This is the shared-client dependency for hostodo/odo-cli-admin#25. Merge this library fix before the admin CLI PR; the admin CLI will pin the reviewed commit so its 2 MiB node-placement response limit also covers HTTP 401 responses.

Merge gate

Do not merge. Hostodo code requires the required review gates and Hassan's explicit approval in the current Slack conversation.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aee6375d-7184-4adf-afd7-f4234d8dad60

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@hostodo-hermes-operations

Copy link
Copy Markdown
Author

Required Hostodo review-role round at e40b94ce (gpt-6-sol-900k via openai-codex):

  • Security: PASS (nits)
  • Performance: PASS
  • Correctness: PASS (nits)

The shared API client's 401 body is capped at 2 MiB, exact-boundary/read-error/body-close coverage is present, and expired/revoked classification is preserved for bounded responses. Follow-ups, not blockers for this scoped PR: device-flow login uses another unbounded response reader, other non-401 responses remain unbounded, and this repository has no Go test/build CI job. Visible checks: Semgrep passed; CodeRabbit skipped the bot-authored PR. The literal Cursor Codex/codex CLI gate has not run. No merge occurred.

@neeythann
neeythann self-requested a review November 6, 2026 14:35
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