Skip to content

Commit c82ee79

Browse files
committed
security: WebSocket 연결 시 사용자 ID 노출 취약성 수정
- WebSocketMiddleware에서 연결 확인 메시지에서 userId 제거 - 보안상 민감한 사용자 식별자 정보 클라이언트 노출 방지 - 연결 상태만 전달하도록 메시지 형식 변경: {"type":"connected","status":"success"} - 모든 테스트 통과 (235/235)
1 parent fb555b6 commit c82ee79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ProjectVG.Api/Middleware/WebSocketMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ private async Task RunSessionLoop(WebSocket socket, string userId)
117117
try {
118118
_logger.LogInformation("WebSocket 세션 시작: {UserId}", userId);
119119

120-
// Send initial connection confirmation
121-
var welcomeMessage = System.Text.Encoding.UTF8.GetBytes($"{{\"type\":\"connected\",\"userId\":\"{userId}\"}}");
120+
// Send initial connection confirmation without exposing user ID
121+
var welcomeMessage = System.Text.Encoding.UTF8.GetBytes("{\"type\":\"connected\",\"status\":\"success\"}");
122122
await socket.SendAsync(
123123
new ArraySegment<byte>(welcomeMessage),
124124
WebSocketMessageType.Text,

0 commit comments

Comments
 (0)