fix: 업로드 시간당 총량 제한 적용#652
Conversation
- 비로그인 공개 업로드가 특정 속도로 무제한 지속되지 않도록 IP 기준 시간당 60회 제한을 적용 - 기존 Redis 기반 rate limit을 재사용해 별도 인프라 정책 없이 API 계약에서 429 응답을 보장 - 프록시가 복원한 클라이언트 IP를 기준으로 제한 키를 만들도록 요청 객체를 컨트롤러 인자로 전달 - 같은 IP의 61번째 업로드가 차단되는 통합 테스트로 시간당 총량 제한 회귀를 방지
|
Warning Review limit reached
More reviews will be available in 11 minutes and 3 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🧪 JaCoCo Coverage Report (Changed Files)Summary
Coverage by File
|
- 공개 업로드 API 계약에 사용하지 않는 request 인자가 노출되지 않도록 컨트롤러 시그니처를 정리 - rate limit SpEL에서 현재 요청 IP를 직접 참조할 수 있도록 clientIp 변수를 AOP 컨텍스트에 제공 - 업로드 시간당 제한은 유지하면서 API 입력은 실제 요청 파트와 target만 드러나도록 선택 - clientIp 표현식이 현재 요청의 remoteAddr로 Redis 키를 만드는 단위 테스트를 추가해 회귀를 방지
🔍 개요
🚀 주요 변경 내용
TOO_MANY_REQUESTS429로 응답합니다.💬 참고 사항
server.forward-headers-strategy: framework설정이 있어 Nginx의X-Forwarded-For기반 클라이언트 IP 복원 흐름을 전제로 합니다.limit_req는 순간 폭주 방어로 남기고, 시간당 총량 제한은 애플리케이션 Redis 카운터가 담당합니다.✅ Checklist (완료 조건)