Fix: Refactor deployment workflow and fix authentication issues - #70
Merged
Conversation
chore: EC2 SSM 기반 배포 워크플로우로 교체 (deploy-production.yml)
Develop to Main Ver.2
Develop to Main Ver.3
…potency header
- Update AuthServiceImpl to use fresh DB user data during token refresh instead of stale refresh token claims
- Evict Redis user cache (UserCacheEvictEvent) on space creation, joining, and role changes in SpaceServiceImpl
- Allow 'Idempotency-Key' in SecurityConfig CORS configuration
- Make 'Idempotency-Key' request header optional with backend UUID fallback in ProblemController and RoomProblemController
- Add generateUUID fallback helper for non-secure contexts in SpacePage.tsx
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthrough배포 환경 변수와 프록시 헤더 처리를 수정했습니다. 리프레시 토큰 갱신과 사용자 캐시 무효화를 보강했습니다. AI 문제 생성 API의 Changes플랫폼 동작 개선
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SpacePage
participant ProblemController
participant RoomProblemController
participant ProblemGenerationService
SpacePage->>ProblemController: Idempotency-Key 또는 생성 UUID 전송
SpacePage->>RoomProblemController: Idempotency-Key 또는 생성 UUID 전송
ProblemController->>ProblemGenerationService: 문제 생성 요청과 UUID 전달
RoomProblemController->>ProblemGenerationService: 문제 생성 요청과 UUID 전달
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
작업 내용
USER로 강등되는 현상 수정Idempotency-Key헤더 누락으로 인해 발생하던400 Bad Request에러 방지 및 이중 방어 로직 구축변경 사항
1. 토큰 재발급 시 DB 최신 권한 반영 (
AuthServiceImpl.java)/api/auth/refresh호출 시 DB에서 최신 유저 정보를 읽어왔음에도 불구하고, 로그인 시점의 구(舊) Refresh Token 내 클레임(role: USER)을 파싱하여 새 토큰을 재발급하는 오류가 존재User엔티티 정보(UserResponse)를 기반으로MoMoGoUserDetails를 구성하여, 최신ADMIN권한이 적용된 Access Token / Refresh Token을 발급하도록 개선2. 공간 및 유저 역할 변경 시 Redis 캐시 무효화 (
SpaceServiceImpl.java)createSpace), 가입(joinSpace), 역할 변경(changeUserRole) 시 DB는 업데이트되었으나 Redisuser_dtos캐시가 유지되어 일시적 권한 불일치가 발생가능.UserCacheEvictEvent이벤트를 발행하여 Redis 유저 캐시를 즉시 제거(Evict)하도록 동기화.3. AI 문제 생성 멱등성 헤더(
Idempotency-Key) 이중 방어 구축SecurityConfig.java의corsConfigurationSource()허용 헤더(allowedHeaders)에Idempotency-Key를 추가하여 CORS Preflight 차단을 방지.ProblemController.java및RoomProblemController.java에서@RequestHeader(value = "Idempotency-Key", required = false)로 설정하고, 헤더 누락 시 백엔드에서UUID.randomUUID()를 자동 할당하여 클라이언트 구버전 JS 실행 시에도 400 에러가 발생하지 않도록 조치.SpacePage.tsx에서 HTTP/HTTPS 환경 및 구형 브라우저 호환성을 위한generateUUID()폴백 유틸 함수를 구현하여 헤더가 유실되지 않도록 보장.체크리스트
참고 사항
관련 이슈
Summary by CodeRabbit
Idempotency-Key없이도 요청할 수 있으며, 필요한 경우 자동으로 키가 생성됩니다.