-
Notifications
You must be signed in to change notification settings - Fork 993
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
Adds Webauthn support (TouchID, FaceID) to dbAuth #5680
Conversation
✅ Deploy Preview for redwoodjs-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Error when importing ESM modules more than one level deep: MasterKale/SimpleWebAuthn#168
This prevents an annoying UX case where you removed the `webAuthn` cookie—you are sent into the registration flow but can’t register because your devices is already in the DB, so you’re asked to authenticate, which means you have to scan your fingerprint/face again
This makes it so that if someone tampers with the cookie, or their credential has been removed from the database, their webAuthn cookie is removed and sent back to the username/password flow
# Conflicts: # yarn.lock
# Conflicts: # packages/api/package.json # packages/auth/package.json # yarn.lock
MERGEDDDDD Sorry about the conflicts on the strict PR @dac09 😬 |
No worries @cannikin - but I think we need to ✋ HODL shipping this - I'm getting errors rebuilding the test project fixture. (Module base64url not found). |
Hmm base64url is added to the package.json in either api or auth…maybe I missed one? |
Double checked and Maybe we should do that thing where it actually installs as a dependency in the app itself if you use dbAuth? Although it's a pretty tiny package, the raw TS source is only 50 lines of code... |
@cannikin - I can confirm the failure is happening because of this PR - why...? I don't really know. To see it, just run Without this PR: ✅ all good (you can use the branch What do you say we revert till we find the solution? Update: there seems to be two problems - the one above and.... the setup and generate dbAuth commands now prompt - so the testproject generator gets stuck. Is there a flag we could pass it to skip the prompt? Would it be possible to move the prompt to inside the dbAuth setup command? It sets a bad precedent, because what if providerX comes along and wants to have a couple different variants? See the |
…o feat/ts-strictmode-gen * 'feat/ts-strictmode-gen' of github.com:dac09/redwood: (94 commits) fix(deps): update dependency @graphql-codegen/cli to v2.9.1 (redwoodjs#6013) Little grammar change (redwoodjs#6006) chore: connect repo to nx cloud to speed up builds (redwoodjs#5988) fix(deps): update dependency @testing-library/user-event to v14.3.0 (redwoodjs#6004) fix(deps): update graphqlcodegenerator monorepo (redwoodjs#6005) chore(deps): update dependency @auth0/auth0-spa-js to v1.22.2 (redwoodjs#6003) fix(graphql): Fixes multiValueHeader handling (and CORS) in graphql handler (redwoodjs#5970) chore(deps): update dependency @nhost/hasura-auth-js to v1.4.0 (redwoodjs#6001) chore(deps): update dependency @nhost/nhost-js to v1.4.7 (redwoodjs#5999) fix(deps): update dependency cross-undici-fetch to v0.4.14 (redwoodjs#6000) chore(deps): update dependency @azure/msal-browser to v2.28.0 (redwoodjs#5994) fix(deps): update dependency concurrently to v7.3.0 (redwoodjs#5995) chore(deps): update dependency @simplewebauthn/browser to v5.3.0 (redwoodjs#5989) chore(deps): update dependency @simplewebauthn/server to v5.3.0 (redwoodjs#5990) chore(deps): update dependency @simplewebauthn/typescript-types to v5.3.0 (redwoodjs#5991) fix(deps): update dependency @testing-library/user-event to v14.2.6 (redwoodjs#5992) fix(deps): update typescript-eslint monorepo to v5.30.7 (redwoodjs#5993) chore: clean up mock auth client (redwoodjs#5911) Adds Webauthn support (TouchID, FaceID) to dbAuth (redwoodjs#5680) chore(deps): update dependency octokit to v2.0.4 (redwoodjs#5986) ...
Did you know you can enable TouchID, FaceID, Yubikey support (and more) in the browser?? I didn’t, until I signed in to Ebay the other day and it asked me if I wanted to use TouchID for future logins. Blew my mind. Apparently this has been a possibility since around 2020, but I’d never seen a site use it until now.
I haven't seen any of our other auth providers supporting Webauthn yet, so this could be a unique advantage to dbAuth. Here's a list of supported browser and devices:
Registration
The first time Webauthn is enabled for a user (called "Registration") the flow looks like:
credentialID
andcredentialPublicKey
are saved for this single deviceAuthentication
On subsequent logins (called "Authentication") the flow goes:
credentialID
exists for a user, and that a valid signature is returnedNote that a
credentialID
is unique to a device, so if you enable TouchID on your laptop, it won't automatically work on your phone: you'd need to start from step 1 of Registration again when you go to a new device. But then going forward you could log into either site.Database
We will need to store some extra data in the database going forward:
webauthnChallenge
field on theuser
, which is a unique string that's generated when a Webauthn request starts. The response from the browser will contain this same string. Putting this on theuser
table means that only a single device can be in the middle of a Registration/Authentication flow at a time, which seems like a reasonable limitation. This means that you can't start the Registration process on your desktop, then before using your fingerprint start the Registration on your phone, complete the Registration on your phone, then come back to your desktop and scan your fingerprint—thewebauthnChallenge
will be wiped out by the phone's Registration flow.UserCredential
containing all of the devices/credentials that are associated with a single user. This is a one-to-many relationship (aUser
has manyUserCredential
s).Release Notes
You can now let your users use their face, fingerprint or a PIN to log in with dbAuth! WebAuthn has been a browser standard since 2020 and it provides a unified interface to TouchID, FaceID, Windows Hello, as well as third party devices like Yubikey.
api/src/functions/auth.js