-
Notifications
You must be signed in to change notification settings - Fork 3
fix : 웹소켓 cors 오류 수정 #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. """ WalkthroughCORS 설정이 변경되어, 허용 오리진 방식을 패턴 매칭으로 전환하고, credentials 지원 및 모든 헤더 노출이 허용되었습니다. WebSocket 설정 파일에는 의미 없는 공백 한 줄이 추가되었습니다. 코드의 기능적 동작에는 영향이 없습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant SecurityConfig
participant Server
Client->>SecurityConfig: CORS 요청 전송
SecurityConfig->>SecurityConfig: Origin 패턴 검사, credentials 및 헤더 설정
SecurityConfig-->>Client: CORS 응답 반환 (패턴, credentials, 모든 헤더 허용)
Client->>Server: 인증된 요청 수행
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/org/ezcode/codetest/infrastructure/event/config/WebSocketConfig.java (1)
57-57: 공백 라인 제거 제안
configureMessageBroker메서드 끝에 추가된 불필요한 빈 줄은 제거하여 코드 포맷 일관성을 유지하는 것이 좋습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/org/ezcode/codetest/infrastructure/event/config/WebMvcCorsConfig.java(1 hunks)src/main/java/org/ezcode/codetest/infrastructure/event/config/WebSocketConfig.java(1 hunks)
🔇 Additional comments (1)
src/main/java/org/ezcode/codetest/infrastructure/event/config/WebMvcCorsConfig.java (1)
12-13: SockJS Fallback 경로 확인 요청
/ws/**패턴이/ws/info,/ws/**같은 SockJS Fallback 엔드포인트를 모두 포함하는지 로컬 테스트를 통해 검증해주세요.
src/main/java/org/ezcode/codetest/infrastructure/event/config/WebMvcCorsConfig.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java (2)
139-139: 모든 헤더 노출에 대한 보안 검토가 필요합니다.모든 헤더를 노출하는 설정은 잠재적인 보안 위험이 있을 수 있습니다. 필요한 특정 헤더만 노출하는 것을 고려해보세요.
예를 들어:
-configuration.setExposedHeaders(List.of("*")); +configuration.setExposedHeaders(List.of("Authorization", "Content-Type", "X-Custom-Header"));
140-140: credentials 허용 설정이 올바르게 추가되었습니다.WebSocket 통신에서 인증 정보를 포함한 요청을 처리하기 위해
setAllowCredentials(true)설정이 필요합니다. 이는 WebSocket CORS 오류 해결을 위한 적절한 변경사항입니다.다만 보안을 위해 프로덕션 환경에서는 특정 도메인만 허용하도록 origin 패턴을 더 구체적으로 설정하는 것을 권장합니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java(2 hunks)
🔇 Additional comments (1)
src/main/java/org/ezcode/codetest/common/security/config/SecurityConfig.java (1)
136-136: 올바른 CORS origin 설정 변경입니다.
setAllowedOrigins에서setAllowedOriginPatterns로 변경한 것은 올바른 수정입니다. credentials가 true로 설정될 때setAllowedOrigins("*")는 작동하지 않기 때문입니다.
작업 내용
변경 사항
UserService.createUser()메서드 추가@Email유효성 검증 적용트러블 슈팅
@Transactional이 적용되지 않음this.→AopProxyUtils.사용)해결해야 할 문제
UserController에서 비즈니스 로직 일부 처리 → 서비스로 이전 고려 필요참고 사항
코드 리뷰 전 확인 체크리스트
type :)Summary by CodeRabbit