LG-13139: Fix race condition with token verifier expired validity#10481
Merged
LG-13139: Fix race condition with token verifier expired validity#10481
Conversation
changelog: Bug Fixes, OpenID Connect, Fix occasional errors resulting from race condition on expiring token
mitchellhenke
approved these changes
Apr 23, 2024
matthinz
approved these changes
Apr 23, 2024
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
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.
🎫 Ticket
LG-13139
🛠 Summary of changes
Fixes an issue where a token may become invalid between the time it's initially validated and when the identity is referenced, since each independently triggers validation to run.
The proposed solution is to memoize the validity result, since the submission is not parameterized, so the result on an instance would not be expected to change after the initial validation call.Edit: After 93edf8f, updated to use the second of the two "Alternative solution"s presented below (see discussion).Alternative solution could include: (I'm open to any of these)
valid?within theidentitymethod, sinceUserInfoControlleris the only place this class is used, and it's guaranteed by the controller code thatidentitywould only be referenced on a valid result.identityas part of the submission "result", i.e.FormResponse#extra, or as a tuple result[response, identity]📜 Testing Plan
Validate that specs pass:
For good measure, sign-in end-to-end using the OIDC sample application.