feat: 검증 없는 v1 로그인 제거 및 카카오 앱 검증 추가 - #674
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
배경
POST /api/v1/oauth/login은 요청 본문의email과socialType만 받아 소셜 토큰을 전혀 검증하지 않고 해당 이메일 계정의 JWT를 발급했다. 계정이 없으면 생성까지 했다. 이메일 문자열 하나만 알면 임의 사용자로 로그인할 수 있었고 공개 엔드포인트라 클라이언트를 가리지 않았다.FE가 웹 카카오 로그인을 v2로 전환하면서 이 엔드포인트를 참조하는 클라이언트가 사라졌다. 이번 PR에서 물리적으로 제거하고, 로그인 수단을 카카오·애플 v2 두 가지로 단일화한다.
추가로 v2 카카오 경로에 남아 있던 문제 — 타 앱에서 발급된 카카오 토큰이 그대로 통과하던 것 — 도 함께 막는다.
변경 사항
제거
POST /api/v1/oauth/login및OauthService의 로그인 로직 전체 (login/doLogin/doAppleLogin/doAppleLoginOld/oauthSignUp)POST /api/v1/oauth/restore,BasicLoginRequest,SocialType.BASIC,User.password필드restoreUser()는SocialType.BASIC일 때만 비밀번호를 검사했다. 즉 소셜 계정은 이메일만 알면 타인의 탈퇴 계정을 복구할 수 있었다.OauthRequest,OauthService, 미사용 테스트 더블 4종추가
/v2/user/me호출 전에/v1/user/access_token_info로app_id를 대조한다. 카카오 토큰은 타 앱에서 발급된 것도 그 앱 기준으로는 유효해 사용자 정보 조회가 성공하므로, app_id를 확인하지 않으면 제3자 앱의 토큰으로 우리 서비스에 로그인할 수 있다.POST /api/v2/auth/reissue,PUT /api/v2/auth/token/verify— v1과 동일 동작. 클라이언트 전환을 위해 복제했으며 로직은AuthService하나를 공유한다.유지
POST /api/v1/oauth/reissue,PUT /api/v1/oauth/token/verify— FE가 사용 중인 경로다. 취약점이 아니므로 그대로 둔다. 로직만AuthService로 옮겼다.BCryptPasswordEncoder빈 — monoAdminAuthService(관리자 비밀번호 검증)가 요구한다. 사용자 인증 경로와는 무관하다.기타
TestAuthenticationSupport가OauthService에 의존하던 것을JwtTokenProvider직접 발급으로 교체했다.getToken()호출부 116곳은 무수정이다.AdminUserTestFactory가BCryptPasswordEncoder를@Autowired로 받던 것을 자체 생성으로 바꿨다 (레이어 표준 15 — 테스트 인프라는 운영 빈 구성에 기대지 않는다).API 변경
POST /api/v2/auth/{apple,kakao}POST /api/v1/oauth/reissuePUT /api/v1/oauth/token/verifyPOST /api/v2/auth/reissuePUT /api/v2/auth/token/verifyPOST /api/v1/oauth/loginPOST /api/v1/oauth/restore배포 시 주의
KAKAO_APP_ID환경변수가 선행되어야 한다.application.yml의kakao.app-id: ${KAKAO_APP_ID}에 기본값을 두지 않았으므로, 값이 없으면 애플리케이션이 기동에 실패한다(조용히 로그인만 막히는 것보다 즉시 드러나는 편을 택했다).git.environment-variables에 반영되어 있다 — prod1052783, dev1071644검증
/verify full(L3) 로컬 PASS — compile(Java/Kotlin),check_rule_test,unit_test, build,integration_test(254 tests, 0 failures),admin_integration_test(204 tests, 0 failures),asciidoctor범위 밖
users.password컬럼 DROP 마이그레이션 — 엔티티 필드만 제거했고 컬럼은 남겼다.ddl-auto: validate는 엔티티에 없는 컬럼을 문제 삼지 않는다.🤖 Generated with Claude Code