Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,6 @@ public Object resolveArgument(MethodParameter parameter,
log.info("HttpServletRequest is null");
throw new MemberNotFoundException("사용자 정보를 찾을 수 없습니다.");
}

String token = resolveToken(request);
if (token == null || !jwtTokenProvider.validateToken(token)) {
throw new MemberNotFoundException("사용자 정보를 찾을 수 없습니다.");
}

return jwtTokenProvider.getMemberId(token);
}

private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader("Authorization");
if (bearerToken != null && bearerToken.startsWith("Bearer ")) {
return bearerToken.substring(7);
}
return null;
return Long.parseLong(request.getHeader("X-Member-Id"));
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제점: JWT 기반 인증을 제거하고 단순히 X-Member-Id 헤더 값을 신뢰하는 것은 심각한 보안 취약점입니다. 클라이언트가 임의의 Member ID를 헤더에 설정하여 다른 사용자로 위장할 수 있습니다.

영향:

  • 인증(Authentication) 및 인가(Authorization) 우회 가능
  • 사용자 정보 무단 접근 및 조작 가능
  • 전체 시스템의 보안이 심각하게 손상됨

수정 제안:
만약 마이크로서비스 아키텍처에서 API Gateway가 JWT 검증 후 X-Member-Id 헤더를 추가하는 방식이라면, 다음과 같은 보안 조치가 필요합니다:

  1. API Gateway에서만 X-Member-Id 헤더를 설정하도록 보장
  2. 외부 요청에서 직접 X-Member-Id 헤더가 전달되지 않도록 필터에서 차단
  3. 내부 서비스 간 통신임을 검증하는 별도의 인증 메커니즘 추가 (예: 내부 토큰, mTLS 등)

Copilot generated this review using guidance from repository custom instructions.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제점: X-Member-Id 헤더가 null이거나 Long 타입으로 파싱할 수 없는 값일 때 적절한 예외 처리가 없습니다. request.getHeader()가 null을 반환하면 NullPointerException이 발생하고, 숫자가 아닌 문자열이 전달되면 NumberFormatException이 발생합니다.

영향:

  • 명확하지 않은 에러 메시지로 인한 디버깅 어려움
  • 클라이언트에게 적절한 오류 응답을 제공하지 못함
  • 로깅되지 않은 예외 발생 가능

수정 제안:
헤더 값에 대한 null 체크와 파싱 예외 처리를 추가해야 합니다. 예를 들어:

  • 헤더가 null이거나 비어있는 경우 명확한 에러 메시지와 함께 MemberNotFoundException 발생
  • NumberFormatException을 catch하여 적절한 에러 메시지와 함께 MemberNotFoundException으로 변환
  • 에러 발생 시 로깅 추가

Copilot generated this review using guidance from repository custom instructions.
}
}
Loading