slouchpie
I am experimenting with GitHub - liveshowy/webauthn_components: WebauthnComponents allows Phoenix developers to quickly add passwordless authentication to LiveView applications. · GitHub
I am wondering what to do when a user loses their passkey. Here is what I think should happen:
- “Lost passkey” button which un-hides an email input.
- Send a “create new passkey” email with some kind of link with a token
- Much like the process by which an email is confirmed, handle the “create new passkey” link in a controller and create a passkey if the token is right
- Upon successful passkey creation, login user and redirect to, say, home.
Does this sound right? @type1fool you are probably the best person to ask about this.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Eiji
In theory the
passkeyconcept was created to not requireemail + passwordstrategy makingpasswordunnecessary andemailoptional just like2FA, so firstly by following it we should be aware that theemailis at most optional field during registration, but most probably it could be even a part of additionalprofile/user settings- again just like2FA.In theory there should be no problem with implementing
lost passkeypage, but in practice I can imagine a case when email account is stolen. Since we have no idea about email account security we can’t assume that’s a good source of truth. The simplest example here are temporary email accounts where you just have to type an alias name and yeah, that could happen also withemail + passwordstrategy.So what could be done in such case? I believe a proper implementation would be a requirement of at least one
2FAmethod in case a user decides to set an optionalemailfield which is part ofprofile/user settingsavailable after registration.As an alternative you could implement multiple devices support. In such case a the
lost passkeypage only needs aPINorQR Codesupport, so the user could replace the passkey using other device. This strategy is much better since it does not requireemail. Iflost passkeypage usesLiveVieworWebSocketthere should be no way to steal your account even if somebody would notice aPIN / QR Codeas it could be easily assigned only to the specificWebSocketclient and any new attempt would generate another one. Somebody may say that in such case the account could be stolen anyway by otherPIN / QR Codeas long as attacker have a vision of your other device screen, but in practice a simpleconfirmationdialog before it prevents such attacks.The only possible problem here is what to do if there are 2+ requests in similar time. First of all such case should be very rare. A simple information box to not reset
passkeyin public place could be more than enough, but there are other possibilities. One of them is to simply blocklost passkeypage for some time if there are 2 requests in short amount o time. The user could simply restore their account just 1 hour later or so. However much better way is to generate saidPINon 2 devices. As long as the attacker does not have access to your second device your account is secure.slouchpie
This is all true and good information.
While it is theoretically true that “email” is not required, the docs say
I agree with this. Moreover, I feel that most users assume that they should be able to “reset” their credentials, so long as they have their email.
I think that requiring multiple devices alienates a lot of users, especially users living near or below the poverty line, who never have more than one device, usually an old smartphone. Old devices cannot support WebAuthn so I would ideally support email+password as a fallback auth mechanism.
Your system of multiple devices + 2FA is extremely robust and secure. However, am I correct to think that if both of the users devices are, say, stolen from them, then they have no way to access their account?
slouchpie
There is lots of info and links here:
https://github.com/w3c/webauthn/issues/931
Seems like backup codes are the agreed way?
eahanson
I’m currently using email. I like the idea of backup codes — maybe I’ll implement that as an option for people who trust that they won’t lose their backup code.
slouchpie
Are you using WebAuthn? If so, when a user signs in on a new device with an existing email, do you automatically sign them in as the existing user?
I know there is a flow for “I already have an account” which requires authenticating using a pre-existing device. I am interested in the case of a user with 1 device only who loses their passkey.
Thanks.
type1fool
Hey @slouchpie! After a quick skim of the original post, I’d say it’s best to establish backup methods when an account is created and when a passkey is added. That could mean generating backup codes or encouraging registration of a second passkey or other auth method.
With the vulnerabilities of SMS, email, and OTP codes, and the unfamiliarity of Passkeys, it’s not always an easy choice. It really depends on the threat model of the application and its users.
Ideally, the user could register two passkeys, which would provide the most security. Practically, that may be complicated. WebauthnComponents doesn’t yet have examples for registering additional passkeys, but it could be implemented manually by following the example code. Secondary key registration is something I will tackle eventually if there hasn’t been a contribution from the community.
I may follow up in more detail later, but that’s hopefully informative.
slouchpie
That aligns with my thinking too. I am moving forward with “email as identification”.
For additional passkeys - this is not too difficult to implement using what has already been generated. I was glad that the generated code was concise enough to review in its entirety relatively quickly.
type1fool
Thank you for the high praise!
eahanson
Yes, I’m using WebAuthn. When a user signs in on a new device, they are sent a one time code ([ab]using NimbleTOTP) just like when they signed up in the first place.
In the database, we allow multiple passkeys per user. This allows users to log in from multiple computers even if they can’t share passcodes between computers, and also allows users to delete all their passcodes and still be able to log in. When building the passkey flow, I created a lot of passkeys on my computer so it was really nice to be able to delete them all and still be able to log back in.
For one of my apps that uses passkeys, all users must supply an email address because there are a number of email-based workflows. In another app, email is not heavily used, so I like the idea of using backup codes and allowing users to not ever give us an email address.
slouchpie
Sorry for the necro but I have been working on the WebAuthn integration in my own project and I have some concrete principles for the future auth system. Sharing them here for posterity.
phx.gen.auth)UAInspectorso I might just use that. This should allow “create passkey”.The best-laid plans, etc.