Repository navigation
chore: 만료된 refresh token·비밀번호 재설정 토큰을 매일 정리한다 - #154
Merged
Merged
Conversation
로그인과 토큰 갱신마다 refresh_token 행이 하나씩 쌓이고, password_reset_token도 지워지지 않았다. 매일 04:00(KST)에 만료된 지 30일이 지난 토큰을 지운다. 만료된 토큰은 갱신 때 재사용 검사보다 먼저 "만료"로 거절되므로 지워도 재사용 감지에는 영향이 없다. 30일 여유는 만료된 쿠키로 요청한 사용자가 "만료" 안내를 받도록 남겨 둔 것이다.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
요약
로그인·토큰 갱신마다
refresh_token에 행이 하나씩 쌓이고(갱신 시 이전 토큰은 revoke만 함),password_reset_token도 지우는 곳이 없었다.refresh_token.expires_at에는 인덱스까지 있지만 쓰는 쿼리가 없었다.변경
auth/schedule/ExpiredTokenCleanupScheduler: 매일 04:00(KST) 만료된 지 30일이 지난 refresh token·비밀번호 재설정 토큰을 지우고 삭제 건수를 로그로 남긴다.RefreshTokenRepository.deleteExpiredBefore,PasswordResetTokenRepository.deleteExpiredBefore(벌크 delete 한 번).왜 30일 뒤인가
AuthService.refresh). 그래서 만료된 토큰은 지워도 재사용 감지(회전된 토큰을 다시 쓰면 전 세션 로그아웃)에 영향이 없다.테스트
ExpiredTokenCleanupIntegrationTest: 31일 전 만료 토큰만 지우고, 1일 전 만료·유효 토큰은 남긴다(refresh token·재설정 토큰 모두)../gradlew test: 549건 중 548 통과, 1 스킵.