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

chore(webauthn): change user_id from uuid.UUID to string #9

Merged
merged 5 commits into from
Nov 10, 2023

Conversation

shentschel
Copy link
Collaborator

allows any string as user id

Related to: #5

@shentschel shentschel self-assigned this Nov 8, 2023
@shentschel
Copy link
Collaborator Author

WIP: Need to rework how to get a list of credentials now

Stefan Jacobi added 3 commits November 9, 2023 10:25
* credential list now gets creds per tenant
* update spec to reflect uuid to string change
* move GetHandlerContext to helper
* remove test logging

Related to: #5
* refix typos

Related to: #5
@shentschel shentschel force-pushed the chore/change-user-id branch from 81ae080 to 013eade Compare November 9, 2023 10:39
* remove host description
* remove path prefix description

Related to: #5
@FreddyDevelop
Copy link
Contributor

Would be good if the change from uuid to string is backwards compatible.

@shentschel
Copy link
Collaborator Author

Hmm, is that should already be possible except for migrating down.

Do you have an example where this is not possible?

@FreddyDevelop
Copy link
Contributor

Yes, when you created a credential with a uuid without the changes from this PR (e.g. v0.1.0) and then you want to login with the credential with the changes from this PR, then you get an error: failed to get user: failed to get webauthn user by user id: ERROR: invalid byte sequence for encoding \"UTF8\": 0xb8 (SQLSTATE 22021)

* handle credentials which were created with v1 by trying to convert the userHandle into an uuid and then converting the uuid into a string

Related to: #5
@shentschel
Copy link
Collaborator Author

Fixed the backward compatibility issue by trying to convert the userHandle into an uuid.
If it works: the uuid will then be converted into a string.
If not: the userHandle will directly be converted into a string

I also needed to overwrite the parsedRequest.Response.UserHandle because it is used to check if user ID and handle match in the webauthn lib

@FreddyDevelop FreddyDevelop merged commit 5c4b454 into main Nov 10, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants