Skip to content
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

fix: error handling when using zombie passkeys #2034

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

bjoern-m
Copy link
Contributor

@bjoern-m bjoern-m commented Jan 27, 2025

Description

This PR fixes the following issues:

  • When using a passkey that has been deleted on the server, the error message “This passkey cannot be used anymore” does not get shown (only when using the passkey button).
  • When the first try to login with a passkey fails, the user can not login with a passkey anymore. The user needs to reload the page to be able to login with a passkey (when using conditional ui).

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 a FlowError was present in the context. This behaviour has been changed so that c.Continue() now saves the updated state to the database, even in the presence of a FlowError. If this behaviour is not desired, the c.Error() function should be used instead.

Tests

  1. Create two WebAuthN credentials.
  2. Remove one of them from the database.
  3. Try to login with the deleted one.
  4. Observe that the "This Passkey can not be used anymore" error is displayed correctly when using conditional UI and the Passkey button.
  5. After a failed attempt via conditional UI and the error message is still shown, attempt to login with the passkey that has not been deleted.
  6. Verify the login attempt was successful.

@bjoern-m bjoern-m marked this pull request as ready for review January 28, 2025 04:02
@bjoern-m bjoern-m merged commit ce9626d into main Jan 29, 2025
8 checks passed
@bjoern-m bjoern-m deleted the fix-zombie-passkey-error-handling branch January 29, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Recently closed
Development

Successfully merging this pull request may close these issues.

2 participants