Title: [269168] trunk
Revision
269168
Author
[email protected]
Date
2020-10-29 14:10:09 -0700 (Thu, 29 Oct 2020)

Log Message

[WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests
https://bugs.webkit.org/show_bug.cgi?id=218070
<rdar://problem/70384404>

Reviewed by Brent Fulgham.

Source/WebCore:

Covered by existing tests.

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setWebAuthenticationModernEnabled):
(WebCore::RuntimeEnabledFeatures::webAuthenticationModernEnabled const):
Adds bindings in WebCore.

Source/WebKit:

Once modern web authentication is enabled, let WebContent process talk to the WebAuthn process
for WebAuthn requests.

* Scripts/process-entitlements.sh:
Adds necessary entitlements for the WebAuthn process.

* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::handleRequest):
Adds a way to distinguish if itself is in the UI Process or in the WebAuthn process.

* WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp:
(WebKit::WebAuthnConnectionToWebProcess::makeCredential):
(WebKit::WebAuthnConnectionToWebProcess::getAssertion):
(WebKit::WebAuthnConnectionToWebProcess::handleRequest):
(WebKit::WebAuthnConnectionToWebProcess::isUserVerifyingPlatformAuthenticatorAvailable):
(WebKit::WebAuthnConnectionToWebProcess::setMockWebAuthenticationConfiguration):
* WebAuthnProcess/WebAuthnConnectionToWebProcess.h:
* WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in:
Adds receivers for messages coming from the web content processes.

* WebAuthnProcess/WebAuthnProcess.cpp:
(WebKit::WebAuthnProcess::WebAuthnProcess):
(WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration):
* WebAuthnProcess/WebAuthnProcess.h:
(WebKit::WebAuthnProcess::authenticatorManager):
Handles the authenticator managers.

* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
Relaxes sandbox for necessary hardware accesses.

* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
(WebKit::WebAuthenticatorCoordinator::makeCredential):
(WebKit::WebAuthenticatorCoordinator::getAssertion):
(WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setMockWebAuthenticationConfiguration):
Sends messages to the WebAuthn process accordingly.

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:
Adds bindings in WebCore.

LayoutTests:

Modifies tests that can run on the new WebAuthn process run on it. Some tests will require
mock UI interactions which is not currently supported for the new WebAuthn process. Therefore,
they still run on the UI process.

* http/wpt/webauthn/ctap-hid-failure.https.html:
* http/wpt/webauthn/ctap-hid-success.https.html:
* http/wpt/webauthn/ctap-nfc-failure.https.html:
* http/wpt/webauthn/idl.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-hid.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html:
* http/wpt/webauthn/public-key-credential-create-failure.https.html:
* http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
* http/wpt/webauthn/public-key-credential-create-success-local.https.html:
* http/wpt/webauthn/public-key-credential-create-success-nfc.https.html:
* http/wpt/webauthn/public-key-credential-create-success-u2f.https.html:
* http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-hid.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html:
* http/wpt/webauthn/public-key-credential-get-failure.https.html:
* http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
* http/wpt/webauthn/public-key-credential-get-success-local.https.html:
* http/wpt/webauthn/public-key-credential-get-success-nfc.https.html:
* http/wpt/webauthn/public-key-credential-get-success-u2f.https.html:
* http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html:
* http/wpt/webauthn/public-key-credential-ip-address.html:
* http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html:
* http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html:
* http/wpt/webauthn/public-key-credential-unfocused-document.https.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269167 => 269168)


--- trunk/LayoutTests/ChangeLog	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/ChangeLog	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,3 +1,50 @@
+2020-10-29  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests
+        https://bugs.webkit.org/show_bug.cgi?id=218070
+        <rdar://problem/70384404>
+
+        Reviewed by Brent Fulgham.
+
+        Modifies tests that can run on the new WebAuthn process run on it. Some tests will require
+        mock UI interactions which is not currently supported for the new WebAuthn process. Therefore,
+        they still run on the UI process.
+
+        * http/wpt/webauthn/ctap-hid-failure.https.html:
+        * http/wpt/webauthn/ctap-hid-success.https.html:
+        * http/wpt/webauthn/ctap-nfc-failure.https.html:
+        * http/wpt/webauthn/idl.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-local.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-local.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html:
+        * http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-local.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-local.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-u2f.https.html:
+        * http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html:
+        * http/wpt/webauthn/public-key-credential-ip-address.html:
+        * http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html:
+        * http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html:
+        * http/wpt/webauthn/public-key-credential-unfocused-document.https.html:
+
 2020-10-29  Karl Rackler  <[email protected]>
 
         REGRESSION (r269070): [ Big Sur ] editing/input/reveal-caret-of-multiline-input.html is a constant failure

Modified: trunk/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: CTAP HID failure cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: CTAP HID success cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: CTAP NFC failure cases with a mock nfc authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/idl.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/idl.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/idl.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <html>
 <head>
     <meta charset=utf-8>

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] failure cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] failure cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] silent failure cases with a mock local authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=false ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] failure cases with a mock local authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] failure cases with a mock nfc authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] failure cases with a mock u2f authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] failure cases with a mock u2f authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] failure cases.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] success cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=false ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] success cases with a mock local authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=false ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] success cases with a mock nfc authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] success cases with a mock u2f authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[create]] with invalid parameters.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=false ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases with a mock nfc authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases with a mock u2f authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases with a mock u2f authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=false ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] success cases with a mock hid authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=false ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=false ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] success cases with a mock nfc authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] success cases with a mock u2f authenticator.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential's [[get]] with invalid parameters.</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-ip-address.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-ip-address.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-ip-address.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <script>
     if (window.testRunner) {
         testRunner.dumpAsText();

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <title>Web Authentication API: PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable().</title>
 <script src=""
 <script src=""

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <html>
 <head>
     <meta charset="utf-8">

Modified: trunk/LayoutTests/http/wpt/webauthn/public-key-credential-unfocused-document.https.html (269167 => 269168)


--- trunk/LayoutTests/http/wpt/webauthn/public-key-credential-unfocused-document.https.html	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/LayoutTests/http/wpt/webauthn/public-key-credential-unfocused-document.https.html	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAuthenticationModernEnabled=true ] -->
 <html>
 <head>
     <meta charset="utf-8">

Modified: trunk/Source/WTF/ChangeLog (269167 => 269168)


--- trunk/Source/WTF/ChangeLog	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WTF/ChangeLog	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,3 +1,14 @@
+2020-10-29  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests
+        https://bugs.webkit.org/show_bug.cgi?id=218070
+        <rdar://problem/70384404>
+
+        Reviewed by Brent Fulgham.
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+        Adds bindings in WebCore.
+
 2020-10-28  Saam Barati  <[email protected]>
 
         Better cache our serialization of the outer TDZ environment when creating FunctionExecutables during bytecode generation

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (269167 => 269168)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2020-10-29 21:10:09 UTC (rev 269168)
@@ -900,6 +900,7 @@
   humanReadableName: "Web Authentication Modern"
   humanReadableDescription: "Enable Modern Web Authentication support"
   condition: ENABLE(WEB_AUTHN)
+  webcoreBinding: RuntimeEnabledFeatures
   defaultValue:
     WebKitLegacy:
       default: false

Modified: trunk/Source/WebCore/ChangeLog (269167 => 269168)


--- trunk/Source/WebCore/ChangeLog	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebCore/ChangeLog	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,3 +1,18 @@
+2020-10-29  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests
+        https://bugs.webkit.org/show_bug.cgi?id=218070
+        <rdar://problem/70384404>
+
+        Reviewed by Brent Fulgham.
+
+        Covered by existing tests.
+
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setWebAuthenticationModernEnabled):
+        (WebCore::RuntimeEnabledFeatures::webAuthenticationModernEnabled const):
+        Adds bindings in WebCore.
+
 2020-10-29  Tetsuharu Ohzeki  <[email protected]>
 
         Make WebCore::ContainerNode::ChildChangeType enum class

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (269167 => 269168)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-10-29 21:10:09 UTC (rev 269168)
@@ -246,6 +246,11 @@
     bool disableMediaExperiencePIDInheritance() const { return m_disableMediaExperiencePIDInheritance; }
 #endif
 
+#if ENABLE(WEB_AUTHN)
+    void setWebAuthenticationModernEnabled(bool areEnabled) { m_areWebAuthenticationModernEnabled = areEnabled; }
+    bool webAuthenticationModernEnabled() const { return m_areWebAuthenticationModernEnabled; }
+#endif
+
 private:
     // Never instantiate.
     RuntimeEnabledFeatures();
@@ -370,6 +375,10 @@
     bool m_disableMediaExperiencePIDInheritance { false };
 #endif
 
+#if ENABLE(WEB_AUTHN)
+    bool m_areWebAuthenticationModernEnabled { false };
+#endif
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 

Modified: trunk/Source/WebKit/ChangeLog (269167 => 269168)


--- trunk/Source/WebKit/ChangeLog	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/ChangeLog	2020-10-29 21:10:09 UTC (rev 269168)
@@ -1,3 +1,49 @@
+2020-10-29  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests
+        https://bugs.webkit.org/show_bug.cgi?id=218070
+        <rdar://problem/70384404>
+
+        Reviewed by Brent Fulgham.
+
+        Once modern web authentication is enabled, let WebContent process talk to the WebAuthn process
+        for WebAuthn requests.
+
+        * Scripts/process-entitlements.sh:
+        Adds necessary entitlements for the WebAuthn process.
+
+        * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+        (WebKit::AuthenticatorManager::handleRequest):
+        Adds a way to distinguish if itself is in the UI Process or in the WebAuthn process.
+
+        * WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp:
+        (WebKit::WebAuthnConnectionToWebProcess::makeCredential):
+        (WebKit::WebAuthnConnectionToWebProcess::getAssertion):
+        (WebKit::WebAuthnConnectionToWebProcess::handleRequest):
+        (WebKit::WebAuthnConnectionToWebProcess::isUserVerifyingPlatformAuthenticatorAvailable):
+        (WebKit::WebAuthnConnectionToWebProcess::setMockWebAuthenticationConfiguration):
+        * WebAuthnProcess/WebAuthnConnectionToWebProcess.h:
+        * WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in:
+        Adds receivers for messages coming from the web content processes.
+
+        * WebAuthnProcess/WebAuthnProcess.cpp:
+        (WebKit::WebAuthnProcess::WebAuthnProcess):
+        (WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration):
+        * WebAuthnProcess/WebAuthnProcess.h:
+        (WebKit::WebAuthnProcess::authenticatorManager):
+        Handles the authenticator managers.
+
+        * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
+        Relaxes sandbox for necessary hardware accesses.
+
+        * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
+        (WebKit::WebAuthenticatorCoordinator::makeCredential):
+        (WebKit::WebAuthenticatorCoordinator::getAssertion):
+        (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration):
+        Sends messages to the WebAuthn process accordingly.
+
 2020-10-29  Per Arne Vollan  <[email protected]>
 
         [macOS] Add required entitlement for message filtering

Modified: trunk/Source/WebKit/Scripts/process-entitlements.sh (269167 => 269168)


--- trunk/Source/WebKit/Scripts/process-entitlements.sh	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/Scripts/process-entitlements.sh	2020-10-29 21:10:09 UTC (rev 269168)
@@ -44,6 +44,27 @@
     fi
 }
 
+function mac_process_webauthn_entitlements()
+{
+    if [[ "${WK_USE_RESTRICTED_ENTITLEMENTS}" == YES ]]
+    then
+        plistbuddy Add :com.apple.security.device.usb bool YES
+
+        plistbuddy Add :keychain-access-groups array
+        plistbuddy Add :keychain-access-groups:0 string com.apple.webkit.webauthn
+        plistbuddy Add :keychain-access-groups:1 string lockdown-identities
+
+        plistbuddy Add :com.apple.security.attestation.access bool YES
+        plistbuddy Add :com.apple.keystore.sik.access bool YES
+        plistbuddy Add :com.apple.private.RemoteServiceDiscovery.allow-sandbox bool YES
+        plistbuddy Add :com.apple.private.RemoteServiceDiscovery.device-admin bool YES
+        plistbuddy Add :com.apple.appattest.spi bool YES
+        plistbuddy Add :com.apple.mobileactivationd.spi bool YES
+        plistbuddy Add :com.apple.mobileactivationd.bridge bool YES
+        plistbuddy Add :com.apple.private.security.bootpolicy bool YES
+    fi
+}
+
 function mac_process_network_entitlements()
 {
     if [[ "${WK_USE_RESTRICTED_ENTITLEMENTS}" == YES ]]
@@ -194,6 +215,39 @@
     plistbuddy Add :seatbelt-profiles:0 string com.apple.WebKit.GPU
 }
 
+function ios_family_process_webauthn_entitlements()
+{
+    plistbuddy Add :com.apple.security.device.usb bool YES
+
+    plistbuddy Add :com.apple.private.tcc.allow array
+    plistbuddy Add :com.apple.private.tcc.allow:0 string kTCCServiceListenEvent
+
+    plistbuddy Add :com.apple.security.application-groups array
+    plistbuddy Add :com.apple.security.application-groups:0 string group.com.apple.webkit
+
+    plistbuddy Add :com.apple.security.exception.mach-lookup.global-name array
+    plistbuddy Add :com.apple.security.exception.mach-lookup.global-name:0 string com.apple.nfcd.hwmanager
+
+    plistbuddy Add :com.apple.nfcd.hwmanager bool YES
+    plistbuddy Add :com.apple.nfcd.session.reader.internal bool YES
+
+    plistbuddy Add :keychain-access-groups array
+    plistbuddy Add :keychain-access-groups:0 string com.apple.webkit.webauthn
+    plistbuddy Add :keychain-access-groups:1 string lockdown-identities
+
+    plistbuddy Add :com.apple.private.MobileGestalt.AllowedProtectedKeys array
+    plistbuddy Add :com.apple.private.MobileGestalt.AllowedProtectedKeys:0 string UniqueChipID
+    plistbuddy Add :com.apple.private.MobileGestalt.AllowedProtectedKeys:1 string SerialNumber
+
+    plistbuddy Add :com.apple.security.system-groups array
+    plistbuddy Add :com.apple.security.system-groups:0 string systemgroup.com.apple.mobileactivationd
+
+    plistbuddy Add :com.apple.security.attestation.access bool YES
+    plistbuddy Add :com.apple.keystore.sik.access bool YES
+    plistbuddy Add :com.apple.appattest.spi bool YES
+    plistbuddy Add :com.apple.mobileactivationd.spi bool YES
+}
+
 function ios_family_process_network_entitlements()
 {
     plistbuddy Add :com.apple.multitasking.systemappassertions bool YES
@@ -238,6 +292,7 @@
     elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.Networking ]]; then mac_process_network_entitlements
     elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.Plugin.64 ]]; then mac_process_plugin_entitlements
     elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.GPU ]]; then mac_process_gpu_entitlements
+    elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.WebAuthn ]]; then mac_process_webauthn_entitlements
     else echo "Unsupported/unknown product: ${PRODUCT_NAME}"
     fi
 elif [[ "${WK_PLATFORM_NAME}" == maccatalyst || "${WK_PLATFORM_NAME}" == iosmac ]]
@@ -260,6 +315,7 @@
     elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.Networking ]]; then ios_family_process_network_entitlements
     elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.Plugin.64 ]]; then ios_family_process_plugin_entitlements
     elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.GPU ]]; then ios_family_process_gpu_entitlements
+    elif [[ "${PRODUCT_NAME}" == com.apple.WebKit.WebAuthn ]]; then ios_family_process_webauthn_entitlements
     else echo "Unsupported/unknown product: ${PRODUCT_NAME}"
     fi
 else

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (269167 => 269168)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2020-10-29 21:10:09 UTC (rev 269168)
@@ -163,7 +163,14 @@
 
     // 2. Ask clients to show appropriate UI if any and then start the request.
     initTimeOutTimer();
-    runPanel();
+
+    // FIXME<rdar://problem/70822834>: The WebPageProxy is used to determine whether or not we are in the UIProcess.
+    // If so, continue to the old route. Otherwise, use the modern WebAuthn process way.
+    if (m_pendingRequestData.page) {
+        runPanel();
+        return;
+    }
+    startDiscovery(getTransports());
 }
 
 void AuthenticatorManager::cancelRequest(const PageIdentifier& pageID, const Optional<FrameIdentifier>& frameID)

Modified: trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp (269167 => 269168)


--- trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp	2020-10-29 21:10:09 UTC (rev 269168)
@@ -28,6 +28,11 @@
 
 #if ENABLE(WEB_AUTHN)
 
+#include "AuthenticatorManager.h"
+#include "LocalService.h"
+#include "WebAuthnProcess.h"
+#include <WebCore/AuthenticatorResponseData.h>
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -62,6 +67,39 @@
     CRASH();
 }
 
+void WebAuthnConnectionToWebProcess::makeCredential(Vector<uint8_t>&& hash, PublicKeyCredentialCreationOptions&& options, bool processingUserGesture, RequestCompletionHandler&& handler)
+{
+    handleRequest({ WTFMove(hash), WTFMove(options), nullptr, WebAuthenticationPanelResult::Unavailable, nullptr, WTF::nullopt, { }, processingUserGesture, String() }, WTFMove(handler));
+}
+
+void WebAuthnConnectionToWebProcess::getAssertion(Vector<uint8_t>&& hash, PublicKeyCredentialRequestOptions&& options, bool processingUserGesture, RequestCompletionHandler&& handler)
+{
+    handleRequest({ WTFMove(hash), WTFMove(options), nullptr, WebAuthenticationPanelResult::Unavailable, nullptr, WTF::nullopt, { }, processingUserGesture, String() }, WTFMove(handler));
+}
+
+void WebAuthnConnectionToWebProcess::handleRequest(WebAuthenticationRequestData&& data, RequestCompletionHandler&& handler)
+{
+    auto callback = [handler = WTFMove(handler)] (Variant<Ref<AuthenticatorResponse>, ExceptionData>&& result) mutable {
+        ASSERT(RunLoop::isMain());
+        WTF::switchOn(result, [&](const Ref<AuthenticatorResponse>& response) {
+            handler(response->data(), { });
+        }, [&](const ExceptionData& exception) {
+            handler({ }, exception);
+        });
+    };
+    m_WebAuthnProcess->authenticatorManager().handleRequest(WTFMove(data), WTFMove(callback));
+}
+
+void WebAuthnConnectionToWebProcess::isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&& handler)
+{
+    handler(LocalService::isAvailable());
+}
+
+void WebAuthnConnectionToWebProcess::setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&& configuration)
+{
+    m_WebAuthnProcess->setMockWebAuthenticationConfiguration(WTFMove(configuration));
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(WEB_AUTHN)

Modified: trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.h (269167 => 269168)


--- trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.h	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.h	2020-10-29 21:10:09 UTC (rev 269168)
@@ -32,9 +32,18 @@
 #include <WebCore/ProcessIdentifier.h>
 #include <wtf/RefCounted.h>
 
+namespace WebCore {
+struct AuthenticatorResponseData;
+struct ExceptionData;
+struct MockWebAuthenticationConfiguration;
+struct PublicKeyCredentialCreationOptions;
+struct PublicKeyCredentialRequestOptions;
+}
+
 namespace WebKit {
 
 class WebAuthnProcess;
+struct WebAuthenticationRequestData;
 
 class WebAuthnConnectionToWebProcess
     : public RefCounted<WebAuthnConnectionToWebProcess>
@@ -51,12 +60,24 @@
     void endSuspension();
 
 private:
+    using RequestCompletionHandler = CompletionHandler<void(const WebCore::AuthenticatorResponseData&, const WebCore::ExceptionData&)>;
+    using QueryCompletionHandler = CompletionHandler<void(bool)>;
+
     WebAuthnConnectionToWebProcess(WebAuthnProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier);
 
     // IPC::Connection::Client
     void didClose(IPC::Connection&) final;
     void didReceiveInvalidMessage(IPC::Connection&, IPC::MessageName) final;
+    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 
+    // Receivers.
+    void makeCredential(Vector<uint8_t>&& hash, WebCore::PublicKeyCredentialCreationOptions&&, bool processingUserGesture, RequestCompletionHandler&&);
+    void getAssertion(Vector<uint8_t>&& hash, WebCore::PublicKeyCredentialRequestOptions&&, bool processingUserGesture, RequestCompletionHandler&&);
+    void isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&&);
+    void setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&&);
+
+    void handleRequest(WebAuthenticationRequestData&&, RequestCompletionHandler&&);
+
     Ref<IPC::Connection> m_connection;
     Ref<WebAuthnProcess> m_WebAuthnProcess;
     const WebCore::ProcessIdentifier m_webProcessIdentifier;

Modified: trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in (269167 => 269168)


--- trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in	2020-10-29 21:10:09 UTC (rev 269168)
@@ -23,6 +23,12 @@
 #if ENABLE(WEB_AUTHN)
 
 messages -> WebAuthnConnectionToWebProcess {
+
+    MakeCredential(Vector<uint8_t> hash, struct WebCore::PublicKeyCredentialCreationOptions options, bool processingUserGesture) -> (struct WebCore::AuthenticatorResponseData data, struct WebCore::ExceptionData exception) Async
+    GetAssertion(Vector<uint8_t> hash, struct WebCore::PublicKeyCredentialRequestOptions options, bool processingUserGesture) -> (struct WebCore::AuthenticatorResponseData data, struct WebCore::ExceptionData exception) Async
+    IsUserVerifyingPlatformAuthenticatorAvailable() -> (bool result) Async
+
+    SetMockWebAuthenticationConfiguration(struct WebCore::MockWebAuthenticationConfiguration configuration);
 }
 
 #endif // ENABLE(WEB_AUTHN)

Modified: trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.cpp (269167 => 269168)


--- trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.cpp	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.cpp	2020-10-29 21:10:09 UTC (rev 269168)
@@ -29,6 +29,7 @@
 #if ENABLE(WEB_AUTHN)
 
 #include "Logging.h"
+#include "MockAuthenticatorManager.h"
 #include "WebAuthnConnectionToWebProcess.h"
 #include "WebAuthnProcessCreationParameters.h"
 #include <wtf/text/AtomString.h>
@@ -38,6 +39,7 @@
 
 
 WebAuthnProcess::WebAuthnProcess(AuxiliaryProcessInitializationParameters&& parameters)
+    : m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
 {
     initialize(WTFMove(parameters));
 }
@@ -123,6 +125,15 @@
     return m_webProcessConnections.get(identifier);
 }
 
+void WebAuthnProcess::setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&& configuration)
+{
+    if (!m_authenticatorManager->isMock()) {
+        m_authenticatorManager = makeUniqueRef<MockAuthenticatorManager>(WTFMove(configuration));
+        return;
+    }
+    static_cast<MockAuthenticatorManager*>(&m_authenticatorManager)->setTestConfiguration(WTFMove(configuration));
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(WEB_AUTHN)

Modified: trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.h (269167 => 269168)


--- trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.h	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.h	2020-10-29 21:10:09 UTC (rev 269168)
@@ -31,10 +31,16 @@
 #include "WebAuthnProcessMessages.h"
 #include <wtf/Function.h>
 #include <wtf/MemoryPressureHandler.h>
+#include <wtf/UniqueRef.h>
 #include <wtf/WeakPtr.h>
 
+namespace WebCore {
+struct MockWebAuthenticationConfiguration;
+}
+
 namespace WebKit {
 
+class AuthenticatorManager;
 class WebAuthnConnectionToWebProcess;
 struct WebAuthnProcessCreationParameters;
 
@@ -55,6 +61,9 @@
 
     WebAuthnConnectionToWebProcess* webProcessConnection(WebCore::ProcessIdentifier) const;
 
+    AuthenticatorManager& authenticatorManager() { return m_authenticatorManager.get(); }
+    void setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&&);
+
 private:
     void lowMemoryHandler(Critical);
 
@@ -77,6 +86,8 @@
 
     // Connections to WebProcesses.
     HashMap<WebCore::ProcessIdentifier, Ref<WebAuthnConnectionToWebProcess>> m_webProcessConnections;
+
+    UniqueRef<AuthenticatorManager> m_authenticatorManager;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in (269167 => 269168)


--- trunk/Source/WebKit/WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in	2020-10-29 21:10:09 UTC (rev 269168)
@@ -380,9 +380,6 @@
     (ipc-posix-name-regex #"^CFPBS:")) ; <rdar://problem/13757475>
 (allow system-fsctl (fsctl-command (_IO "h" 47)))
 
-;; Graphics
-(system-graphics)
-
 ;; Networking
 (allow network-outbound
        ;; Local mDNSResponder for DNS, arbitrary outbound TCP
@@ -438,3 +435,12 @@
 
 ;; Data Detectors
 (allow file-read* (subpath "/private/var/db/datadetectors/sys"))
+
+;; Allow accesses to HID
+(allow iokit-open
+    (iokit-user-client-class "IOHIDLibUserClient"))
+
+;; Allow accesses to LocalAuthentication and RemoteService
+(allow mach-lookup
+    (global-name "com.apple.CoreAuthentication.agent.libxpc")
+    (global-name "com.apple.remoted"))

Modified: trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp (269167 => 269168)


--- trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp	2020-10-29 21:10:09 UTC (rev 269168)
@@ -30,6 +30,8 @@
 
 #include "FrameInfoData.h"
 #include "WebAuthenticatorCoordinatorProxyMessages.h"
+#include "WebAuthnConnectionToWebProcess.h"
+#include "WebAuthnProcessConnection.h"
 #include "WebFrame.h"
 #include "WebPage.h"
 #include <_javascript_Core/ConsoleTypes.h>
@@ -57,7 +59,12 @@
     if (!processingUserGesture)
         m_webPage.addConsoleMessage(webFrame->frameID(), MessageSource::Other, MessageLevel::Warning, "User gesture is not detected. To use the platform authenticator, call 'navigator.credentials.create' within user activated events."_s);
 
-    m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::MakeCredential(webFrame->frameID(), webFrame->info(), hash, options, processingUserGesture), WTFMove(handler));
+    if (!RuntimeEnabledFeatures::sharedFeatures().webAuthenticationModernEnabled()) {
+        m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::MakeCredential(webFrame->frameID(), webFrame->info(), hash, options, processingUserGesture), WTFMove(handler));
+        return;
+    }
+
+    WebProcess::singleton().ensureWebAuthnProcessConnection().connection().sendWithAsyncReply(Messages::WebAuthnConnectionToWebProcess::MakeCredential(hash, options, processingUserGesture), WTFMove(handler));
 }
 
 void WebAuthenticatorCoordinator::getAssertion(const Frame& frame, const SecurityOrigin&, const Vector<uint8_t>& hash, const PublicKeyCredentialRequestOptions& options, RequestCompletionHandler&& handler)
@@ -70,12 +77,22 @@
     if (!processingUserGesture)
         m_webPage.addConsoleMessage(webFrame->frameID(), MessageSource::Other, MessageLevel::Warning, "User gesture is not detected. To use the platform authenticator, call 'navigator.credentials.get' within user activated events."_s);
 
-    m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::GetAssertion(webFrame->frameID(), webFrame->info(), hash, options, processingUserGesture), WTFMove(handler));
+    if (!RuntimeEnabledFeatures::sharedFeatures().webAuthenticationModernEnabled()) {
+        m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::GetAssertion(webFrame->frameID(), webFrame->info(), hash, options, processingUserGesture), WTFMove(handler));
+        return;
+    }
+
+    WebProcess::singleton().ensureWebAuthnProcessConnection().connection().sendWithAsyncReply(Messages::WebAuthnConnectionToWebProcess::GetAssertion(hash, options, processingUserGesture), WTFMove(handler));
 }
 
 void WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&& handler)
 {
-    m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::IsUserVerifyingPlatformAuthenticatorAvailable(), WTFMove(handler));
+    if (!RuntimeEnabledFeatures::sharedFeatures().webAuthenticationModernEnabled()) {
+        m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::IsUserVerifyingPlatformAuthenticatorAvailable(), WTFMove(handler));
+        return;
+    }
+
+    WebProcess::singleton().ensureWebAuthnProcessConnection().connection().sendWithAsyncReply(Messages::WebAuthnConnectionToWebProcess::IsUserVerifyingPlatformAuthenticatorAvailable(), WTFMove(handler));
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (269167 => 269168)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2020-10-29 21:07:29 UTC (rev 269167)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2020-10-29 21:10:09 UTC (rev 269168)
@@ -80,6 +80,7 @@
 #include <WebCore/Icon.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/RegistrableDomain.h>
+#include <WebCore/RuntimeEnabledFeatures.h>
 #include <WebCore/ScriptController.h>
 #include <WebCore/SecurityOrigin.h>
 #include <WebCore/SecurityOriginData.h>
@@ -1383,7 +1384,12 @@
 #if ENABLE(WEB_AUTHN)
 void WebChromeClient::setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration& configuration)
 {
-    m_page.send(Messages::WebPageProxy::SetMockWebAuthenticationConfiguration(configuration));
+    if (!RuntimeEnabledFeatures::sharedFeatures().webAuthenticationModernEnabled()) {
+        m_page.send(Messages::WebPageProxy::SetMockWebAuthenticationConfiguration(configuration));
+        return;
+    }
+
+    WebProcess::singleton().ensureWebAuthnProcessConnection().connection().send(Messages::WebAuthnConnectionToWebProcess::SetMockWebAuthenticationConfiguration(configuration), { });
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to