fix(auth): guard sign-out against newer sessions#38
Merged
Conversation
✅ Deploy Preview for rdlabo-ionic-angular-library ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
rdlabo
commented
Jul 25, 2026
rdlabo
left a comment
Contributor
Author
There was a problem hiding this comment.
第三者受け入れレビュー(head 89eaea5): APPROVED
前回 tipsys で差し戻した TOCTOU を独立検証しました。
expectedUserの identity 照合は asyncbefore完了後、Firebase SDKsignOut(auth)の呼び出し直前にあります。照合と SDK 呼び出しの間に await はなく、User A の denial cleanup 中に same UID の別 object User B へ変わった場合、B を対象とする SDK sign-out は開始されません。- 再現テストは A と B を同じ UID・別 object とし、
before中に差し替えています。結果はfalse、SDKsignOut未呼び出し、success/error未呼び出し、finally1回で、問題の競合を決定論的に再現しています。 - options は第3引数で任意のため、従来の
kitSignOut(auth, hooks)は source/runtime compatible です。guard 未指定時の SDK delegation、成功、失敗時 error hook の既存テストも維持されています。 - lifecycle semantics は旧実装と整合しています。
beforeは従来どおり try の前、SDK/signOut と success は try 内、失敗時 error、finally は成功・SDK失敗・expectedUser mismatch で実行されます。mismatch のみ意図的に success/error を発火しません。
ローカル再検証: npx ng test kit --watch=false = 35 files / 491 tests pass、git diff --check clean。ブロッカーはありません。
GitHub の自己承認制約があるため、Approve 状態ではなくレビューコメントとして記録します。
rdlabo
marked this pull request as ready for review
July 25, 2026 08:55
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.
Summary
expectedUseridentity guard tokitSignOutbeforecleanup and immediately before FirebasesignOutsignOut,success, anderrorwhen a newer Firebase User object has replaced the expected sessionValidation
npx ng test kit --watch=false(35 files / 491 tests)npm run prebuild:kitnpm run lintgit diff --check