-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(protocol): attestation type attca not validated correctly (#153)
For purposes of determining if an authenticator has produced a full attestation when the MDS entry for the authenticator indicates cannot produce a full attestation, treat attca and basic_full both as full attestation types. Add test data with an authenticator aaguid that only has attca type. Make production metadata available for use in tests. Fixes #149
- Loading branch information
Showing
4 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,15 @@ import ( | |
"encoding/json" | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/go-webauthn/webauthn/metadata" | ||
) | ||
|
||
func TestAttestationVerify(t *testing.T) { | ||
if err := metadata.PopulateMetadata(metadata.ProductionMDSURL); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
for i := range testAttestationOptions { | ||
t.Run(fmt.Sprintf("Running test %d", i), func(t *testing.T) { | ||
options := CredentialCreation{} | ||
|
@@ -68,6 +74,7 @@ func attestationTestUnpackResponse(t *testing.T, response string) (pcc ParsedCre | |
} | ||
|
||
func TestPackedAttestationVerification(t *testing.T) { | ||
|
||
t.Run("Testing Self Packed", func(t *testing.T) { | ||
pcc := attestationTestUnpackResponse(t, testAttestationResponses[0]) | ||
|
||
|
@@ -159,6 +166,28 @@ var testAttestationOptions = []string{ | |
"attestation": "none" | ||
} | ||
}`, | ||
`{ | ||
"publicKey": { | ||
"rp": { | ||
"name": "https://gramthanos.github.io", | ||
"id": "gramthanos.github.io" | ||
}, | ||
"user": { | ||
"name": "[email protected]", | ||
"displayName": "J. Smith", | ||
"id": "am9obi5zbWl0aEBlbWFpbC5jb20=" | ||
}, | ||
"challenge": "Dw4NDAsKCQgHBgUEAwIBAA==", | ||
"pubKeyCredParams": [ | ||
{"type": "public-key", "alg": -7}, | ||
{"type": "public-key", "alg": -37}, | ||
{"type": "public-key", "alg": -257}, | ||
{"type": "public-key", "alg": -8} | ||
], | ||
"timeout": 120000, | ||
"attestation": "direct" | ||
} | ||
}`, | ||
} | ||
|
||
var testAttestationResponses = []string{ | ||
|
@@ -191,5 +220,13 @@ var testAttestationResponses = []string{ | |
"clientDataJSON": "eyJjaGFsbGVuZ2UiOiJzVnQ0U2NjZU16cUZTbmZBcThoZ0x6Ymx2bzNmYTRfYUZWRWNJRVNISUowIiwib3JpZ2luIjoiaHR0cHM6Ly93ZWJhdXRobi5pbyIsInR5cGUiOiJ3ZWJhdXRobi5jcmVhdGUifQ" | ||
}, | ||
"type": "public-key" | ||
}`, `{ | ||
"type": "public-key", | ||
"id": "GramThanos8pyTMpdk0qJLv3eLhUP3EXIXjD-uyqD0gab1pdvGy1ig77ZLl_ZU_vnd2296FoIZ67pZqTChpSJPq_oqUhjmr5Osv_LLiY7YGsAafMUdIb_LKOdwc6sfXyy_Ygl3_w-vl3tU9EPGyzgtI7hTBeMXnSIaOV6CUUf6d9op4JyxEDJr-roWxRMJPfnVAMLvv4lF_Cpd6Of0o75nDcCtEsTiynINihIwee1gmg0BAVKh3seWoNqXMpiXgPWc9Jt8ibjN9O-bsag3tELVs9uOoe-NZEmwbph0jJh_Y6e2H5Nwkp7WghST0P6krTL_sUlbpmDolhfFut0YljLrOrz_llW-WHySwvaAG2vzgvxA", | ||
"rawId": "GramThanos8pyTMpdk0qJLv3eLhUP3EXIXjD-uyqD0gab1pdvGy1ig77ZLl_ZU_vnd2296FoIZ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