Diff
Modified: trunk/LayoutTests/ChangeLog (238237 => 238238)
--- trunk/LayoutTests/ChangeLog 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/LayoutTests/ChangeLog 2018-11-15 20:01:52 UTC (rev 238238)
@@ -1,3 +1,12 @@
+2018-11-15 Jiewen Tan <[email protected]>
+
+ [WebAuthN] UserHandle can be null
+ https://bugs.webkit.org/show_bug.cgi?id=191521
+
+ Reviewed by Alex Christensen.
+
+ * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+
2018-11-15 Daniel Bates <[email protected]>
[iOS] Shift + Tab does not focus previous field
Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html (238237 => 238238)
--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html 2018-11-15 20:01:52 UTC (rev 238238)
@@ -15,7 +15,7 @@
assert_equals(credential.type, 'public-key');
assert_array_equals(new Uint8Array(credential.rawId), Base64URL.parse(testHidCredentialIdBase64));
assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.get","challenge":"MTIzNDU2","origin":"https://localhost:9443","hashAlgorithm":"SHA-256"}');
- assert_equals(bytesToHexString(credential.response.userHandle), "00");
+ assert_equals(credential.response.userHandle, null);
// Check authData
const authData = decodeAuthData(new Uint8Array(credential.response.authenticatorData), false);
Modified: trunk/Source/WebCore/ChangeLog (238237 => 238238)
--- trunk/Source/WebCore/ChangeLog 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/Source/WebCore/ChangeLog 2018-11-15 20:01:52 UTC (rev 238238)
@@ -1,3 +1,28 @@
+2018-11-15 Jiewen Tan <[email protected]>
+
+ [WebAuthN] UserHandle can be null
+ https://bugs.webkit.org/show_bug.cgi?id=191521
+
+ Reviewed by Alex Christensen.
+
+ According to the newest spec as of 7 August, 2018: https://www.w3.org/TR/webauthn/#conforming-authenticators-u2f.
+ UserHandle can now be null.
+
+ Covered by existing tests.
+
+ * Modules/webauthn/AuthenticatorAssertionResponse.h:
+ (WebCore::AuthenticatorAssertionResponse::create):
+ (WebCore::AuthenticatorAssertionResponse::userHandle const):
+ (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
+ * Modules/webauthn/AuthenticatorAssertionResponse.idl:
+ * Modules/webauthn/PublicKeyCredential.cpp:
+ (WebCore::PublicKeyCredential::tryCreate):
+ * Modules/webauthn/PublicKeyCredentialData.h:
+ (WebCore::PublicKeyCredentialData::encode const):
+ (WebCore::PublicKeyCredentialData::decode):
+ * Modules/webauthn/fido/DeviceResponseConverter.cpp:
+ (fido::readCTAPGetAssertionResponse):
+
2018-11-15 Youenn Fablet <[email protected]>
Modernize RTCPeerConnection handling of pendingActivity
Modified: trunk/Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.h (238237 => 238238)
--- trunk/Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.h 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.h 2018-11-15 20:01:52 UTC (rev 238238)
@@ -33,7 +33,7 @@
class AuthenticatorAssertionResponse : public AuthenticatorResponse {
public:
- static Ref<AuthenticatorAssertionResponse> create(Ref<ArrayBuffer>&& clientDataJSON, Ref<ArrayBuffer>&& authenticatorData, Ref<ArrayBuffer>&& signature, Ref<ArrayBuffer>&& userHandle)
+ static Ref<AuthenticatorAssertionResponse> create(Ref<ArrayBuffer>&& clientDataJSON, Ref<ArrayBuffer>&& authenticatorData, Ref<ArrayBuffer>&& signature, RefPtr<ArrayBuffer>&& userHandle)
{
return adoptRef(*new AuthenticatorAssertionResponse(WTFMove(clientDataJSON), WTFMove(authenticatorData), WTFMove(signature), WTFMove(userHandle)));
}
@@ -42,10 +42,10 @@
ArrayBuffer* authenticatorData() const { return m_authenticatorData.ptr(); }
ArrayBuffer* signature() const { return m_signature.ptr(); }
- ArrayBuffer* userHandle() const { return m_userHandle.ptr(); }
+ ArrayBuffer* userHandle() const { return m_userHandle.get(); }
private:
- AuthenticatorAssertionResponse(Ref<ArrayBuffer>&& clientDataJSON, Ref<ArrayBuffer>&& authenticatorData, Ref<ArrayBuffer>&& signature, Ref<ArrayBuffer>&& userHandle)
+ AuthenticatorAssertionResponse(Ref<ArrayBuffer>&& clientDataJSON, Ref<ArrayBuffer>&& authenticatorData, Ref<ArrayBuffer>&& signature, RefPtr<ArrayBuffer>&& userHandle)
: AuthenticatorResponse(WTFMove(clientDataJSON))
, m_authenticatorData(WTFMove(authenticatorData))
, m_signature(WTFMove(signature))
@@ -57,7 +57,7 @@
Ref<ArrayBuffer> m_authenticatorData;
Ref<ArrayBuffer> m_signature;
- Ref<ArrayBuffer> m_userHandle;
+ RefPtr<ArrayBuffer> m_userHandle;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.idl (238237 => 238238)
--- trunk/Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.idl 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.idl 2018-11-15 20:01:52 UTC (rev 238238)
@@ -31,5 +31,5 @@
] interface AuthenticatorAssertionResponse : AuthenticatorResponse {
[SameObject] readonly attribute ArrayBuffer authenticatorData;
[SameObject] readonly attribute ArrayBuffer signature;
- [SameObject] readonly attribute ArrayBuffer userHandle;
+ [SameObject] readonly attribute ArrayBuffer? userHandle;
};
Modified: trunk/Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp (238237 => 238238)
--- trunk/Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp 2018-11-15 20:01:52 UTC (rev 238238)
@@ -57,10 +57,10 @@
return adoptRef(*new PublicKeyCredential(data.rawId.releaseNonNull(), AuthenticatorAttestationResponse::create(data.clientDataJSON.releaseNonNull(), data.attestationObject.releaseNonNull())));
}
- if (!data.authenticatorData || !data.signature || !data.userHandle)
+ if (!data.authenticatorData || !data.signature)
return nullptr;
- return adoptRef(*new PublicKeyCredential(data.rawId.releaseNonNull(), AuthenticatorAssertionResponse::create(data.clientDataJSON.releaseNonNull(), data.authenticatorData.releaseNonNull(), data.signature.releaseNonNull(), data.userHandle.releaseNonNull())));
+ return adoptRef(*new PublicKeyCredential(data.rawId.releaseNonNull(), AuthenticatorAssertionResponse::create(data.clientDataJSON.releaseNonNull(), data.authenticatorData.releaseNonNull(), data.signature.releaseNonNull(), WTFMove(data.userHandle))));
}
PublicKeyCredential::PublicKeyCredential(Ref<ArrayBuffer>&& id, Ref<AuthenticatorResponse>&& response)
Modified: trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h (238237 => 238238)
--- trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h 2018-11-15 20:01:52 UTC (rev 238238)
@@ -74,12 +74,18 @@
return;
}
- if (!authenticatorData || !signature || !userHandle)
+ if (!authenticatorData || !signature)
return;
encoder << static_cast<uint64_t>(authenticatorData->byteLength());
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(authenticatorData->data()), authenticatorData->byteLength(), 1);
encoder << static_cast<uint64_t>(signature->byteLength());
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(signature->data()), signature->byteLength(), 1);
+
+ if (!userHandle) {
+ encoder << false;
+ return;
+ }
+ encoder << true;
encoder << static_cast<uint64_t>(userHandle->byteLength());
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(userHandle->data()), userHandle->byteLength(), 1);
}
@@ -142,6 +148,13 @@
if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(result.signature->data()), signatureLength.value(), 1))
return std::nullopt;
+ std::optional<bool> hasUserHandle;
+ decoder >> hasUserHandle;
+ if (!hasUserHandle)
+ return std::nullopt;
+ if (!*hasUserHandle)
+ return result;
+
std::optional<uint64_t> userHandleLength;
decoder >> userHandleLength;
if (!userHandleLength)
Modified: trunk/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp (238237 => 238238)
--- trunk/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp 2018-11-15 19:48:45 UTC (rev 238237)
+++ trunk/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp 2018-11-15 20:01:52 UTC (rev 238238)
@@ -158,8 +158,7 @@
return std::nullopt;
auto& signature = it->second.getByteString();
- // FIXME(191521): Properly handle null userHandle.
- RefPtr<ArrayBuffer> userHandle = ArrayBuffer::create(1, 1);
+ RefPtr<ArrayBuffer> userHandle;
it = responseMap.find(CBOR(4));
if (it != responseMap.end() && it->second.isMap()) {
auto& user = it->second.getMap();