Bug 1718228 - Make CollectedClientData follow the spec r=dveditz,baku

Differential Revision: https://phabricator.services.mozilla.com/D136881
This commit is contained in:
R. Martinho Fernandes 2022-05-03 15:52:36 +00:00
Родитель 351616349b
Коммит 7775acb534
3 изменённых файлов: 8 добавлений и 14 удалений

Просмотреть файл

@ -76,8 +76,6 @@ static nsresult AssembleClientData(
clientDataObject.mType.Assign(aType);
clientDataObject.mChallenge.Assign(challengeBase64);
clientDataObject.mOrigin.Assign(aOrigin);
clientDataObject.mHashAlgorithm.AssignLiteral(u"SHA-256");
clientDataObject.mClientExtensions = aExtensions;
nsAutoString temp;
if (NS_WARN_IF(!clientDataObject.ToJSON(temp))) {

Просмотреть файл

@ -50,7 +50,6 @@ function() {
- response : AuthenticatorAttestationResponse : AuthenticatorResponse
- attestationObject: CBOR object
- clientDataJSON: serialized JSON
- clientExtensionResults: (not yet supported)
*/
is(aCredInfo.type, "public-key", "Credential type must be public-key")
@ -66,13 +65,8 @@ function() {
let clientData = JSON.parse(buffer2string(aCredInfo.response.clientDataJSON));
is(clientData.challenge, bytesToBase64UrlSafe(gCredentialChallenge), "Challenge is correct");
is(clientData.origin, window.location.origin, "Origin is correct");
is(clientData.hashAlgorithm, "SHA-256", "Hash algorithm is correct");
is(clientData.type, "webauthn.create", "Type is correct");
let extensions = aCredInfo.getClientExtensionResults();
is(extensions.appid, undefined, "appid extension wasn't used");
is(clientData.clientExtensions.appid, undefined, "appid extension wasn't sent");
return webAuthnDecodeCBORAttestation(aCredInfo.response.attestationObject)
.then(function(aAttestationObj) {
// Make sure the RP ID hash matches what we calculate.
@ -118,7 +112,6 @@ function() {
ok(aAssertion.response.signature === aAssertion.response.signature, "AuthenticatorAssertionResponse.Signature is SameObject");
ok(aAssertion.response.signature instanceof ArrayBuffer, "AuthenticatorAssertionResponse.Signature is an ArrayBuffer");
ok(aAssertion.response.userHandle === null, "AuthenticatorAssertionResponse.UserHandle is null for u2f authenticators");
isDeeply(aAssertion.getClientExtensionResults(), {}, "No extensions should be reported");
ok(aAssertion.response.authenticatorData.byteLength > 0, "Authenticator data exists");
let clientData = JSON.parse(buffer2string(aAssertion.response.clientDataJSON));

Просмотреть файл

@ -140,13 +140,16 @@ dictionary CollectedClientData {
required DOMString type;
required DOMString challenge;
required DOMString origin;
required DOMString hashAlgorithm;
DOMString tokenBindingId;
// FIXME: bug 1493860: should this "= {}" be here?
AuthenticationExtensionsClientInputs clientExtensions = {};
AuthenticationExtensionsAuthenticatorInputs authenticatorExtensions;
TokenBinding tokenBinding;
};
dictionary TokenBinding {
required DOMString status;
DOMString id;
};
enum TokenBindingStatus { "present", "supported" };
enum PublicKeyCredentialType {
"public-key"
};