Skip to content

[Bug]: Admit reasoning-envelope allocations before translation materialization #3861

Description

@Ingwannu

Client or integration

Direct HTTP/API client

Area

Proxy and routing

Summary

Reasoning-envelope conversion must admit its projected allocation before materializing serialization copies. The current translated Anthropic Messages path performs envelope conversion before its final translation-budget charge. This is an availability-hardening defect, not a report of credential disclosure or code execution.

The prepared fix adds preflight JSON sizing, encoding/decoding reservations, cumulative inbound accounting, and allocation-free sizing of the final translated body. Normal signatures and opaque reasoning data must remain unchanged; truncation is not an acceptable fallback. Native passthrough, authentication and routing behavior remain unchanged.

This is a manually verified code-based report following an operator-supplied Codex Security notification, not an imported sealed scanner record. No canonical finding ID or CVE has been assigned here.

@lidge-jun 긴급 검토 부탁드립니다. 추론 데이터 변환 시 메모리 한도를 복사 전에 검사하도록 하는 수정입니다. 작은 테스트 한도로 기존 코드의 실패와 수정 후 통과를 확인했습니다. 수정 PR을 바로 연결하겠습니다. 실제 서버를 중단시키는 테스트는 하지 않았고, 알림에 나온 특정 메모리 사용량은 실측 사실로 주장하지 않습니다.

Reproduction

Validated with small, synthetic unit fixtures and injected translator budgets in isolated test homes, not with large requests or a live server stress test. The unchanged base fails nine admission regressions; the candidate passes the corresponding encoding, decoding and cumulative-accounting checks. Three actual-handler checks additionally verify typed HTTP 413, no upstream dispatch, and budget disposal.

The linked patch carries the bounded regression tests. An operational attack recipe and production request data are intentionally excluded from this public report.

Version

Observed introducing change: 58fcb09. Patch tested against dev 6cf38b5. The affected implementation is unchanged in the freshly fetched dev ece556a.

Operating system

Local Linux x86_64 validation with Bun 1.4.0. Windows/macOS execution remains pending; no platform-specific production behavior is claimed.

Provider and model

Provider-independent inbound reasoning conversion; tests use synthetic data and no provider account.

Logs or error output

  • Focused conversion/bridge/parser/budget tests: 272 passed, zero failures.
  • Additional HTTP handler cases: 3 passed.
  • Small-fixture negative control on the unchanged implementation: 9 expected failures.
  • TypeScript, privacy scan, and diff check passed.
  • Documentation build: 425 pages, successful with existing warnings.
  • Independent read-only scoped code review found no concrete remaining bypass or legitimate regression. Full repository and platform CI are still pending.

Screenshots and supporting files

Relevant code: src/claude/inbound.ts, src/responses/reasoning-envelope.ts, src/server/claude-messages.ts, and src/lib/translator-budget.ts. The forthcoming linked PR contains implementation, regression tests, and documentation.

Redacted configuration

No real configuration or credentials are required for the bounded tests. Production settings and daemons were not changed.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingproxyHTTP proxy, routing, reverse-proxy / management auth

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions