[#158] 앱의 로그인이 풀릴 때마다 UserDefaults에 저장되어 있는 데이터를 모두 제거하도록 구현한다#171
[#158] 앱의 로그인이 풀릴 때마다 UserDefaults에 저장되어 있는 데이터를 모두 제거하도록 구현한다#171
Conversation
opficdev
commented
Mar 3, 2026
- closed FirebaseAuth의 currentUser가 nil로 될 때마다 UserDefaults에 저장되어 있는 데이터를 모두 제거하도록 구현한다 #158
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자가 앱에서 로그아웃할 때 UserDefaults에 저장된 모든 사용자 관련 데이터를 자동으로 삭제하는 중요한 보안 기능을 구현합니다. 이는 세션 종료 후 민감한 정보가 기기에 남아있지 않도록 하여 데이터 프라이버시와 보안을 강화하는 데 목적이 있습니다. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
로그아웃 시 UserDefaults에 저장된 모든 데이터를 제거하는 기능을 구현하셨네요. AuthSessionRepository에서 로그아웃 상태가 되면 UserDefaultsStore의 removeAll()을 호출하여 모든 데이터를 삭제하는 방식입니다. 구현 자체는 명확하고 요구사항을 잘 반영하고 있습니다. 다만, removePersistentDomain을 사용하여 UserDefaults의 모든 데이터를 삭제하는 것은 앱의 테마 설정이나 온보딩 확인 여부 등 사용자의 세션과 무관한 정보까지 모두 초기화시킬 수 있습니다. 이 동작이 의도된 것이 아니라면, 로그아웃 시 삭제가 필요한 데이터의 키(key)만 선별적으로 제거하는 방식을 고려해보는 것이 좋을 것 같습니다. 또한, removePersistentDomain 호출 후 변경사항을 즉시 반영하기 위해 synchronize()를 호출하는 것을 제안하는 리뷰 코멘트를 남겼습니다.
|
|
||
| func removeAll() { | ||
| guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return } | ||
| userDefaults.removePersistentDomain(forName: bundleIdentifier) |
There was a problem hiding this comment.
removePersistentDomain(forName:) 메서드 호출 후에는 변경 사항이 즉시 반영되지 않을 수 있습니다. Apple의 removePersistentDomain(forName:) 공식 문서에서는 이 메서드 호출 후 synchronize()를 호출하여 변경 사항을 디스크에 동기화할 것을 권장하고 있습니다. 로그아웃 시 사용자 데이터가 즉시 확실하게 삭제되도록 보장하기 위해 synchronize() 호출을 추가하는 것이 더 안전합니다.
userDefaults.removePersistentDomain(forName: bundleIdentifier)
userDefaults.synchronize()