[Fix] Keychain 저장 시 토큰 유실 방지 및 README −74% 귀속 정정 (#82) - #83
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughREADME에서 페이로드 74% 감소의 비교 기준을 원본 업로드로 명시합니다. Keychain 토큰 저장은 기존 항목 업데이트를 우선하고, refresh token 저장이 실패하면 이전 access token을 복원합니다. Changes업로드 전처리 설명
Keychain 토큰 저장
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The documentation now identifies the comparison baseline, and token saving preserves the previous access token on the established failure path. No actionable merge-blocking issue is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change reduces the chance of losing an existing token, but an uncommon failure during recovery could leave the two saved tokens out of sync. The identified impact is limited to the affected device’s authentication state; no new route for an attacker to obtain tokens or bypass authorization was established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Close #82
✨ PR 유형
어떤 변경 사항이 있나요??
🛠️ 작업내용
커밋 2개. 1은 실버그 수정, 2는 README 사실 정정.
1.
KeychainTokenStore.saveToKeychain— delete → add를 update 우선으로기존은
SecItemDelete후SecItemAdd였다. add가 실패하면(재부팅 후 첫 잠금 해제 전 백그라운드 갱신 등) 옛 값은 이미 지워진 상태이고,save()의 롤백이 access까지 지워 로그아웃된다. 지워진 토큰은 어떤 재시도 로직으로도 복구할 수 없다.save()의 롤백도 바꿨다. refresh 저장이 실패하면 access를 삭제하던 것을 이전 값 복원으로. 이전 값이 없었을 때만 삭제한다. 쌍이 어긋나지 않게 하면서 로그아웃까지 가지 않게 한다.kSecAttrAccessible은 add 경로에만 넣는다. 이 저장소가 만든 항목은 전부 같은 접근성이라 update 때 바꿀 이유가 없다.테스트: SecItem 실패를 단위 테스트에서 주입할 수 없어 새 테스트는 없다. 기존
KeychainTokenStoreTests6개(저장·조회·덮어쓰기·삭제·service 격리·직렬화)가 update 경로의 회귀를 덮는다. 덮어쓰기 테스트가 이제 update 분기를, 최초 저장 테스트가 add 분기를 지난다.2. README 기술 포인트 −74% 귀속 정정
"경계에 맞춰 페이로드 −74%"는 경계 정렬이 페이로드를 줄인 것처럼 읽힌다.
BASELINE_RESULTS.md기준:두 효과의 원인을 분리해 다시 썼다.
📋 추후 진행 상황
코드 수정은 이 PR로 마감. 리뷰에서 함께 제안된 "갱신 완료 후 도착한 옛 토큰 401의 재갱신"과 "
refreshTaskdefer 위치"는 사용자 영향이 없어 제외했고, 근거는 #82에 기록했다.📌 리뷰 포인트
saveToKeychain의switch updateStatus분기 —errSecItemNotFound외의 실패는 그대로 throw하는 게 맞는지save()롤백에서try? saveToKeychain(previous)— 복원 자체가 실패하면 조용히 넘어가는데, 이 시점엔 원 에러를 던지는 것 외에 할 수 있는 게 없다고 판단✅ Checklist
PR이 다음 요구 사항을 충족하는지 확인해주세요!!!
Summary by CodeRabbit
버그 수정
문서