fix(auth): sign out only after definitive session expiry - #414
Merged
jeromevdl merged 1 commit intoSep 1, 2026
Merged
Conversation
Alae-Tamouh
requested review from
JWThewes,
eipasteur,
jeromevdl,
leandrodamascena and
svozza
as code owners
August 19, 2026 15:44
jeromevdl
reviewed
Aug 20, 2026
jeromevdl
reviewed
Aug 20, 2026
jeromevdl
reviewed
Aug 20, 2026
jeromevdl
requested changes
Aug 20, 2026
jeromevdl
left a comment
Contributor
There was a problem hiding this comment.
Great finding @Alae-Tamouh. I never faced this so thank you for your PR.
A few comments before approving.
Contributor
|
@Alae-Tamouh are you going to work on Jeromes comments? Otherwise I can work on this one. Super great finding an I'm eager to get this one in for our next release. |
Alae-Tamouh
force-pushed
the
contrib/definitive-session-expiry
branch
from
September 1, 2026 14:13
b1b03c5 to
ab7e50a
Compare
Contributor
Author
|
@JWThewes Thanks for the reminder, I addressed Jerome's comments |
Alae-Tamouh
force-pushed
the
contrib/definitive-session-expiry
branch
2 times, most recently
from
September 1, 2026 14:50
93cc632 to
ab7e50a
Compare
jeromevdl
approved these changes
Sep 1, 2026
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.
Issue #, if available: None
Description of changes:
Problem
When Cognito can no longer refresh a session, API calls fail with 401 but AuthContext retains the previous user. The UI remains authenticated and continues issuing failing requests.
Logging out on every API 401 is unsafe because provider endpoints can also return GitHub, GitLab, Bitbucket, or Jira 401 responses while the Cognito session remains valid.
Reproducer
Solution
Classify session resolution as valid, definitively expired, or transiently unavailable. On an API 401, force a Cognito refresh before notifying AuthContext. A small epoch-aware bridge coalesces expiry notifications and prevents late requests from an old session from signing out a newly authenticated local or SSO session.
Impact
Expired users return cleanly to login. Network failures and provider-specific 401 responses no longer cause false logout, and stale requests cannot expire a replacement session.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.