Title: [290893] trunk/Source/WebKit
Revision
290893
Author
j_pas...@apple.com
Date
2022-03-07 09:37:04 -0800 (Mon, 07 Mar 2022)

Log Message

[WebAuthn] Provide global frame identifier to ASCAgent SPI
https://bugs.webkit.org/show_bug.cgi?id=237454
rdar://problem/89782147

Reviewed by Brent Fulgham.

For purposes related to conditional mediation, the ASCAgent SPI
need to know what frame requested the assertion. This patch starts
passing that along.

* Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h:
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::cancelRequest):
(WebKit::AuthenticatorManager::runPanel):
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h:
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm:
* UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
(WebKit::configurationAssertionRequestContext):
(WebKit::WebAuthenticatorCoordinatorProxy::contextForRequest):
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (290892 => 290893)


--- trunk/Source/WebKit/ChangeLog	2022-03-07 17:29:22 UTC (rev 290892)
+++ trunk/Source/WebKit/ChangeLog	2022-03-07 17:37:04 UTC (rev 290893)
@@ -1,3 +1,26 @@
+2022-03-07  J Pascoe  <j_pas...@apple.com>
+
+        [WebAuthn] Provide global frame identifier to ASCAgent SPI
+        https://bugs.webkit.org/show_bug.cgi?id=237454
+        rdar://problem/89782147
+
+        Reviewed by Brent Fulgham.
+
+        For purposes related to conditional mediation, the ASCAgent SPI
+        need to know what frame requested the assertion. This patch starts
+        passing that along.
+
+        * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h:
+        * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+        (WebKit::AuthenticatorManager::cancelRequest):
+        (WebKit::AuthenticatorManager::runPanel):
+        * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h:
+        * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm:
+        * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
+        (WebKit::configurationAssertionRequestContext):
+        (WebKit::WebAuthenticatorCoordinatorProxy::contextForRequest):
+        * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
+
 2022-03-07  Peng Liu  <peng.l...@apple.com>
 
         Small cleanups of media code

Modified: trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h (290892 => 290893)


--- trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h	2022-03-07 17:29:22 UTC (rev 290892)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h	2022-03-07 17:37:04 UTC (rev 290893)
@@ -234,6 +234,13 @@
     ASCredentialRequestStyleAutoFill,
 };
 
+@class ASCGlobalFrameIdentifier;
+
+@interface ASCGlobalFrameIdentifier : NSObject <NSSecureCoding>
+@property (nonatomic, copy) NSNumber *webPageID;
+@property (nonatomic, copy) NSNumber *webFrameID;
+@end
+
 @interface ASCCredentialRequestContext : NSObject <NSSecureCoding>
 
 - (instancetype)init NS_UNAVAILABLE;
@@ -252,6 +259,7 @@
 
 @property (nonatomic) ASCredentialRequestStyle requestStyle;
 
+@property (nonatomic, nullable, copy) ASCGlobalFrameIdentifier *globalFrameID;
 @end
 
 @protocol ASCCredentialProtocol <NSObject, NSSecureCoding>

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (290892 => 290893)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2022-03-07 17:29:22 UTC (rev 290892)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2022-03-07 17:37:04 UTC (rev 290893)
@@ -198,7 +198,7 @@
 {
     if (!m_pendingCompletionHandler)
         return;
-    if (auto pendingFrameID = m_pendingRequestData.frameID) {
+    if (auto pendingFrameID = m_pendingRequestData.globalFrameID) {
         if (pendingFrameID->pageID != pageID)
             return;
         if (frameID && frameID != pendingFrameID->frameID)
@@ -447,8 +447,8 @@
     auto* page = m_pendingRequestData.page.get();
     if (!page)
         return;
-    ASSERT(m_pendingRequestData.frameID && page->webPageID() == m_pendingRequestData.frameID->pageID);
-    auto* frame = page->process().webFrame(m_pendingRequestData.frameID->frameID);
+    ASSERT(m_pendingRequestData.globalFrameID && page->webPageID() == m_pendingRequestData.globalFrameID->pageID);
+    auto* frame = page->process().webFrame(m_pendingRequestData.globalFrameID->frameID);
     if (!frame)
         return;
 

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h (290892 => 290893)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h	2022-03-07 17:29:22 UTC (rev 290892)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h	2022-03-07 17:37:04 UTC (rev 290893)
@@ -40,6 +40,7 @@
 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCAuthorizationPresenter);
 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCAuthorizationRemotePresenter);
 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCCredentialRequestContext);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCGlobalFrameIdentifier);
 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCWebAuthenticationExtensionsClientInputs);
 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCPlatformPublicKeyCredentialAssertion);
 SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCPlatformPublicKeyCredentialLoginChoice);

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm (290892 => 290893)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm	2022-03-07 17:29:22 UTC (rev 290892)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm	2022-03-07 17:37:04 UTC (rev 290893)
@@ -40,6 +40,7 @@
 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCAuthorizationPresenter);
 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCAuthorizationRemotePresenter);
 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCCredentialRequestContext);
+SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL(WebKit, AuthenticationServicesCore, ASCGlobalFrameIdentifier);
 SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL(WebKit, AuthenticationServicesCore, ASCWebAuthenticationExtensionsClientInputs);
 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCPlatformPublicKeyCredentialAssertion);
 SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCPlatformPublicKeyCredentialLoginChoice);

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm (290892 => 290893)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm	2022-03-07 17:29:22 UTC (rev 290892)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm	2022-03-07 17:37:04 UTC (rev 290893)
@@ -236,7 +236,7 @@
     return requestContext;
 }
 
-static RetainPtr<ASCCredentialRequestContext> configurationAssertionRequestContext(const PublicKeyCredentialRequestOptions& options, Vector<uint8_t> hash, std::optional<WebCore::MediationRequirement> mediation)
+static RetainPtr<ASCCredentialRequestContext> configurationAssertionRequestContext(const PublicKeyCredentialRequestOptions& options, Vector<uint8_t> hash, std::optional<WebCore::MediationRequirement> mediation, std::optional<WebCore::GlobalFrameIdentifier> globalFrameID)
 {
     ASCCredentialRequestTypes requestTypes = ASCCredentialRequestTypePlatformPublicKeyAssertion | ASCCredentialRequestTypeSecurityKeyPublicKeyAssertion;
 
@@ -262,6 +262,12 @@
     [requestContext setRelyingPartyIdentifier:options.rpId];
     if (mediation == MediationRequirement::Conditional && [requestContext respondsToSelector:@selector(setRequestStyle:)])
         requestContext.get().requestStyle = ASCredentialRequestStyleAutoFill;
+    if (globalFrameID && [requestContext respondsToSelector:@selector(setGlobalFrameID:)]) {
+        auto ascGlobalFrameID = adoptNS([allocASCGlobalFrameIdentifierInstance() init]);
+        ascGlobalFrameID.get().webFrameID = [NSNumber numberWithUnsignedLong:globalFrameID->frameID.toUInt64()];
+        ascGlobalFrameID.get().webPageID = [NSNumber numberWithUnsignedLong:globalFrameID->pageID.toUInt64()];
+        requestContext.get().globalFrameID = ascGlobalFrameID.get();
+    }
 
     if (requestTypes & ASCCredentialRequestTypePlatformPublicKeyAssertion) {
         auto assertionOptions = adoptNS(allocASCPublicKeyCredentialAssertionOptionsInstance());
@@ -302,7 +308,7 @@
     WTF::switchOn(requestData.options, [&](const PublicKeyCredentialCreationOptions& options) {
         result = configureRegistrationRequestContext(options, requestData.hash);
     }, [&](const PublicKeyCredentialRequestOptions& options) {
-        result = configurationAssertionRequestContext(options, requestData.hash, requestData.mediation);
+        result = configurationAssertionRequestContext(options, requestData.hash, requestData.mediation, requestData.globalFrameID);
     });
     return result;
 }

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h (290892 => 290893)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h	2022-03-07 17:29:22 UTC (rev 290892)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h	2022-03-07 17:37:04 UTC (rev 290893)
@@ -51,7 +51,7 @@
     WeakPtr<WebPageProxy> page;
     WebAuthenticationPanelResult panelResult { WebAuthenticationPanelResult::Unavailable };
     RefPtr<API::WebAuthenticationPanel> panel;
-    std::optional<WebCore::GlobalFrameIdentifier> frameID;
+    std::optional<WebCore::GlobalFrameIdentifier> globalFrameID;
     WebKit::FrameInfoData frameInfo;
 
     bool processingUserGesture;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to