Skip to content

Commit

Permalink
fix: Correctly handle non-registered U2F keys
Browse files Browse the repository at this point in the history
  • Loading branch information
codingllama authored and github-actions committed Feb 2, 2024
1 parent 7f610fa commit 37d3e68
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/auth/webauthncli/fido2.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,18 @@ func fido2Login(
assertions, err = dev.Assertion(actualRPID, ccdHash[:], allowedCreds, pin, opts)
}
if errors.Is(err, libfido2.ErrNoCredentials) {
err = ErrUsingNonRegisteredDevice // "Upgrade" error message.
// U2F devices error instantly with ErrNoCredentials.
// If that is the case, we mark the error as non-interactive and continue
// without this device. This is the only safe option, as it lets the
// handleDevice goroutine exit gracefully. Do not attempt to wait for
// touch - this causes another slew of problems with abandoned U2F
// goroutines during registration.
if !info.fido2 {
log.Debugf("FIDO2: U2F device %v not registered, ignoring it", info.path)
err = &nonInteractiveError{err: err}
} else {
err = ErrUsingNonRegisteredDevice // "Upgrade" error message.
}
}
if err != nil {
return trace.Wrap(err)
Expand Down

0 comments on commit 37d3e68

Please sign in to comment.