Skip to content

chore(security): withdraw non-causal multipart DoS mitigation - #817

Closed
seonghobae wants to merge 4 commits into
developfrom
sentinel/fix-dos-form-length-15039624667263622985
Closed

chore(security): withdraw non-causal multipart DoS mitigation#817
seonghobae wants to merge 4 commits into
developfrom
sentinel/fix-dos-form-length-15039624667263622985

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

이 PR이 주장한 Form(max_length=50) 기반 multipart 메모리 DoS 완화는 causal security fix가 아닙니다.

Protected develop@e06b1f3fb10903569124af011da213951e6e2473은 Starlette 1.3.1을 사용합니다. Starlette 공식 Requests 문서의 현재 request.form() 기본 계약은 non-file form field에 max_part_size=1024*1024를 적용하며, 1.3.1 release note는 FormParser에서도 max_fieldsmax_part_size가 parser callback 단계에서 실제 enforce되도록 수정됐음을 명시합니다. FastAPI Form(max_length=50) validation은 이미 multipart parser가 field를 수신한 뒤의 application validation이므로, python-multipart가 무제한 text field를 메모리에 적재한다는 원래 RCA를 해결하지 않습니다.

또한 product boundary는 이미 normalize_language()/normalize_mode()에서 closed supported set으로 검증되어 unsupported string을 422로 거부합니다. 임의의 50자 상한은 별도 buyer/product contract 근거 없이 이 기존 UL을 중복하고, security severity를 뒷받침하지 않습니다.

Concurrent descendant a60d7522b0288a5e8176c5520937bb5e37b57821은 이 Form change에 무관한 pypdf 6.17 dependency/security delta까지 실었습니다. f35f4638d192611360c2c4060f934b6178f023bf에서 그 unrelated delta를 ordinary descendant로 제거해 원래 Form-only tree를 복구했고, 이어 d5ae6d1e23e70153781e5978773a248ecc8aae53에서 causal review 결과에 따라 exact protected tree를 채택했습니다.

Final compare: protected base 대비 ahead 4 / behind 0 / files=[]. 원래 commit과 intervening pypdf commit은 ancestry에 남아 있으며 force push/destructive rebase는 사용하지 않았습니다.

따라서 이 PR에는 보존할 유효 semantic/test/fixture/contract delta가 없습니다. 실제 hostile multipart resource-control gap을 추가로 다룰 경우에는 Starlette의 parser-level max_part_size/max_fields, complete request의 max_body_size 또는 RequestBodyLimitMiddleware, 그리고 PDF upload의 legitimate size contract를 함께 threat-model하고 representative hostile requests로 RED를 먼저 만들어야 합니다. 단순 Pydantic/FastAPI field validation을 parser-memory 증거로 사용하지 않습니다.

References: Starlette Requests (request.form(max_files, max_fields, max_part_size)), Starlette 1.3.1 release notes (#3329/#3331), Starlette request-body limits.

Closed under the explicit no-valid-delta rule; no predecessor GREEN, scanner suppression, gate weakening, source-neutral retrigger, self-approval, or administrator bypass is used.

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 936f96ed-2bd0-4997-b498-1b4699b107fd

📥 Commits

Reviewing files that changed from the base of the PR and between e06b1f3 and f35f463.

📒 Files selected for processing (2)
  • src/newsdom_api/main.py
  • tests/test_parse_endpoint.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

parse 엔드포인트의 languagemode 폼 입력에 최대 50자 제한을 추가했습니다. 각 입력에 51자를 전달하면 HTTP 422 응답을 확인하는 테스트를 추가했습니다.

Changes

parse 입력 검증

Layer / File(s) Summary
폼 입력 길이 제한 및 검증 테스트
src/newsdom_api/main.py, tests/test_parse_endpoint.py
languagemode 폼 입력에 max_length=50을 설정했습니다. 51자 입력이 HTTP 422와 detail 필드를 반환하는지 테스트합니다.

Estimated code review effort: 1 (매우 낮음) | ~5분

Merge Risk: ⚪ Minimal · up to f35f4

The parse endpoint now rejects language and mode form values longer than 50 characters with HTTP 422 responses. The boundary behavior is covered by tests, with no remaining merge-readiness risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 languagemode 폼 입력 길이 제한을 추가하여 DoS 취약점을 완화하는 주요 변경을 정확히 설명합니다. 이모지가 포함되지만 제목의 의미와 범위는 명확합니다.
Description check ✅ Passed 설명은 변경 목적, 영향, 수정 내용, 검증 결과를 포함합니다. 템플릿의 Git Flow targetNotes 섹션은 포함하지 않았지만, 핵심 변경과 검증 정보는 충분히 설명되어 있습니다.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel/fix-dos-form-length-15039624667263622985

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.

@seonghobae seonghobae changed the title 🛡️ Sentinel: [MEDIUM] Fix DoS 취약점 완화를 위한 Form 길이 제한 추가 chore(security): withdraw non-causal multipart DoS mitigation Sep 6, 2026
@seonghobae seonghobae closed this Sep 6, 2026
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