Title: [292593] trunk/Source/WebKit
Revision
292593
Author
j_pas...@apple.com
Date
2022-04-07 22:40:06 -0700 (Thu, 07 Apr 2022)

Log Message

[WebAuthn] Support all CTAP transports and remove gesture requirement for virtual authenticators
https://bugs.webkit.org/show_bug.cgi?id=238814
rdar://problem/91300515

Reviewed by Brent Fulgham.

This patch adds support for the other CTAP virtual authenticator transports and removes
the user gesture requirement when using virtual authenticators. These changes are needed
to run the webauthn web-platform-tests.

* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::WebCore::collectTransports):
(WebKit::AuthenticatorManager::filterTransports const):
* UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
(WebKit::MockAuthenticatorManager::filterTransports const):
* UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp:
(WebKit::VirtualAuthenticatorManager::createAuthenticator):
* UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h:
* UIProcess/WebAuthentication/Virtual/VirtualLocalConnection.mm:
(WebKit::VirtualLocalConnection::verifyUser):
* UIProcess/WebAuthentication/Virtual/VirtualService.mm:
(WebKit::VirtualService::startDiscoveryInternal):
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
(WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (292592 => 292593)


--- trunk/Source/WebKit/ChangeLog	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/ChangeLog	2022-04-08 05:40:06 UTC (rev 292593)
@@ -1,3 +1,30 @@
+2022-04-07  J Pascoe  <j_pas...@apple.com>
+
+        [WebAuthn] Support all CTAP transports and remove gesture requirement for virtual authenticators
+        https://bugs.webkit.org/show_bug.cgi?id=238814
+        rdar://problem/91300515
+
+        Reviewed by Brent Fulgham.
+
+        This patch adds support for the other CTAP virtual authenticator transports and removes
+        the user gesture requirement when using virtual authenticators. These changes are needed
+        to run the webauthn web-platform-tests.
+
+        * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+        (WebKit::WebCore::collectTransports):
+        (WebKit::AuthenticatorManager::filterTransports const):
+        * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
+        (WebKit::MockAuthenticatorManager::filterTransports const):
+        * UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp:
+        (WebKit::VirtualAuthenticatorManager::createAuthenticator):
+        * UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h:
+        * UIProcess/WebAuthentication/Virtual/VirtualLocalConnection.mm:
+        (WebKit::VirtualLocalConnection::verifyUser):
+        * UIProcess/WebAuthentication/Virtual/VirtualService.mm:
+        (WebKit::VirtualService::startDiscoveryInternal):
+        * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
+        (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
+
 2022-04-07  Elliott Williams  <e...@apple.com>
 
         [XCBuild] Enable dependency validation by default

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (292592 => 292593)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2022-04-08 05:40:06 UTC (rev 292593)
@@ -63,6 +63,8 @@
         ASSERT_UNUSED(addResult, addResult.isNewEntry);
         addResult = result.add(AuthenticatorTransport::Nfc);
         ASSERT_UNUSED(addResult, addResult.isNewEntry);
+        addResult = result.add(AuthenticatorTransport::Ble);
+        ASSERT_UNUSED(addResult, addResult.isNewEntry);
         return result;
     }
 
@@ -76,6 +78,8 @@
         ASSERT_UNUSED(addResult, addResult.isNewEntry);
         addResult = result.add(AuthenticatorTransport::Nfc);
         ASSERT_UNUSED(addResult, addResult.isNewEntry);
+        addResult = result.add(AuthenticatorTransport::Ble);
+        ASSERT_UNUSED(addResult, addResult.isNewEntry);
         return result;
     }
 
@@ -98,6 +102,8 @@
         ASSERT_UNUSED(addResult, addResult.isNewEntry);
         addResult = result.add(AuthenticatorTransport::Nfc);
         ASSERT_UNUSED(addResult, addResult.isNewEntry);
+        addResult = result.add(AuthenticatorTransport::Ble);
+        ASSERT_UNUSED(addResult, addResult.isNewEntry);
     }
 
     for (auto& allowCredential : allowCredentials) {
@@ -105,6 +111,7 @@
             result.add(AuthenticatorTransport::Internal);
             result.add(AuthenticatorTransport::Usb);
             result.add(AuthenticatorTransport::Nfc);
+            result.add(AuthenticatorTransport::Ble);
 
             break;
         }
@@ -124,6 +131,7 @@
         if (authenticatorAttachment == AuthenticatorAttachment::Platform) {
             result.remove(AuthenticatorTransport::Usb);
             result.remove(AuthenticatorTransport::Nfc);
+            result.remove(AuthenticatorTransport::Ble);
         }
 
         if (authenticatorAttachment == AuthenticatorAttachment::CrossPlatform)
@@ -163,7 +171,7 @@
 
 } // namespace
 
-const size_t AuthenticatorManager::maxTransportNumber = 3;
+const size_t AuthenticatorManager::maxTransportNumber = 4;
 
 AuthenticatorManager::AuthenticatorManager()
     : m_requestTimeOutTimer(RunLoop::main(), this, &AuthenticatorManager::timeOutTimerFired)
@@ -406,6 +414,7 @@
         transports.remove(AuthenticatorTransport::Nfc);
     if (!LocalService::isAvailable())
         transports.remove(AuthenticatorTransport::Internal);
+    transports.remove(AuthenticatorTransport::Ble);
 
     // For the modern UI, we should only consider invoking it when the operation is triggered by users.
     if (!m_pendingRequestData.processingUserGesture)

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp (292592 => 292593)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp	2022-04-08 05:40:06 UTC (rev 292593)
@@ -56,6 +56,7 @@
         transports.remove(WebCore::AuthenticatorTransport::Nfc);
     if (!m_testConfiguration.local)
         transports.remove(WebCore::AuthenticatorTransport::Internal);
+    transports.remove(WebCore::AuthenticatorTransport::Ble);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp (292592 => 292593)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp	2022-04-08 05:40:06 UTC (rev 292593)
@@ -42,8 +42,6 @@
 
 String VirtualAuthenticatorManager::createAuthenticator(const VirtualAuthenticatorConfiguration& config)
 {
-    if (config.transport != WebCore::AuthenticatorTransport::Internal && config.transport != WebCore::AuthenticatorTransport::Usb)
-        UNIMPLEMENTED();
     auto id = createVersion4UUIDString();
     m_virtualAuthenticators.set(id, makeUniqueRef<VirtualAuthenticatorConfiguration>(config));
     Vector<VirtualCredential> credentials;

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h (292592 => 292593)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h	2022-04-08 05:40:06 UTC (rev 292593)
@@ -55,6 +55,7 @@
 private:
     UniqueRef<AuthenticatorTransportService> createService(WebCore::AuthenticatorTransport, AuthenticatorTransportService::Observer&) const final;
     void runPanel() override;
+    void filterTransports(TransportSet&) const override { };
 
     HashMap<String, UniqueRef<VirtualAuthenticatorConfiguration>> m_virtualAuthenticators;
     HashMap<String, Vector<VirtualCredential>> m_credentialsByAuthenticator;

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualLocalConnection.mm (292592 => 292593)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualLocalConnection.mm	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualLocalConnection.mm	2022-04-08 05:40:06 UTC (rev 292593)
@@ -59,7 +59,7 @@
         }
         ASSERT(weakThis->m_configuration.transport == AuthenticatorTransport::Internal);
 
-        UserVerification userVerification = weakThis->m_configuration.isUserVerified ? UserVerification::Yes : UserVerification::No;
+        UserVerification userVerification = weakThis->m_configuration.isUserVerified ? UserVerification::Yes : UserVerification::Presence;
 
         callback(userVerification, adoptNS([allocLAContextInstance() init]).get());
     });
@@ -75,7 +75,7 @@
         }
         ASSERT(weakThis->m_configuration.transport == AuthenticatorTransport::Internal);
 
-        UserVerification userVerification = weakThis->m_configuration.isUserVerified ? UserVerification::Yes : UserVerification::No;
+        UserVerification userVerification = weakThis->m_configuration.isUserVerified ? UserVerification::Yes : UserVerification::Presence;
 
         callback(userVerification);
     });

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualService.mm (292592 => 292593)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualService.mm	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualService.mm	2022-04-08 05:40:06 UTC (rev 292593)
@@ -70,6 +70,8 @@
         auto config = authenticator.second;
         auto authenticatorId = authenticator.first;
         switch (config.transport) {
+        case WebCore::AuthenticatorTransport::Nfc:
+        case WebCore::AuthenticatorTransport::Ble:
         case WebCore::AuthenticatorTransport::Usb:
             observer()->authenticatorAdded(CtapAuthenticator::create(WTF::makeUnique<CtapHidDriver>(makeUniqueRef<VirtualHidConnection>(authenticatorId, config, WeakPtr { static_cast<VirtualAuthenticatorManager *>(observer()) })), authenticatorInfoForConfig(config)));
             break;

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp (292592 => 292593)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp	2022-04-08 04:59:16 UTC (rev 292592)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp	2022-04-08 05:40:06 UTC (rev 292593)
@@ -107,7 +107,7 @@
             handler({ }, (AuthenticatorAttachment)0, ExceptionData { NotAllowedError, "This request has been cancelled by the user."_s });
     };
     
-    if (!data.processingUserGesture)
+    if (!data.processingUserGesture && !m_webPageProxy.websiteDataStore().authenticatorManager().isVirtual())
         m_webPageProxy.uiClient().requestWebAuthenticationNoGesture(origin, WTFMove(afterConsent));
     else
         afterConsent(true);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to