웹소켓 STOMP 쿠키 기반 인증 도입 및 SEND 커맨드 실시간 검증#231
Merged
Merged
Conversation
Closed
7ebc66e to
33b06d1
Compare
📊 코드 커버리지 리포트
|
Goder-0
reviewed
May 20, 2026
Contributor
|
PR에 이슈 번호 연결해주세요. |
- [WebSocketConfig] HTTP Handshake 시 accessToken 쿠키를 웹소켓 세션으로 복사하는 HandshakeInterceptor 추가 - [StompHandler] STOMP CONNECT 시 세션(쿠키) 토큰과 헤더 토큰을 모두 지원하도록 하이브리드 인증 로직 구현
33b06d1 to
9f7a57f
Compare
This was referenced May 27, 2026
Open
Goder-0
approved these changes
Jun 1, 2026
Goder-0
left a comment
Contributor
There was a problem hiding this comment.
작업이 완료되었다고 판단되어 승인합니다.
한편, 프론트 대응작업으로 Team-SoFa/linkiving#518 이슈를 생성하였습니다. 해당 이슈를 해결하는 PR이 올라온 이후 머지가 되는것이 좋을 것 같습니다.
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.
관련 이슈
PR 설명
CONNECT) 시점에만 헤더를 통해 인증을 수행하여, 연결 이후 토큰이 만료되거나 비정상적인SEND요청이 들어올 때 이를 방어하지 못하는 보안 취약점이 있었습니다.SEND) 시점마다 토큰의 유효성을 실시간으로 검증하도록 인증 아키텍처를 크게 개선했습니다.작업 내용
1. 웹소켓 엔드포인트 보안 정책 강화 (
SecurityConstants)PERMIT_URLS에 포함되어 무조건 허용되던 웹소켓 경로(/ws/chat/**,/ws/link/**)를 제거하여, 기본적인 Spring Security 인증 정책의 보호를 받도록 변경했습니다.2. 쿠키 기반 Handshake 인터셉터 추가 (
WebSocketConfig)HandshakeInterceptor를 추가했습니다.accessToken을 추출하여 STOMP 세션 정보(attributes)에 저장해 둠으로써, 이후 TCP 통신 단계에서도 토큰 정보에 접근할 수 있도록 하이브리드 인증 기반을 마련했습니다.3. SEND 커맨드 JWT 실시간 검증 (
StompHandler)ChannelInterceptor의preSend로직을 개선하여,CONNECT뿐만 아니라SEND커맨드 유입 시에도 인증을 수행하도록 분기를 확장했습니다.validateAccessToken)하며, 만료되거나 유효하지 않은 토큰으로 메시지를 전송하려 할 경우MessagingException을 발생시켜 원천 차단합니다.