Skip to content

[ Chatbot ] 요청 파라미터의 userId 로 남의 상담 내역을 읽을 수 있다 #100

Description

@RosieOh

💚 어떤 기능인가요?

챗봇 조회 7종이 요청 파라미터의 userId 를 그대로 파사드에 넘긴다.
로그인만 하면 남의 userId 를 적어 다른 사람의 상담 내역과 세션을 읽을 수 있다.

publicResponseEntity<List<ChatbotChatHistoryDtoResponse>> searchMessagesByKeyword(
@RequestParamStringuserId, // 클라이언트가 준 값@RequestParamStringkeyword) {
returnResponseEntity.ok(chatbotFacade.searchMessagesByKeyword(userId, keyword));
}
경로
GET /chatbot/messages/intent
GET /chatbot/messages/date-range
GET /chatbot/messages/helpful
GET /chatbot/messages/search
GET /chatbot/sessions/status
GET /chatbot/sessions/date-range
GET /chatbot/sessions/count

챗봇은 육아 상담이라 대화에 아이 건강·가정 사정이 담긴다.
서비스 계층에도 소유권 검증이 없다.

같은 도메인의 HealthControllerNotificationController 는 이미 클라이언트가 준
userId 를 무시하고 인증 주체를 쓴다(requireNotificationUserIdMatchesCurrent,
getAuthenticatedUserPk). 챗봇만 빠져 있었다.

/chatbot/chat, /history, /sessions 세 곳은 원래부터
currentUserFacade.requireCurrentUserId() 를 쓰고 있어 안전하다.

✅ To Dos

  • 조회 대상을 인증 주체로 교체 (파라미터는 호환을 위해 남기되 사용하지 않음)
  • 회귀 테스트 — 남의 userId 를 넣어도 파사드에 인증 주체가 전달되는지

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions