MFA modal in Connect asks for key insertion despite tshd not waiting for a key to be inserted #49195
Labels
mfa
Issues related to Multi Factor Authentication
teleport-connect
Issues related to Teleport Connect.
The MFA modal tells you to insert a key and tap it:
This works on Windows where tshd uses a system prompt which handles that scenario. On macOS however we use the same custom prompt as tsh. If you try to call
tsh login
with no keys inserted, you'll see that it fails immediately.tsh login with no keys
Connect behaves no differently – the Webauthn goroutine fails immediately too, but the Electron app keeps showing the modal asking you to insert a key. After you insert it, you'd expect to be able to tap it, but at this point tshd is not requesting a key tap. So you have to cancel the modal manually.
That behavior is a bit more acceptable for
second_factor: "on"
where in theory even if the Webauthn goroutine fails, the user is still able to change the MFA type to TOTP and enter a code. But even in this case we don't reflect the fact that Webauthn is not going to work unless you close the modal, insert the key and perform the action again.The proper fix: wait for a key to be inserted
This would require adjusting the tsh code so that it waits for a key to be inserted. This is how most hardware key prompt implementations work, e.g., the one in Chrome, Safari, or Windows.
At this point it's not clear how much effort this would require.
The quick fix: don't ask for key insertion and fail immediately
This is what Teleport Connect v16.0.0 used to do. I haven't checked this, but I suspect the regression was introduced in #47153 when we switched to a two-step login flow. In the old flow, you'd select your MFA type first and only then submit the login form. In the new flow, you send your credentials first and then Connect shows the same MFA modal it shows everywhere else. The fact that the Webauthn goroutine failure doesn't cause an error is likely related to how we handle the scenario where multiple MFA types are available (webauthn + totp).
On platforms where we don't wait for key insertion (TODO: check if it's just macOS or Linux too) we shouldn't ask for key insertion in the modal, it should say just "Tap your security key". If the Webauthn goroutine fails and there's no other goroutine to wait for (e.g., TOTP), the modal should show an error.
The text was updated successfully, but these errors were encountered: