Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 43 minutes and 35 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: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 Walkthrough개요로그인 및 토큰 재발급 요청에 대한 Redis 기반 IP별 레이트 리미팅을 구현하였습니다. 새로운 변경사항로그인 레이트 리미팅
추정 코드 리뷰 노력🎯 3 (보통 난이도) | ⏱️ ~20분 관련 이슈
관련 PR
시
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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.
Inline comments:
In
`@src/main/java/soon/fridgely/global/security/ratelimit/LoginRateLimitAspect.java`:
- Around line 51-58: The current logic in LoginRateLimitAspect that trusts
request.getHeader("X-Forwarded-For") and request.getHeader("X-Real-IP") is
unsafe; change it so headers are only used when the request originates from a
trusted proxy (validate the incoming request.getRemoteAddr() against a
configured trustedProxy list) and otherwise fall back to
request.getRemoteAddr(); update the IP-extraction logic in the method that reads
headers (the code handling "X-Forwarded-For" and "X-Real-IP") to perform this
trusted-proxy check before splitting/returning header values and ensure a secure
default uses request.getRemoteAddr().
In
`@src/test/java/soon/fridgely/global/security/ratelimit/LoginRateLimitAspectUnitTest.java`:
- Around line 61-73: The test TTL이_없는_키는_expire를_설정한다 currently asserts expire
was called with any Duration, which won't catch regressions to the 60s window;
change the assertion to verify stringRedisTemplate.expire was called with the
exact Duration.ofSeconds(60) (or the constant used by LoginRateLimitAspect) for
the key "login:ratelimit:192.168.1.1" so the test fails if the TTL value
changes.
- Around line 103-140: The tests only assert no exception from
aspect.checkRateLimit() but don’t verify the actual Redis keys used; modify each
test (e.g., XForwardedFor_헤더의_첫번째_IP를_Rate_Limit_키로_사용한다,
XRealIP_헤더가_있으면_해당_IP를_Rate_Limit_키로_사용한다,
헤더가_없으면_remoteAddr를_Rate_Limit_키로_사용한다) to also verify the interactions: after
calling aspect.checkRateLimit() use Mockito.verify to assert
valueOperations.increment("login:ratelimit:<expected-ip>") was called and
Mockito.verify(stringRedisTemplate).getExpire("login:ratelimit:<expected-ip>")
(and optionally verifyNoMoreInteractions/valueOperations or
verifyNoMoreInteractions(stringRedisTemplate)) so the tests fail if a different
key is used.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fa611a15-1675-4cd2-8309-6894c0281f74
📒 Files selected for processing (5)
src/main/java/soon/fridgely/domain/auth/controller/AuthController.javasrc/main/java/soon/fridgely/global/security/ratelimit/LoginRateLimit.javasrc/main/java/soon/fridgely/global/security/ratelimit/LoginRateLimitAspect.javasrc/main/java/soon/fridgely/global/support/exception/ErrorType.javasrc/test/java/soon/fridgely/global/security/ratelimit/LoginRateLimitAspectUnitTest.java
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary by CodeRabbit
릴리스 노트
New Features
Tests