Repository navigation
🔀 :: (#316) - OAuth 로그인에 state·PKCE 적용 및 callback 검증 - #391
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
minwoo0708
marked this pull request as ready for review
October 7, 2026 23:56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leesengjun
reviewed
Oct 8, 2026
aiden30015
approved these changes
Oct 8, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.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.
💡 개요
OAuth 로그인 요청과 callback을 같은 일회성 트랜잭션으로 묶어 검증합니다. 요청마다 state와 PKCE(S256) code verifier를 만들고, callback의 경로·state를 확인한 뒤 verifier를 서버 로그인 요청에 함께 보냅니다.
🔗 관련 이슈
Close #316
📃 작업내용
트랜잭션 (
OAuthTransaction, 새 파일)Random.secure()로 32바이트 state·code verifier 생성 (base64url 43자)code_challenge= SHA-256(verifier)의 base64url(패딩 없음),code_challenge_method=S256com.washer.v2://auth/callback과 정확히 같고, state가 일치하고,code가 있어야 통과로그인 흐름 (
LoginNotifier)state,code_challenge,code_challenge_method추가finally에서 해제)webAuthenticatorProvider로 분리하고, 환경 설정을AppEnvironment.instance대신appEnvironmentProvider로 읽음서버 요청 (
LoginRequest,AuthRepository)codeVerifier선택 필드 추가 (null이면 JSON에서 생략), build_runner로 생성 파일 갱신기타
sanitizeDioLog)에서authCode·codeVerifier(code_verifier)를 가림AppEnvironment.test()에 OAuth 설정 파라미터 추가 (테스트 전용)lib/features/auth/README.md로그인 흐름·구조·주의사항 갱신🔍 테스트 방법
flutter analyze --no-fatal-infos이슈 없음,flutter test전체 340개 통과test/features/auth/oauth_transaction_test.dart: RFC 7636 부록 B 값으로 S256 challenge 확인, 요청마다 다른 state·verifier, 인가 URL 파라미터, state 누락·불일치·잘못된 scheme/host/path·code 누락 거부test/core/dio_log_sanitization_test.dart: 로그인 요청 본문(Map·JSON·snake_case)에서 인가 코드와 verifier 원문이 로그에 남지 않음test/features/auth/login_provider_test.dart: 정상 로그인 시 보낸 challenge와 verifier 일치, 위조 state 거부, 이전 트랜잭션 callback 재사용 거부, 로그인마다 다른 verifier, 진행 중 로그인 덮어쓰기 방지, 서버 로그인 응답 대기 중 재진입 방지, 브라우저 닫기 취소🙋♂️ 질문사항
TokenReqDto에 선택 필드codeVerifier를 추가하고, 값이 있으면exchangeCodeForToken(authCode, redirectUri, codeVerifier)를 호출해야 합니다(DataGSM OAuth SDK에 있는 오버로드). 필드를 선택으로 두면 구버전 앱도 그대로 로그인됩니다.✅ 체크리스트