Skip to content

Conversation

@GoGradually
Copy link
Collaborator

변경된 점

  • 회원 ID 주입 방식을 Authorization 헤더에서 X-Member-Id 헤더로 변경

Copilot AI review requested due to automatic review settings December 31, 2025 10:11
@GoGradually GoGradually merged commit 576765d into master Dec 31, 2025
1 check passed
@GoGradually GoGradually deleted the feat/MemberId-주입-방식-변경 branch December 31, 2025 10:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

이 PR은 회원 ID 주입 방식을 JWT 기반 Authorization 헤더에서 X-Member-Id 헤더로 변경합니다.

주요 변경사항:

  • JWT 토큰 검증 로직 제거
  • X-Member-Id 헤더에서 직접 회원 ID를 추출하도록 변경
  • resolveToken() 메서드 제거

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.
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.

문제점: 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants