Repository navigation
fix(models): exclude oauth client sessions from mfa step-up invalidation (#2801) - #2802
Conversation
|
This also affects us, would be great to have it merged. |
|
@cemalkilic are you still working on this repo? or can you please route us to another maintainer. We hit that too in production, active MCP sessions have their token being revoked when the user performs an MFA challenge. |
|
Thanks a lot for the fix and the thorough test, @melcheikh, and sorry it sat for so long. I also checked the query plan: the delete still goes through the |
|
Thanks @cemalkilic, and thanks for checking the query plan! |
What kind of change does this PR introduce?
Bug fix.
What is the current behavior?
Closes #2801.
When a user completes an MFA verification (
verifyTOTPFactor,verifyPhoneFactor,verifyWebAuthnFactor, orRecoveryCodesVerify), GoTrue callsmodels.InvalidateSessionsWithAALLessThan(tx, user.ID, models.AAL2.String()).The function executes:
Because OAuth 2.1 client sessions are issued at
AAL1and cannot step up toAAL2, any MFA verification by the user deletes all sessions issued to third-party OAuth clients. Subsequent refresh attempts by those clients fail withrefresh_token_not_found.What is the new behavior?
InvalidateSessionsWithAALLessThannow excludes sessions associated with an OAuth client:OAuth client session lifecycles remain managed by consent revocation via
RevokeOAuthSessions.Additional context
Added unit test
TestInvalidateSessionsWithAALLessThan_PreservesOAuthSessionsininternal/models/sessions_test.go. The test asserts that:oauth_client_idpresent) are preserved.