Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ table for more information. We also include JSON mappings for those that wish to
| type | N/A | N/A | This field is always `publicKey` for WebAuthn |
| id | ID | id | |
| publicKey | PublicKey | publicKey | |
| attestationFormat | AttestationType | attestationType | This field is currently named incorrectly and this will be corrected. |
| signCount | Authenticator.SignCount | authenticator.signCount | |
| transports | Transport | transport | |
| uvInitialized | Flags.UserVerified | flags.userVerified | |
Expand Down
2 changes: 1 addition & 1 deletion protocol/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (a *AttestationObject) VerifyAttestation(clientDataHash []byte, mds metadat
return nil
}

if e := ValidateMetadata(context.Background(), mds, aaguid, attestationType, x5cs); e != nil {
if e := ValidateMetadata(context.Background(), mds, aaguid, attestationType, a.Format, x5cs); e != nil {
return ErrInvalidAttestation.WithInfo(fmt.Sprintf("Error occurred validating metadata during attestation validation: %+v", e)).WithDetails(e.DevInfo).WithError(e)
}

Expand Down
6 changes: 5 additions & 1 deletion protocol/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ import (
"github.com/go-webauthn/webauthn/metadata"
)

func ValidateMetadata(ctx context.Context, mds metadata.Provider, aaguid uuid.UUID, attestationType string, x5cs []any) (protoErr *Error) {
func ValidateMetadata(ctx context.Context, mds metadata.Provider, aaguid uuid.UUID, attestationType, attestationFormat string, x5cs []any) (protoErr *Error) {
if mds == nil {
return nil
}

if AttestationFormat(attestationFormat) == AttestationFormatNone {
return nil
}

var (
entry *metadata.Entry
err error
Expand Down
4 changes: 2 additions & 2 deletions webauthn/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func (webauthn *WebAuthn) validateLogin(user User, session SessionData, parsedRe
err error
)

// Ensure authenticators with a bad status is not used.
// Ensure authenticators with a bad status are not used.
if webauthn.Config.MDS != nil {
var aaguid uuid.UUID

Expand All @@ -382,7 +382,7 @@ func (webauthn *WebAuthn) validateLogin(user User, session SessionData, parsedRe
return nil, protocol.ErrBadRequest.WithDetails("Failed to decode AAGUID").WithInfo(fmt.Sprintf("Error occurred decoding AAGUID from the credential record: %s", err)).WithError(err)
}

if e := protocol.ValidateMetadata(context.Background(), webauthn.Config.MDS, aaguid, "", nil); e != nil {
if e := protocol.ValidateMetadata(context.Background(), webauthn.Config.MDS, aaguid, "", credential.AttestationType, nil); e != nil {
return nil, protocol.ErrBadRequest.WithDetails("Failed to validate credential record metadata").WithInfo(e.DevInfo).WithError(e)
}
}
Expand Down
Loading