Skip to content

Commit 03df22a

Browse files
Merge pull request #19 from go-webauthn/merge-fixes-from-master
backport: master to v0.1
2 parents 93a942a + 35287ea commit 03df22a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

protocol/authenticator.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import (
88
"github.com/go-webauthn/webauthn/protocol/webauthncbor"
99
)
1010

11-
var (
11+
const (
1212
minAuthDataLength = 37
1313
minAttestedAuthLength = 55
14+
maxCredentialIDLength = 1023
1415
)
1516

1617
// Authenticators respond to Relying Party requests by returning an object derived from the
@@ -203,6 +204,10 @@ func (a *AuthenticatorData) unmarshalAttestedData(rawAuthData []byte) (err error
203204
return ErrBadRequest.WithDetails("Authenticator attestation data length too short")
204205
}
205206

207+
if idLength > maxCredentialIDLength {
208+
return ErrBadRequest.WithDetails("Authenticator attestation data credential id length too long")
209+
}
210+
206211
a.AttData.CredentialID = rawAuthData[55 : 55+idLength]
207212

208213
a.AttData.CredentialPublicKey, err = unmarshalCredentialPublicKey(rawAuthData[55+idLength:])

protocol/credential.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ type CredentialCreationResponse struct {
5151
type ParsedCredentialCreationData struct {
5252
ParsedPublicKeyCredential
5353
Response ParsedAttestationResponse
54+
Transports []AuthenticatorTransport
5455
Raw CredentialCreationResponse
55-
Transports []AuthenticatorTransport `json:"transports,omitempty"`
5656
}
5757

5858
func ParseCredentialCreationResponse(response *http.Request) (*ParsedCredentialCreationData, error) {

0 commit comments

Comments
 (0)