Skip to content

fix(webauthn): empty aaguid fails login #398

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

Merged
merged 1 commit into from
Mar 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion protocol/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ValidateMetadata(ctx context.Context, mds metadata.Provider, aaguid uuid.UU
return nil
}

if mds.GetValidateAttestationTypes(ctx) && attestationType != "" {
if attestationType != "" && mds.GetValidateAttestationTypes(ctx) {
found := false

for _, atype := range entry.MetadataStatement.AttestationTypes {
Expand Down
4 changes: 3 additions & 1 deletion webauthn/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ func (webauthn *WebAuthn) validateLogin(user User, session SessionData, parsedRe
if webauthn.Config.MDS != nil {
var aaguid uuid.UUID

if aaguid, err = uuid.FromBytes(credential.Authenticator.AAGUID); err != nil {
if len(credential.Authenticator.AAGUID) == 0 {
aaguid = uuid.Nil
} else if aaguid, err = uuid.FromBytes(credential.Authenticator.AAGUID); err != nil {
return nil, protocol.ErrBadRequest.WithDetails("Failed to decode AAGUID").WithInfo(fmt.Sprintf("Error occurred decoding AAGUID from the credential record: %s", err)).WithError(err)
}

Expand Down
Loading