Skip to content

Commit

Permalink
[WebAuthn] Remove the WebAuthn user-gesture requirement
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264444
rdar://112094139

Reviewed by Pascoe.

Removes code that requires the user gesture input for web authentication interactions

* Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp:
(WebCore::AuthenticatorCoordinator::create):
(WebCore::AuthenticatorCoordinator::discoverFromExternalSource):
(WebCore::AuthenticatorCoordinator::resetUserGestureRequirement): Deleted.
* Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.h:
* Source/WebCore/Modules/webauthn/AuthenticatorCoordinatorClient.h:
(WebCore::AuthenticatorCoordinatorClient::resetUserGestureRequirement): Deleted.
* Source/WebKit/UIProcess/API/APIUIClient.h:
(API::UIClient::requestWebAuthenticationNoGesture): Deleted.
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* Source/WebKit/UIProcess/API/C/WKPageUIClient.h:
* Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel makeCredentialWithChallenge:origin:options:completionHandler:]):
(-[_WKWebAuthenticationPanel makeCredentialWithMediationRequirement:clientDataHash:options:completionHandler:]):
(-[_WKWebAuthenticationPanel getAssertionWithChallenge:origin:options:completionHandler:]):
(-[_WKWebAuthenticationPanel getAssertionWithMediationRequirement:clientDataHash:options:completionHandler:]):
* Source/WebKit/UIProcess/Cocoa/UIDelegate.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::requestWebAuthenticationNoGesture): Deleted.
* Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::filterTransports const):
* Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
* Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
(WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
(WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
(WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
* Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
* Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
* Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
(WebKit::WebAuthenticatorCoordinator::makeCredential):
(WebKit::WebAuthenticatorCoordinator::getAssertion):
(WebKit::WebAuthenticatorCoordinator::processingUserGesture): Deleted.
* Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadRequest):
(WebKit::WebPage::reload):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(-[TestWebAuthenticationPanelUIDelegate _webView:requestWebAuthenticationNoGestureForOrigin:completionHandler:]): Deleted.
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions):

Canonical link: https://commits.webkit.org/271656@main
  • Loading branch information
abigailfox committed Dec 7, 2023
1 parent 65d8c44 commit 4a1b667
Show file tree
Hide file tree
Showing 38 changed files with 27 additions and 237 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS CTAP HID with init sub stage data not sent error in a mock hid authenticator.
PASS CTAP HID with init sub stage empty report error in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS CTAP NFC with empty apdu response in a mock nfc authenticator.
PASS CTAP NFC with wrong data error in a mock nfc authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with malicious payload in a mock hid authenticator.
PASS PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with timeout in a mock hid authenticator.
PASS PublicKeyCredential's [[create]] with malicious payload in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with unsupported public key credential parameters in a mock local authenticator.
PASS PublicKeyCredential's [[create]] with matched exclude credentials in a mock local authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with unsupported public key credential parameters in a mock local authenticator.
PASS PublicKeyCredential's [[create]] with matched exclude credentials in a mock local authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with timeout in a mock nfc authenticator.
PASS PublicKeyCredential's [[create]] with no tags in a mock nfc authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with malformed APDU payload in a mock hid authenticator.
PASS PublicKeyCredential's [[create]] with malformed U2F register response in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with malformed APDU payload in a mock hid authenticator.
PASS PublicKeyCredential's [[create]] with malformed U2F register response in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[create]] with minimum options in a mock hid authenticator.
PASS PublicKeyCredential's [[create]] with user handle of length=1 in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[get]] with malicious payload in a mock hid authenticator.
PASS PublicKeyCredential's [[get]] with invalid credential in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[get]] with timeout in a mock hid authenticator.
PASS PublicKeyCredential's [[get]] with malicious payload in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[get]] with no matched credentials in a mock local authenticator.
PASS PublicKeyCredential's [[get]] with no matched credentials in a mock local authenticator. 2nd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[get]] with no matched credentials in a mock local authenticator.
PASS PublicKeyCredential's [[get]] with no matched credentials in a mock local authenticator. 2nd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[get]] with malformed sign response in a mock hid authenticator.
PASS PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[get]] with malformed sign response in a mock hid authenticator.
PASS PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.

PASS PublicKeyCredential's [[get]] with minimum options in a mock hid authenticator.
PASS PublicKeyCredential's [[get]] with matched allow credentials in a mock hid authenticator.
Expand Down
9 changes: 0 additions & 9 deletions Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ void AuthenticatorCoordinator::create(const Document& document, CredentialCreati
}

if (auto response = AuthenticatorResponse::tryCreate(WTFMove(data), attachment)) {
if (weakThis)
weakThis->resetUserGestureRequirement();
response->setClientDataJSON(WTFMove(clientDataJson));
promise.resolve(PublicKeyCredential::create(response.releaseNonNull()).ptr());
return;
Expand Down Expand Up @@ -268,8 +266,6 @@ void AuthenticatorCoordinator::discoverFromExternalSource(const Document& docume
}

if (auto response = AuthenticatorResponse::tryCreate(WTFMove(data), attachment)) {
if (weakThis)
weakThis->resetUserGestureRequirement();
response->setClientDataJSON(WTFMove(clientDataJson));
promise.resolve(PublicKeyCredential::create(response.releaseNonNull()).ptr());
return;
Expand Down Expand Up @@ -330,11 +326,6 @@ void AuthenticatorCoordinator::getClientCapabilities(const Document& document, D
m_client->getClientCapabilities(document.securityOrigin(), WTFMove(completionHandler));
}

void AuthenticatorCoordinator::resetUserGestureRequirement()
{
m_client->resetUserGestureRequirement();
}

} // namespace WebCore

#endif // ENABLE(WEB_AUTHN)
2 changes: 0 additions & 2 deletions Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ class AuthenticatorCoordinator final : public CanMakeWeakPtr<AuthenticatorCoordi

void getClientCapabilities(const Document&, DOMPromiseDeferred<IDLInterface<PublicKeyCredentialClientCapabilities>>&&) const;

WEBCORE_EXPORT void resetUserGestureRequirement();

private:
AuthenticatorCoordinator() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class AuthenticatorCoordinatorClient : public CanMakeWeakPtr<AuthenticatorCoordi
virtual void isUserVerifyingPlatformAuthenticatorAvailable(const SecurityOrigin&, QueryCompletionHandler&&) = 0;
virtual void getClientCapabilities(const SecurityOrigin&, CapabilitiesCompletionHandler&&) = 0;
virtual void cancel() = 0;

virtual void resetUserGestureRequirement() { }
};

} // namespace WebCore
Expand Down
5 changes: 0 additions & 5 deletions Source/WebKit/UIProcess/API/APIUIClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,6 @@ class UIClient {
#if ENABLE(WEB_AUTHN)
virtual void runWebAuthenticationPanel(WebKit::WebPageProxy&, WebAuthenticationPanel&, WebKit::WebFrameProxy&, WebKit::FrameInfoData&&, CompletionHandler<void(WebKit::WebAuthenticationPanelResult)>&& completionHandler) { completionHandler(WebKit::WebAuthenticationPanelResult::Unavailable); }

virtual void requestWebAuthenticationNoGesture(SecurityOrigin& origin, CompletionHandler<void(bool)>&& completionHandler)
{
completionHandler(true);
}

virtual void requestWebAuthenticationConditonalMediationRegistration(WTF::String&&, CompletionHandler<void(bool)>&& completionHandler)
{
completionHandler(false);
Expand Down
10 changes: 0 additions & 10 deletions Source/WebKit/UIProcess/API/C/WKPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2171,16 +2171,6 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient
panel.setClient(WTF::makeUniqueRef<PanelClient>());
completionHandler(WebKit::WebAuthenticationPanelResult::Presented);
}

void requestWebAuthenticationNoGesture(API::SecurityOrigin&, CompletionHandler<void(bool)>&& completionHandler) final
{
if (!m_client.requestWebAuthenticationNoGesture) {
completionHandler(true);
return;
}

completionHandler(true);
}
#endif

void decidePolicyForMediaKeySystemPermissionRequest(WebPageProxy& page, API::SecurityOrigin& origin, const String& keySystem, CompletionHandler<void(bool)>&& completionHandler) final
Expand Down
Loading

0 comments on commit 4a1b667

Please sign in to comment.