fix: error handling when using zombie passkeys #2034
Merged
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.
Description
This PR fixes the following issues:
Implementation
The first issue was resolved by saving the current state error into the
uiState
after the "back" action is triggered. This ensures that the new state does not overwrite the pre-existing WebAuthN errors. Additionally, the flow API has been updated to avoid transitioning into an error state, as the UI should not display the error page in such cases.To address the second issue where a valid passkey could not be used after attempting to use a zombie passkey, the flowpilot logic was adjusted. The problem stemmed from the
c.Continue()
function not updating the state data (specifically, the new WebAuthN Session ID, in this case) when aFlowError
was present in the context. This behaviour has been changed so thatc.Continue()
now saves the updated state to the database, even in the presence of aFlowError
. If this behaviour is not desired, thec.Error()
function should be used instead.Tests