Repository navigation
[Bug]: Admit reasoning-envelope allocations before translation materialization #3861
Description
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
Ingwannu commentedon Sep 7, 2026
Fix submitted as Draft PR #3862, targeting dev at head 9bcb774. @lidge-jun 긴급 검토 부탁드립니다. 관련 272개 검사와 추가 HTTP 처리 3개가 통과했고, 타입 검사·문서 빌드·독립 코드 검토도 완료했습니다. 전체·플랫폼 CI 및 최종 보안 승인 전이라 Draft로 유지하며 아직 병합하지 않았습니다. 이슈도 실제 랜딩 전까지 열어 둡니다.
lidge-jun commentedon Sep 7, 2026
리뷰 · 우선순위 62 / 80
이 이슈는 Claude/브리지 경로에서 reasoning envelope(추론 봉투)를 만들 때, JSON·Base64 복사본을 먼저 만든 뒤에야 번역기 예산(translator budget)을 검사하던 순서를 문제로 잡습니다. 큰 thinking/signature가 오면 한도를 넘겼다는 걸 알기 전에 메모리를 먼저 쓸 수 있습니다. 보고자는 자격 증명 유출이나 코드 실행이 아니라 가용성(availability) 강화 결함이라고 분명히 적었고, 작은 합성 픽스처로 “고치기 전 실패 → 고친 뒤 통과”만 확인했다고 했습니다. 실제 서버를 다운시키는 공격 레시피나 운영 트래픽 수치는 공개 이슈에 넣지 않은 점이 올바릅니다.
현재
devHEADd00615d56를 보면src/responses/reasoning-envelope.ts의 encode/decode는 여전히 직렬화 후 붙이는 형태이고,src/lib/translator-budget.ts의admit/charge는 이미 턴 바이트 한도를 갖고 있습니다. 구멍은 “예산을 언제 재느냐”에 가깝습니다. 이슈가 가리킨 파일(src/claude/inbound.ts,reasoning-envelope.ts,src/server/claude-messages.ts,translator-budget.ts)은 지금도 그 경로에 있습니다. 미리보기 배포나 types.ts/config.ts 대분할과는 무관한 보안·가용성 정정입니다.이미 연결된 작업이 있습니다. Draft #3862가 원본 수정이고, 유지보수 캐리 #3879(
fix: admit reasoning envelope and request copies before materialization)가 그 내용을 이어받아dev위에 올려 둔 상태입니다. #3879는 사전 크기 측정(json-byte-size),reserveTransient후 실제 문자열 생성, Claude HTTP의 413 매핑, 브리지 종료 정리까지 묶여 있고, 그 위에 #3880·#3881 스택이 이어집니다. 이슈 본문의 “수정 PR을 바로 연결”은 #3862로 충족되었고, 실제로dev에 넣을 차량은 #3879 쪽입니다. 이슈를 따로 재현·확장할 필요는 거의 없고, 추적 이슈로 열어 둔 뒤 캐리 머지와 함께 닫는 편이 맞습니다.우선순위는 “지금 바로 이슈만으로 새 작업을 열 가치”보다 “이미 올라온 캐리를 막힘 없이 랜딩할 가치”에 가깝습니다. 보고 품질은 좋고, 긴급 검토 요청도 이유가 있습니다. 다만 운영 스트레스 테스트나 CVE 번호는 없고, 증거는 단위 픽스처·핸들러 413 중심입니다. 메인테이너가 볼 실무 질문은 “#3862를 리베이스할지 vs #3879만 밀어 넣을지”이며, 후자가 이미 리뷰·스택 기준으로 정해져 있습니다.
src/responses/reasoning-envelope.ts- 현재 HEAD는 직렬화 후 붙입니다. 이슈가 지적한 “복사 전 승인”은 #3879에서 예산 인자·사전 측정으로 바뀝니다.src/lib/translator-budget.tsadmit- 한도 자체는 이미 있습니다. 문제는 호출 시점입니다.src/claude/inbound.ts/src/server/claude-messages.ts- 이슈가 지목한 변환·최종 Request 경로. 캐리가 공유 예산과 413을 붙입니다.Draft PR #3862 - 원본. #3879 캐리가 우선이므로 리베이스하지 말고 landed-via로 닫을 대상입니다.
메인테이너의 판단이 필요한 지점
Landed via #3879 at <commit>+landed-via-maintainer로 닫을지(권장)너의 추천
이슈는 추적만 하고 새 패치를 또 받지 마세요. #3879 → #3880 → #3881 순으로 합친 뒤 이 이슈와 #3862를 landed-via로 닫으세요. types/config 분할과도 무관합니다.
이 댓글은 grok-bot이 작성했습니다
lidge-jun commentedon Sep 7, 2026
Fixed on
devby #3879 (mergeb0bcb4b10), carrying @Ingwannu's #3862: reasoning-envelope allocations are now reserved against the live translator budget before serialization, and the shared accounting is threaded through the bridge and Claude outbound helpers. Ships in the next release.