Skip to content

fix(etl): bound HTTP payloads before MVC materialization - #248

Closed
seonghobae wants to merge 5 commits into
developfrom
security/etl-http-payload-bound-c2511f6
Closed

fix(etl): bound HTTP payloads before MVC materialization#248
seonghobae wants to merge 5 commits into
developfrom
security/etl-http-payload-bound-c2511f6

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Advance #247 from exact protected develop@c2511f6b9d716ef9ab8de60a91fffd826714a4c5 without touching the active EtlController (#236), EtlService (#199), etl-service/pom.xml (#164), or canonical-documentation (#149) writer lanes.

The protected implementation enforced xtrmetl.etl.max-payload-bytes only inside EtlService, after Spring MVC had materialized @RequestBody String. This Draft now adds an endpoint-scoped RequestBodyAdvice guard that rejects known oversized Content-Length before reading the entity and bounds unknown/understated streams to at most configured-limit-plus-one byte before raising the existing typed etl_payload_too_large error. The service-level check remains defense in depth.

TDD / exact-head evidence

  • RED fd8b330a09fb8ea6055974086241e0acc96ba2cc: endpoint tests proved both known-length and unknown/chunked oversized bodies still reached MVC materialization/controller handling without a transport guard.
  • Production candidate 487d1ba950c26deb25495b367a4021a71be46180: added EtlPayloadAdmissionAdvice; hosted CI exposed an IOException propagation compile defect.
  • GREEN fix c77503a6b8867a0afa7d3f9b2c6ab4b57d24412f: propagated stream acquisition errors correctly; hosted full reactor tests passed.
  • Boundary proof a5787de108ae5fcd0389a9b9746e69e7577348a4: added exact configured-limit and just-below-limit HTTP acceptance cases.
  • Current head 4d928203f96c9f4dbcb2ac02846ae7ad531ba03f: added direct stream-consumption proof. Known oversize is rejected after zero body bytes; unknown oversize is rejected after exactly limit+1 bytes; exact-limit unknown-length input reaches EOF normally.

Current hosted CI run 31428935345 passed Ubuntu/macOS/Windows against synthetic PR merge 4fc2ce6075e0b7c4197953b8e98c8c5923d11070 (4d928203... into c2511f6b...). On macOS, etl-service ran 282 tests with zero failures, including EtlPayloadAdmissionAdviceTest 3/3 and EtlHttpPayloadAdmissionTest 4/4; the whole reactor passed. Current-head SBOM, Dependency Review, Semgrep, and Security Scan workflow aggregates report success.

Remaining non-passing gates

Keep Draft. The current ETL JaCoCo configuration is not acceptable coverage evidence: the successful CI log explicitly reports Analyzed bundle 'etl-service' with 0 classes and then vacuously reports that coverage checks were met. PR #164 owns etl-service/pom.xml, so this branch will not race that coverage-gate repair.

Security aggregate success is also not complete vulnerability evidence. Hard Trivy job 93587281876 checked out synthetic merge 4fc2ce6075e0b7c4197953b8e98c8c5923d11070, not the literal source head, and emitted Dependency version cannot be determined. Child dependencies will not be found. before its zero-findings SARIF; issue #196 owns that dependency-graph-completeness gate. It also reproduced the separately tracked 82 MB zipkin.jar large-file warning. Neither warning is converted into a passing gate here.

Current workflows validate the GitHub-generated PR merge revision rather than a literal head checkout, so that distinction remains explicit. There are currently no formal reviews and no review threads on this exact head; therefore no qualifying independent non-author APPROVED review exists.

No EtlController, EtlService, POM, or canonical-documentation file is changed by this PR.

Summary by CodeRabbit

  • 새로운 기능

    • ETL HTTP 요청 본문에 크기 제한을 적용했습니다.
    • 제한을 초과한 요청은 본문 처리 전에 413 Payload Too Large로 거부됩니다.
    • 콘텐츠 길이를 알 수 없는 요청도 실제 초과 여부를 확인해 안전하게 차단합니다.
    • 제한 이하이거나 정확히 제한에 해당하는 요청은 정상 처리됩니다.
  • 테스트

    • 알려진 길이와 청크 전송 요청에 대한 본문 크기 검증을 추가했습니다.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

ETL 컨트롤러의 문자열 요청 본문에 최대 바이트 제한을 추가했다. 알려진 초과 요청은 본문 읽기 전에 거부한다. 길이를 알 수 없는 요청은 제한 스트림으로 초과 바이트를 감지한다. 단위 테스트와 MVC 테스트를 추가했다.

Changes

ETL 페이로드 수용 제어

Layer / File(s) Summary
MVC 페이로드 수용 advice
etl-service/src/main/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdvice.java
EtlController의 문자열 본문에 advice를 적용한다. Content-Length가 제한을 초과하면 즉시 PAYLOAD_TOO_LARGE로 거부한다. 그 외 요청에는 원본 헤더를 유지한 제한 스트림을 연결한다.
초과 바이트 감지 스트림
etl-service/src/main/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdvice.java
단일 바이트와 배열 읽기에서 허용량을 추적한다. 제한을 확인하기 위해 최대 한 바이트를 추가로 읽고, 초과하면 typed payload 예외를 발생시킨다.
HTTP 및 단위 테스트 검증
etl-service/src/test/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdviceTest.java, etl-service/src/test/java/com/xtrmetl/etl/controller/EtlHttpPayloadAdmissionTest.java
알려진 길이와 미상 길이의 초과 본문을 검증한다. 제한값 및 제한 직전 본문은 정상 처리되는지 확인한다. 초과 시 컨트롤러가 호출되지 않는지와 응답 헤더 및 본문을 확인한다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant EtlPayloadAdmissionAdvice
  participant BoundedInputStream
  participant EtlController

  Client->>EtlPayloadAdmissionAdvice: HTTP 문자열 본문 전송
  EtlPayloadAdmissionAdvice->>EtlPayloadAdmissionAdvice: Content-Length 검사
  EtlPayloadAdmissionAdvice->>BoundedInputStream: 미상 길이 본문 래핑
  BoundedInputStream->>BoundedInputStream: 허용량 및 초과 바이트 확인
  BoundedInputStream-->>EtlPayloadAdmissionAdvice: 본문 또는 PAYLOAD_TOO_LARGE 예외
  EtlPayloadAdmissionAdvice->>EtlController: 허용된 본문 전달
Loading

Possibly related issues

  • ContextualWisdomLab/mightyETL#247: EtlPayloadAdmissionAdvice와 알려진 길이 및 미상 길이 요청 테스트가 이슈의 HTTP 경계 페이로드 크기 제한 목표를 구현한다.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 MVC materialization 전에 ETL HTTP payload 크기를 제한하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/etl-http-payload-bound-c2511f6

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

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
etl-service/src/test/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdviceTest.java (1)

89-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

getBody()IOException 전파를 검증하세요.

Line 96은 HttpInputMessage.getBody()를 호출합니다. 현재 테스트는 이 호출이 IOException을 발생시키는 경우를 만들지 않습니다. beforeBodyRead가 해당 예외를 변경하지 않고 전파하는 테스트를 추가하세요. 이 테스트는 PR 목표의 stream acquisition error propagation을 검증합니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@etl-service/src/test/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdviceTest.java`
around lines 89 - 103, Extend EtlPayloadAdmissionAdviceTest with a
beforeBodyRead case using an HttpInputMessage whose getBody() throws
IOException, and assert that the same exception propagates unchanged. Reuse
advice() and requestBodyParameter() while keeping the test focused on stream
acquisition error propagation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@etl-service/src/test/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdviceTest.java`:
- Around line 89-103: Extend EtlPayloadAdmissionAdviceTest with a beforeBodyRead
case using an HttpInputMessage whose getBody() throws IOException, and assert
that the same exception propagates unchanged. Reuse advice() and
requestBodyParameter() while keeping the test focused on stream acquisition
error propagation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9dd9e9c6-831a-45fb-a91f-2a22b030dad6

📥 Commits

Reviewing files that changed from the base of the PR and between c2511f6 and 4d92820.

📒 Files selected for processing (3)
  • etl-service/src/main/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdvice.java
  • etl-service/src/test/java/com/xtrmetl/etl/controller/EtlHttpPayloadAdmissionTest.java
  • etl-service/src/test/java/com/xtrmetl/etl/controller/EtlPayloadAdmissionAdviceTest.java

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