Title: [290755] trunk/Source/WebKit
Revision
290755
Author
[email protected]
Date
2022-03-02 14:07:29 -0800 (Wed, 02 Mar 2022)

Log Message

[WebAuthn] Completion handler is not called when WebAuthn invoked without proper entitlements
https://bugs.webkit.org/show_bug.cgi?id=237380
<rdar://problem/89700242>

Reviewed by Chris Dumez.

WebAuthn is not permitted outside of Web Browser applications. When an application that lacks
the full web browser entitlement attempts to invoke WebAuthn flows, we do an early return. However,
the completion handler for this flow is bypassed, preventing applications from being informed of
this problem.

* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
(WebKit::WebAuthenticatorCoordinator::makeCredential):
(WebKit::WebAuthenticatorCoordinator::getAssertion):
(WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (290754 => 290755)


--- trunk/Source/WebKit/ChangeLog	2022-03-02 21:25:49 UTC (rev 290754)
+++ trunk/Source/WebKit/ChangeLog	2022-03-02 22:07:29 UTC (rev 290755)
@@ -1,3 +1,21 @@
+2022-03-02  Brent Fulgham  <[email protected]>
+
+        [WebAuthn] Completion handler is not called when WebAuthn invoked without proper entitlements
+        https://bugs.webkit.org/show_bug.cgi?id=237380
+        <rdar://problem/89700242>
+
+        Reviewed by Chris Dumez.
+
+        WebAuthn is not permitted outside of Web Browser applications. When an application that lacks
+        the full web browser entitlement attempts to invoke WebAuthn flows, we do an early return. However,
+        the completion handler for this flow is bypassed, preventing applications from being informed of
+        this problem.
+
+        * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
+        (WebKit::WebAuthenticatorCoordinator::makeCredential):
+        (WebKit::WebAuthenticatorCoordinator::getAssertion):
+        (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
+
 2022-03-02  Per Arne Vollan  <[email protected]>
 
         [iOS] Seatbelt sandbox profile entitlement is deprecated

Modified: trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp (290754 => 290755)


--- trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp	2022-03-02 21:25:49 UTC (rev 290754)
+++ trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp	2022-03-02 22:07:29 UTC (rev 290755)
@@ -47,6 +47,12 @@
 #include <WebCore/SecurityOrigin.h>
 #include <WebCore/UserGestureIndicator.h>
 
+#undef WEBAUTHN_RELEASE_LOG
+#define PAGE_ID (m_webPage.identifier().toUInt64())
+#define FRAME_ID (webFrame->frameID().toUInt64())
+#define WEBAUTHN_RELEASE_LOG_ERROR(fmt, ...) RELEASE_LOG_ERROR(WebAuthn, "%p - [webPageID=%" PRIu64 ", webFrameID=%" PRIu64 "] WebAuthenticatorCoordinator::" fmt, this, PAGE_ID, FRAME_ID, ##__VA_ARGS__)
+#define WEBAUTHN_RELEASE_LOG_ERROR_NO_FRAME(fmt, ...) RELEASE_LOG_ERROR(WebAuthn, "%p - [webPageID=%" PRIu64 "] WebAuthenticatorCoordinator::" fmt, this, PAGE_ID, ##__VA_ARGS__)
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -79,8 +85,11 @@
         return;
     }
 
-    if (!isWebBrowser())
+    if (!isWebBrowser()) {
+        WEBAUTHN_RELEASE_LOG_ERROR("makeCredential: The 'navigator.credentials.create' API is only permitted in applications with the 'com.apple.developer.web-browser' entitlement.");
+        handler({ }, static_cast<AuthenticatorAttachment>(0), ExceptionData { NotAllowedError, "The 'navigator.credentials.create' API is only permitted in applications with the 'com.apple.developer.web-browser' entitlement." });
         return;
+    }
     WebProcess::singleton().ensureWebAuthnProcessConnection().connection().sendWithAsyncReply(Messages::WebAuthnConnectionToWebProcess::MakeCredential(hash, options, isProcessingUserGesture), WTFMove(handler));
 }
 
@@ -101,8 +110,11 @@
         return;
     }
 
-    if (!isWebBrowser())
+    if (!isWebBrowser()) {
+        WEBAUTHN_RELEASE_LOG_ERROR("getAssertion: The 'navigator.credentials.get' API is only permitted in applications with the 'com.apple.developer.web-browser' entitlement.");
+        handler({ }, static_cast<AuthenticatorAttachment>(0), ExceptionData { NotAllowedError, "The 'navigator.credentials.get' API is only permitted in applications with the 'com.apple.developer.web-browser' entitlement." });
         return;
+    }
     WebProcess::singleton().ensureWebAuthnProcessConnection().connection().sendWithAsyncReply(Messages::WebAuthnConnectionToWebProcess::GetAssertion(hash, options, isProcessingUserGesture), WTFMove(handler));
 }
 
@@ -123,8 +135,11 @@
         return;
     }
 
-    if (!isWebBrowser())
+    if (!isWebBrowser()) {
+        WEBAUTHN_RELEASE_LOG_ERROR_NO_FRAME("isUserVerifyingPlatformAuthenticatorAvailable: WebAuthn is only permitted in applications with the 'com.apple.developer.web-browser' entitlement.");
+        handler(false);
         return;
+    }
     WebProcess::singleton().ensureWebAuthnProcessConnection().connection().sendWithAsyncReply(Messages::WebAuthnConnectionToWebProcess::IsUserVerifyingPlatformAuthenticatorAvailable(), WTFMove(handler));
 }
 
@@ -144,4 +159,9 @@
 
 } // namespace WebKit
 
+#undef WEBAUTHN_RELEASE_LOG_ERROR_NO_FRAME
+#undef WEBAUTHN_RELEASE_LOG_ERROR
+#undef FRAME_ID
+#undef PAGE_ID
+
 #endif // ENABLE(WEB_AUTHN)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to