Refctor/299 event domain security#300
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughEvent 쿠폰 API의 엔드포인트 입력 방식을 쿼리 파라미터에서 요청 바디 DTO로 전환하고, 동시성 오류 처리를 ChangesEvent 쿠폰 API 요청/응답 구조 및 동시성 개선
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/soongsil/CoffeeChat/domain/assignedcoupon/service/AssignedCouponService.java (1)
132-133:⚠️ Potential issue | 🟠 Major | ⚡ Quick win저장된 대상자 이름과 사용자 이름 비교 시 일관성 문제 - 수정 필요
대상자 등록 시 이름을 trim하여 저장하지만(74번 줄), 비교 시에는
user.getName()을 trim하지 않고 직접 비교합니다(133번 줄, 185번 줄). User 엔티티의 name 필드에 트림 로직이 없으므로, 사용자 이름에 앞뒤 공백이 있으면 논리적으로 동일한 이름이어도 불일치로 판정되어 정상 사용자가 쿠폰 발급을 거부당합니다.133번 줄 수정:
- if (!user.getName().equals(targetName)) { + if (!user.getName().trim().equals(targetName)) {185번 줄 수정:
- if (!user.getName().equals(target.get("name"))) { + if (!user.getName().trim().equals(target.get("name"))) {🤖 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 `@src/main/java/com/soongsil/CoffeeChat/domain/assignedcoupon/service/AssignedCouponService.java` around lines 132 - 133, AssignedCouponService currently compares stored targetName (which was trimmed on save) to user.getName() without trimming the user value; update both comparisons that use user.getName().equals(targetName) (the occurrences where targetName is read from target.get("name")) to trim the user side before comparing (e.g., compare user.getName().trim() to targetName or normalize both sides), ensuring you modify both places in AssignedCouponService where targetName vs user.getName() is checked so leading/trailing whitespace does not cause false mismatches.
🤖 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/com/soongsil/CoffeeChat/domain/assignedcoupon/service/AssignedCouponService.java`:
- Line 74: In AssignedCouponService, avoid calling target.name().trim() directly
because target.name() may be null; move the null-check before trimming or use a
null-safe expression such as String name = target.name() == null ? "" :
target.name().trim() (or Objects.toString(target.name(), "").trim()) so that the
subsequent logic that currently checks for null at line 79 runs against a safe,
trimmed string instead of causing an NPE.
---
Outside diff comments:
In
`@src/main/java/com/soongsil/CoffeeChat/domain/assignedcoupon/service/AssignedCouponService.java`:
- Around line 132-133: AssignedCouponService currently compares stored
targetName (which was trimmed on save) to user.getName() without trimming the
user value; update both comparisons that use user.getName().equals(targetName)
(the occurrences where targetName is read from target.get("name")) to trim the
user side before comparing (e.g., compare user.getName().trim() to targetName or
normalize both sides), ensuring you modify both places in AssignedCouponService
where targetName vs user.getName() is checked so leading/trailing whitespace
does not cause false mismatches.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 06b21dbe-fc08-4860-8020-0db4a6f11031
📒 Files selected for processing (5)
src/main/java/com/soongsil/CoffeeChat/domain/assignedcoupon/service/AssignedCouponService.javasrc/main/java/com/soongsil/CoffeeChat/domain/event/controller/EventController.javasrc/main/java/com/soongsil/CoffeeChat/domain/event/dto/EventCouponIssueRequest.javasrc/main/java/com/soongsil/CoffeeChat/domain/event/dto/EventVerifyQrRequest.javasrc/main/java/com/soongsil/CoffeeChat/domain/event/service/CouponService.java
🔎 Resolved Issue
✅ Title
📄 Content
@RequestParam storePin,@RequestParam qrToken으로 받아 URL 쿼리스트링에 평문 노출 → ALB/Nginx access log, 브라우저 히스토리, Referer 헤더 등 다수 경로로 민감 정보 누출 위험. 전송 단계 보안 취약.tryLock(3, 3, TimeUnit.SECONDS)호출 시 leaseTime 이 명시 → Redisson watchdog 메커니즘이 비활성화됨 → 3초 후 락이 자동 갱신되지 않고 만료. Redis 일시 지연, MySQL 느린 응답 등으로 처리 시간이 3초를 초과할 경우 동일 applicationId 에 대한 동시 요청이 통과하여 중복 발급 가능@NotBlank적용된 record 타입verify-qr요청:{"qrToken": "..."}coupons요청:{"qrToken": "...", "storePin": "..."}POST /api/v2/events/verify-qr의@RequestParam qrToken→@Valid @RequestBody EventVerifyQrRequestPOST /api/v2/events/coupons의@RequestParam qrToken, storePin→@Valid @RequestBody EventCouponIssueRequestReportController등의@Valid @RequestBody컨벤션 유지tryLock(3, 3, TimeUnit.SECONDS)→tryLock(3, TimeUnit.SECONDS)Summary by CodeRabbit
버그 수정 및 개선
버그 수정
개선