-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handlers: do not fail login if refresh token gone #1670
Conversation
It looks like the CI may have failed for an unrelated reason. Is there an easy way to retry it? |
Please rebase on master, so the CI issue can get resolved. |
It would be great to get this merged as its impacting us as well cc @willvrny |
There is a chance that offline storage could fall out of sync with the refresh token tables. One example is if dex crashes/is stopped in the middle of handling a login request. If the old refresh token associated with the offline session is deleted, and then the process stops, the offline session will still refer to the old token. Unfortunately, if this case occurs, there is no way to recover from it, since further logins will be halted due to dex being unable to clean up the old tokens till referenced in the offline session: the database is essentially corrupted. There doesn't seem to be a good reason to fail the auth request if the old refresh token is gone. This changes the logic in `handleAuthCode` to not fail the entire transaction if the old refresh token could not be deleted because it was not present. This has the effect of installing the new refresh token, and unpdating the offline storage, thereby fixing the issue, however it occured.
ca69047
to
ab5ea03
Compare
@bonifaido Rebased, but it looks like the lint timed out this time. :( |
Build is fixed now! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple and great. LGTM, thanks!
@bonifaido any idea when a release with this will be cut? |
No planned released for now, but there are some fixes hanging around here, we will review a few and I will cut a patch release. Until that: https://quay.io/repository/dexidp/dex/manifest/sha256:2f5af70a79eae505d122ac40f684cff29fabda434f5fefeb49c0d888323a545d |
There is a chance that offline storage could fall out of sync with the
refresh token tables. One example is if dex crashes/is stopped in the
middle of handling a login request. If the old refresh token associated
with the offline session is deleted, and then the process stops, the
offline session will still refer to the old token.
Unfortunately, if this case occurs, there is no way to recover from it,
since further logins will be halted due to dex being unable to clean up
the old tokens till referenced in the offline session: the database is
essentially corrupted.
There doesn't seem to be a good reason to fail the auth request if the
old refresh token is gone. This changes the logic in
handleAuthCode
tonot fail the entire transaction if the old refresh token could not be
deleted because it was not present. This has the effect of installing
the new refresh token, and updating the offline storage, thereby fixing
the issue, however it occurred.
Fixes #1669