Modified: trunk/Source/WebKit/ChangeLog (291176 => 291177)
--- trunk/Source/WebKit/ChangeLog 2022-03-11 17:49:14 UTC (rev 291176)
+++ trunk/Source/WebKit/ChangeLog 2022-03-11 18:25:39 UTC (rev 291177)
@@ -1,5 +1,26 @@
2022-03-11 J Pascoe <[email protected]>
+ [WebAuthn] Cancel running operations in ASA on navigation
+ https://bugs.webkit.org/show_bug.cgi?id=237452
+ rdar://problem/89781990
+
+ Reviewed by Brent Fulgham.
+
+ Pre-ASA WebAuthn calls cancel requests on navigation via calling authenticatorManager.cancelRequest
+ in WebPageProxy. In WebAuthn calls that go through ASA, the authenticatorManager lives in the ASA
+ process, so calls won't be cancelled on navigation.
+
+ This patch attempts to cancel ongoing operations whenever a WebAuthenticatorCoordinatorProxy that
+ uses ASA is destroyed, effectively cancelling requests on reload or navigation.
+
+ * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h:
+ * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
+ (WebKit::WebAuthenticatorCoordinatorProxy::~WebAuthenticatorCoordinatorProxy):
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
+
+2022-03-11 J Pascoe <[email protected]>
+
[WebAuthn] Support authenticatorSelection.residentKey ResidentKeyRequirement
https://bugs.webkit.org/show_bug.cgi?id=237567
rdar://89788378
Modified: trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h (291176 => 291177)
--- trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h 2022-03-11 17:49:14 UTC (rev 291176)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h 2022-03-11 18:25:39 UTC (rev 291177)
@@ -341,6 +341,8 @@
- (void)performAutoFillAuthorizationRequestsForContext:(ASCCredentialRequestContext *)context withCompletionHandler:(void (^)(id <ASCCredentialProtocol> _Nullable credential, NSError * _Nullable error))completionHandler;
#endif
+- (void)cancelCurrentRequest;
+
@end
@interface ASCAgentProxy : NSObject <ASCAgentProtocol>
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm (291176 => 291177)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm 2022-03-11 17:49:14 UTC (rev 291176)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm 2022-03-11 18:25:39 UTC (rev 291177)
@@ -384,11 +384,11 @@
void WebAuthenticatorCoordinatorProxy::performRequest(RetainPtr<ASCCredentialRequestContext> requestContext, RequestCompletionHandler&& handler)
{
- auto proxy = adoptNS([allocASCAgentProxyInstance() init]);
+ m_proxy = adoptNS([allocASCAgentProxyInstance() init]);
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
if ([requestContext respondsToSelector:@selector(requestStyle)] && requestContext.get().requestStyle == ASCredentialRequestStyleAutoFill) {
- [proxy performAutoFillAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([weakThis = WeakPtr { *this }, proxy = WTFMove(proxy), handler = WTFMove(handler)](id <ASCCredentialProtocol> credential, NSError *error) mutable {
- ensureOnMainRunLoop([weakThis, handler = WTFMove(handler), proxy = WTFMove(proxy), credential = retainPtr(credential), error = retainPtr(error)] () mutable {
+ [m_proxy performAutoFillAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([weakThis = WeakPtr { *this }, handler = WTFMove(handler)](id<ASCCredentialProtocol> credential, NSError *error) mutable {
+ ensureOnMainRunLoop([weakThis, handler = WTFMove(handler), credential = retainPtr(credential), error = retainPtr(error)] () mutable {
if (!weakThis) {
handler({ }, (AuthenticatorAttachment)0, ExceptionData { NotAllowedError, "Operation failed." });
return;
@@ -400,12 +400,12 @@
}
#endif // PLATFORM(MAC) || PLATFORM(MACCATALYST)
#if PLATFORM(IOS)
- [proxy performAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([handler = WTFMove(handler), proxy = WTFMove(proxy)](id <ASCCredentialProtocol> credential, NSError *error) mutable {
+ [m_proxy performAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([handler = WTFMove(handler)](id<ASCCredentialProtocol> credential, NSError *error) mutable {
callOnMainRunLoop([handler = WTFMove(handler), proxy = WTFMove(proxy), credential = retainPtr(credential), error = retainPtr(error)] () mutable {
#elif PLATFORM(MAC)
RetainPtr<NSWindow> window = m_webPageProxy.platformWindow();
- [proxy performAuthorizationRequestsForContext:requestContext.get() withClearanceHandler:makeBlockPtr([weakThis = WeakPtr { *this }, handler = WTFMove(handler), window = WTFMove(window), proxy = WTFMove(proxy)](NSXPCListenerEndpoint *daemonEndpoint, NSError *error) mutable {
- callOnMainRunLoop([weakThis, handler = WTFMove(handler), window = WTFMove(window), proxy = WTFMove(proxy), daemonEndpoint = retainPtr(daemonEndpoint), error = retainPtr(error)] () mutable {
+ [m_proxy performAuthorizationRequestsForContext:requestContext.get() withClearanceHandler:makeBlockPtr([weakThis = WeakPtr { *this }, handler = WTFMove(handler), window = WTFMove(window)](NSXPCListenerEndpoint *daemonEndpoint, NSError *error) mutable {
+ callOnMainRunLoop([weakThis, handler = WTFMove(handler), window = WTFMove(window), daemonEndpoint = retainPtr(daemonEndpoint), error = retainPtr(error)] () mutable {
if (!weakThis || !daemonEndpoint) {
LOG_ERROR("Could not connect to authorization daemon: %@\n", error.get());
handler({ }, (AuthenticatorAttachment)0, ExceptionData { NotAllowedError, "Operation failed." });
@@ -413,7 +413,7 @@
}
weakThis->m_presenter = adoptNS([allocASCAuthorizationRemotePresenterInstance() init]);
- [weakThis->m_presenter presentWithWindow:window.get() daemonEndpoint:daemonEndpoint.get() completionHandler:makeBlockPtr([handler = WTFMove(handler), proxy = WTFMove(proxy)](id <ASCCredentialProtocol> credentialNotRetain, NSError *errorNotRetain) mutable {
+ [weakThis->m_presenter presentWithWindow:window.get() daemonEndpoint:daemonEndpoint.get() completionHandler:makeBlockPtr([handler = WTFMove(handler)](id<ASCCredentialProtocol> credentialNotRetain, NSError *errorNotRetain) mutable {
auto credential = retainPtr(credentialNotRetain);
auto error = retainPtr(errorNotRetain);
#endif
@@ -440,6 +440,12 @@
handler(LocalService::isAvailable());
}
+void WebAuthenticatorCoordinatorProxy::cancel()
+{
+ if (m_proxy)
+ [m_proxy cancelCurrentRequest];
+}
+
} // namespace WebKit
#endif // HAVE(UNIFIED_ASC_AUTH_UI)
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp (291176 => 291177)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp 2022-03-11 17:49:14 UTC (rev 291176)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp 2022-03-11 18:25:39 UTC (rev 291177)
@@ -53,6 +53,9 @@
WebAuthenticatorCoordinatorProxy::~WebAuthenticatorCoordinatorProxy()
{
+#if HAVE(UNIFIED_ASC_AUTH_UI)
+ cancel();
+#endif // HAVE(UNIFIED_ASC_AUTH_UI)
m_webPageProxy.process().removeMessageReceiver(Messages::WebAuthenticatorCoordinatorProxy::messageReceiverName(), m_webPageProxy.webPageID());
}
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h (291176 => 291177)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h 2022-03-11 17:49:14 UTC (rev 291176)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h 2022-03-11 18:25:39 UTC (rev 291177)
@@ -45,6 +45,7 @@
#if HAVE(UNIFIED_ASC_AUTH_UI)
OBJC_CLASS ASCAuthorizationRemotePresenter;
OBJC_CLASS ASCCredentialRequestContext;
+OBJC_CLASS ASCAgentProxy;
#endif
namespace WebKit {
@@ -80,9 +81,11 @@
WebPageProxy& m_webPageProxy;
#if HAVE(UNIFIED_ASC_AUTH_UI)
+ void cancel();
RetainPtr<ASCCredentialRequestContext> contextForRequest(WebAuthenticationRequestData&&);
void performRequest(RetainPtr<ASCCredentialRequestContext>, RequestCompletionHandler&&);
RetainPtr<ASCAuthorizationRemotePresenter> m_presenter;
+ RetainPtr<ASCAgentProxy> m_proxy;
#endif // HAVE(UNIFIED_ASC_AUTH_UI)
};