haikuwebkit/Source/WebCore/testing/MockWebAuthenticationConfig...

115 lines
3.1 KiB
Plaintext
Raw Permalink Normal View History

[WebAuthn] Move the mock testing entrance to Internals https://bugs.webkit.org/show_bug.cgi?id=202560 <rdar://problem/55973793> Reviewed by Chris Dumez. Source/WebCore: This patch moves TestRunner.setWebAuthenticationMockConfiguration to Internals.setMockWebAuthenticationConfiguration and removes the old entrance. The purpose of this patch is to allow API tests to use the same mock infrastructure that is used by layout tests. No new tests, covered by updates on existing tests. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * WebCore.xcodeproj/project.pbxproj: * page/ChromeClient.h: (WebCore::ChromeClient::setMockWebAuthenticationConfiguration): * testing/Internals.cpp: (WebCore::Internals::setMockWebAuthenticationConfiguration): * testing/Internals.h: * testing/Internals.idl: * testing/MockWebAuthenticationConfiguration.h: Added. (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Added. Source/WebKit: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::createMock): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): (WebKit::MockHidConnection::shouldContinueFeedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockHidService.cpp: (WebKit::MockHidService::MockHidService): * UIProcess/WebAuthentication/Mock/MockHidService.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): * UIProcess/WebAuthentication/Mock/MockLocalService.h: * UIProcess/WebAuthentication/Mock/MockLocalService.mm: (WebKit::MockLocalService::MockLocalService): * UIProcess/WebAuthentication/Mock/MockNfcService.h: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (WebKit::MockNfcService::MockNfcService): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): * WebProcess/WebCoreSupport/WebChromeClient.h: Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * 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-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/resources/public-key-credential-ip-address.https.html: Canonical link: https://commits.webkit.org/216232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-09 23:03:06 +00:00
/*
* Copyright (C) 2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
[
Conditional=WEB_AUTHN,
] enum MockHidStage {
"info",
"request"
};
[
Conditional=WEB_AUTHN,
] enum MockHidSubStage {
"init",
"msg"
};
[
Conditional=WEB_AUTHN,
] enum MockHidError {
"success",
"data-not-sent",
"empty-report",
"wrong-channel-id",
"malicious-payload",
"unsupported-options",
"wrong-nonce"
};
[
Conditional=WEB_AUTHN,
] enum MockNfcError {
"success",
"no-tags",
"wrong-tag-type",
"no-connections",
"malicious-payload"
};
[WebAuthn] Cancel WebAuthn requests when users cancel LocalAuthentication prompts https://bugs.webkit.org/show_bug.cgi?id=209923 <rdar://problem/61223713> Reviewed by Brent Fulgham. Source/WebCore: Covered by new tests within existing test files. * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Adds a new parameter to reflect user cancellations on LocalAuthentication UI. Source/WebKit: This patch intents to streamline WebAuthn local authenticator UX a bit more. Here, we should treat user cancellation of the LocalAuthentication UI as if it were being done on the UI Client's WebAuthn UI. * UIProcess/WebAuthentication/Authenticator.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::cancelRequest): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification): (WebKit::LocalAuthenticator::validateUserVerification const): * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::verifyUser const): * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): (WebKit::MockLocalConnection::verifyUser const): (WebKit::MockLocalConnection::filterResponses const): * WebKit.xcodeproj/project.pbxproj: Tools: Modifies existing tests to accommodate changes in MockWebAuthenticationConfiguration.idl. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-la.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-duplicate-credential.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-error.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la.html: LayoutTests: Adds a new test for the change and modifies existing tests to accommodate changes in MockWebAuthenticationConfiguration.idl. * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html: * http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: * http/wpt/webauthn/public-key-credential-create-success-local.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-success-local.https.html: Canonical link: https://commits.webkit.org/223051@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-07 23:01:20 +00:00
[
Conditional=WEB_AUTHN,
] enum UserVerification {
"no",
"yes",
Allow using the platform authenticator on non-Touch ID Macs according to Internal requirements https://bugs.webkit.org/show_bug.cgi?id=224639 <rdar://74698346> Reviewed by Daniel Bates. Source/WebCore: Covered by new tests within existing test files. * testing/MockWebAuthenticationConfiguration.h: * testing/MockWebAuthenticationConfiguration.idl: Mock testing support. Source/WebKit: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification): Don't set the UserVerification bit if UserVerification is not done. * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::verifyUser): Only check UserPresence on non-Touch ID Macs. * UIProcess/WebAuthentication/Cocoa/LocalService.mm: (WebKit::LocalService::isAvailable): Make the platform authenticator available according to Internal requirements. * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::verifyUser): Mock testing support. * UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp: (WebKit::getUserVerificationRequirement): * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Add a helper for extracting the UserVerification input. LayoutTests: * http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-local.https.html: * http/wpt/webauthn/public-key-credential-get-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-local.https.html: Canonical link: https://commits.webkit.org/236663@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 23:52:30 +00:00
"cancel",
"presence"
[WebAuthn] Cancel WebAuthn requests when users cancel LocalAuthentication prompts https://bugs.webkit.org/show_bug.cgi?id=209923 <rdar://problem/61223713> Reviewed by Brent Fulgham. Source/WebCore: Covered by new tests within existing test files. * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Adds a new parameter to reflect user cancellations on LocalAuthentication UI. Source/WebKit: This patch intents to streamline WebAuthn local authenticator UX a bit more. Here, we should treat user cancellation of the LocalAuthentication UI as if it were being done on the UI Client's WebAuthn UI. * UIProcess/WebAuthentication/Authenticator.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::cancelRequest): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification): (WebKit::LocalAuthenticator::validateUserVerification const): * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::verifyUser const): * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): (WebKit::MockLocalConnection::verifyUser const): (WebKit::MockLocalConnection::filterResponses const): * WebKit.xcodeproj/project.pbxproj: Tools: Modifies existing tests to accommodate changes in MockWebAuthenticationConfiguration.idl. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-la.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-duplicate-credential.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-error.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la.html: LayoutTests: Adds a new test for the change and modifies existing tests to accommodate changes in MockWebAuthenticationConfiguration.idl. * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html: * http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: * http/wpt/webauthn/public-key-credential-create-success-local.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-success-local.https.html: Canonical link: https://commits.webkit.org/223051@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-07 23:01:20 +00:00
};
[WebAuthn] Move the mock testing entrance to Internals https://bugs.webkit.org/show_bug.cgi?id=202560 <rdar://problem/55973793> Reviewed by Chris Dumez. Source/WebCore: This patch moves TestRunner.setWebAuthenticationMockConfiguration to Internals.setMockWebAuthenticationConfiguration and removes the old entrance. The purpose of this patch is to allow API tests to use the same mock infrastructure that is used by layout tests. No new tests, covered by updates on existing tests. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * WebCore.xcodeproj/project.pbxproj: * page/ChromeClient.h: (WebCore::ChromeClient::setMockWebAuthenticationConfiguration): * testing/Internals.cpp: (WebCore::Internals::setMockWebAuthenticationConfiguration): * testing/Internals.h: * testing/Internals.idl: * testing/MockWebAuthenticationConfiguration.h: Added. (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Added. Source/WebKit: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::createMock): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): (WebKit::MockHidConnection::shouldContinueFeedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockHidService.cpp: (WebKit::MockHidService::MockHidService): * UIProcess/WebAuthentication/Mock/MockHidService.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): * UIProcess/WebAuthentication/Mock/MockLocalService.h: * UIProcess/WebAuthentication/Mock/MockLocalService.mm: (WebKit::MockLocalService::MockLocalService): * UIProcess/WebAuthentication/Mock/MockNfcService.h: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (WebKit::MockNfcService::MockNfcService): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): * WebProcess/WebCoreSupport/WebChromeClient.h: Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * 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-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/resources/public-key-credential-ip-address.https.html: Canonical link: https://commits.webkit.org/216232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-09 23:03:06 +00:00
[
Conditional=WEB_AUTHN,
] dictionary MockWebAuthenticationConfiguration {
boolean silentFailure = false;
MockLocalConfiguration local;
MockHidConfiguration hid;
MockNfcConfiguration nfc;
};
[
Conditional=WEB_AUTHN,
] dictionary MockLocalConfiguration {
[WebAuthn] Cancel WebAuthn requests when users cancel LocalAuthentication prompts https://bugs.webkit.org/show_bug.cgi?id=209923 <rdar://problem/61223713> Reviewed by Brent Fulgham. Source/WebCore: Covered by new tests within existing test files. * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Adds a new parameter to reflect user cancellations on LocalAuthentication UI. Source/WebKit: This patch intents to streamline WebAuthn local authenticator UX a bit more. Here, we should treat user cancellation of the LocalAuthentication UI as if it were being done on the UI Client's WebAuthn UI. * UIProcess/WebAuthentication/Authenticator.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::cancelRequest): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification): (WebKit::LocalAuthenticator::validateUserVerification const): * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::verifyUser const): * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): (WebKit::MockLocalConnection::verifyUser const): (WebKit::MockLocalConnection::filterResponses const): * WebKit.xcodeproj/project.pbxproj: Tools: Modifies existing tests to accommodate changes in MockWebAuthenticationConfiguration.idl. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-la.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-duplicate-credential.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-error.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la.html: LayoutTests: Adds a new test for the change and modifies existing tests to accommodate changes in MockWebAuthenticationConfiguration.idl. * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html: * http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: * http/wpt/webauthn/public-key-credential-create-success-local.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-success-local.https.html: Canonical link: https://commits.webkit.org/223051@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-07 23:01:20 +00:00
UserVerification userVerification = "no";
[WebAuthn] Move the mock testing entrance to Internals https://bugs.webkit.org/show_bug.cgi?id=202560 <rdar://problem/55973793> Reviewed by Chris Dumez. Source/WebCore: This patch moves TestRunner.setWebAuthenticationMockConfiguration to Internals.setMockWebAuthenticationConfiguration and removes the old entrance. The purpose of this patch is to allow API tests to use the same mock infrastructure that is used by layout tests. No new tests, covered by updates on existing tests. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * WebCore.xcodeproj/project.pbxproj: * page/ChromeClient.h: (WebCore::ChromeClient::setMockWebAuthenticationConfiguration): * testing/Internals.cpp: (WebCore::Internals::setMockWebAuthenticationConfiguration): * testing/Internals.h: * testing/Internals.idl: * testing/MockWebAuthenticationConfiguration.h: Added. (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Added. Source/WebKit: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::createMock): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): (WebKit::MockHidConnection::shouldContinueFeedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockHidService.cpp: (WebKit::MockHidService::MockHidService): * UIProcess/WebAuthentication/Mock/MockHidService.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): * UIProcess/WebAuthentication/Mock/MockLocalService.h: * UIProcess/WebAuthentication/Mock/MockLocalService.mm: (WebKit::MockLocalService::MockLocalService): * UIProcess/WebAuthentication/Mock/MockNfcService.h: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (WebKit::MockNfcService::MockNfcService): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): * WebProcess/WebCoreSupport/WebChromeClient.h: Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * 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-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/resources/public-key-credential-ip-address.https.html: Canonical link: https://commits.webkit.org/216232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-09 23:03:06 +00:00
boolean acceptAttestation = false;
DOMString privateKeyBase64;
DOMString userCertificateBase64;
DOMString intermediateCACertificateBase64;
[WebAuthn] Formalize the Keychain schema https://bugs.webkit.org/show_bug.cgi?id=183533 <rdar://problem/43347926> Reviewed by Brent Fulgham. Source/WebCore: Covered by new test contents within existing files. * Modules/webauthn/AuthenticatorAssertionResponse.cpp: (WebCore::AuthenticatorAssertionResponse::create): (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse): * Modules/webauthn/AuthenticatorAssertionResponse.h: Modifies the constructors to accept userEntity.name. * Modules/webauthn/cbor/CBORValue.h: Adds a FIXME. * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Modifies the test infra to use Credential ID as the unique identifier for a credential instead of the original combination of RP ID and user handle. Source/WebKit: This patch formalizes the schema for the Keychain as follows: kSecAttrLabel: RP ID kSecAttrApplicationLabel: Credential ID (auto-gen by Keychain) kSecAttrApplicationTag: { "id": UserEntity.id, "name": UserEntity.name } (CBOR encoded) Noted, the vale of kSecAttrApplicationLabel is automatically generated by the Keychain, which is a SHA-1 hash of the public key. According to the Step 7. from https://www.w3.org/TR/webauthn/#op-make-cred, the following fields are mandatory 1. rpId (rpEntity.id); 2. userHandle (userEntity.id), this is required for authenticators that support resident keys; 3. credentialId. Some other optional fields are: (from https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialrpentity) 1. rpEntity.name; 2. rpEnitty.icon; (from https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialuserentity) 3. userEntity.displayName; 4. userEntity.name; 5. userEntity.icon; (from https://www.w3.org/TR/webauthn/#sign-counter) 6. signature counter. Among the six possible fields, only 4. is chosen to store. Here is why: For rpEntity, rpEntity.id which is either the domain or the eTLD + 1 of the website is sufficient enough to either classify the credential or serving the UI. Also, this is the only trustworthy information that the UserAgent produce. Others could potentially be used by malicious websites for attacking the Keychain or spoofing/phishing users when being displayed in the UI. Also, rpEnitty.icon is a URL to the website's favicon, which if not implemented correctly can be used for tracking. For userEntity, userEntity.name is the human readable version of userEntity.id, and therefore is chosen to store such that later on WebKit can pass it to UI client to help users disambiguate different credentials. And it is necessary as userEntity.id is not guaranteed to be human readable. Others are abandoned for the very same reason as above. We hard code a zero value for 'signature counter'. While this is a theoretically interesting technique for a RP to detect private key cloning, it is unlikely to be useful in practice. We store the private keys in our SEP. This counter would only be a meaningful protection if adversaries were able to extract private key data from the SEP without Apple noticing, but were not able to manipulate this counter to fool the RP. In terms of the schema, 1) RP ID is needed to query all credentials related, and therefore it needs a column and kSecAttrLabel is supposed to be human readable; 2) kSecAttrApplicationLabel is the auto generated programmatical identifier for a SecItem, and therefore is suitable as the credential ID. Given the input to the SHA-1 is generated by us, and it is only needed to be powerful enough to be unique across the keychain within a device, and potentially to be unique across different other credential ID for the same user. The SHA-1 collision attack doesn't seem valid here. 3) kSecAttrApplicationTag is the only other column Keychain allows applications to modify. Therefore, UserEntity.id and UserEntity.name is bundled to use this slot. The reason to use CBOR here is that it is more friendly then JSON to encode binaries, and it is used widely in WebAuthn. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::toArrayBuffer): (WebKit::LocalAuthenticatorInternal::getExistingCredentials): (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): (WebKit::LocalAuthenticator::getAssertion): (WebKit::LocalAuthenticator::deleteDuplicateCredential const): * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::filterResponses const): Tools: Modifies the test infra to use Credential ID as the unique identifier for a credential instead of the original combination of RP ID and user handle. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::cleanUpKeychain): (WTR::TestRunner::keyExistsInKeychain): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::cleanUpKeychain): (WTR::TestController::keyExistsInKeychain): LayoutTests: New tests are added and all tests are modified to use Credential ID to identify a credential instead of { RP ID, user handle }. * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html: * http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: * http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-local.https.html: * http/wpt/webauthn/public-key-credential-get-failure-local-silent.https-expected.txt: * 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-success-local.https.html: * http/wpt/webauthn/resources/util.js: Canonical link: https://commits.webkit.org/221867@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-11 22:42:08 +00:00
DOMString preferredCredentialIdBase64;
[WebAuthn] Move the mock testing entrance to Internals https://bugs.webkit.org/show_bug.cgi?id=202560 <rdar://problem/55973793> Reviewed by Chris Dumez. Source/WebCore: This patch moves TestRunner.setWebAuthenticationMockConfiguration to Internals.setMockWebAuthenticationConfiguration and removes the old entrance. The purpose of this patch is to allow API tests to use the same mock infrastructure that is used by layout tests. No new tests, covered by updates on existing tests. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * WebCore.xcodeproj/project.pbxproj: * page/ChromeClient.h: (WebCore::ChromeClient::setMockWebAuthenticationConfiguration): * testing/Internals.cpp: (WebCore::Internals::setMockWebAuthenticationConfiguration): * testing/Internals.h: * testing/Internals.idl: * testing/MockWebAuthenticationConfiguration.h: Added. (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Added. Source/WebKit: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::createMock): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): (WebKit::MockHidConnection::shouldContinueFeedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockHidService.cpp: (WebKit::MockHidService::MockHidService): * UIProcess/WebAuthentication/Mock/MockHidService.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): * UIProcess/WebAuthentication/Mock/MockLocalService.h: * UIProcess/WebAuthentication/Mock/MockLocalService.mm: (WebKit::MockLocalService::MockLocalService): * UIProcess/WebAuthentication/Mock/MockNfcService.h: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (WebKit::MockNfcService::MockNfcService): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): * WebProcess/WebCoreSupport/WebChromeClient.h: Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * 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-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/resources/public-key-credential-ip-address.https.html: Canonical link: https://commits.webkit.org/216232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-09 23:03:06 +00:00
};
[
Conditional=WEB_AUTHN,
] dictionary MockHidConfiguration {
sequence<DOMString> payloadBase64;
MockHidStage stage = "info";
MockHidSubStage subStage = "init";
MockHidError error = "success";
boolean isU2f = false;
boolean keepAlive = false;
boolean fastDataArrival = false;
boolean continueAfterErrorData = false;
boolean canDowngrade = false;
[WebAuthn] Implement AuthenticatorCancel https://bugs.webkit.org/show_bug.cgi?id=191523 <rdar://problem/55920204> Reviewed by Brent Fulgham. Source/WebCore: Covered by new tests in existing test files. * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): * Modules/webauthn/AuthenticatorCoordinator.cpp: (WebCore::AuthenticatorCoordinator::create const): (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const): * Modules/webauthn/AuthenticatorCoordinator.h: * Modules/webauthn/AuthenticatorCoordinatorClient.cpp: Removed. * Modules/webauthn/AuthenticatorCoordinatorClient.h: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredential::tryCreate): * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredentialData.h: * Modules/webauthn/fido/DeviceRequestConverter.h: * Modules/webauthn/fido/FidoHidMessage.cpp: (fido::FidoHidMessage::FidoHidMessage): * Modules/webauthn/fido/FidoHidPacket.cpp: (fido::FidoHidInitPacket::getSerializedData const): (fido::FidoHidContinuationPacket::getSerializedData const): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Adds a new option to test AuthenticatorCancel. Source/WebKit: This patch implement two ways to cancel a pending WebAuthn ceremony: 1) Via navigation activities. Activities include i) main frame navigation, ii) main frame reload, iii) main frame destruction, iv) sub frame navigation, and v) sub frame destruction. All the above activities will cancel any pending WebAuthn ceremony that is associated with the frame. To prove the association, a GlobalFrameIdentifier is bridged into WebAuthenticationRequestData. Navigation cancel is done in WebPageProxy::didStartProvisionalLoadForFrameShared, and destruction cancel is done in WebProcessProxy::didDestroyFrame and WebPageProxy::resetState. 2) Via UI. This path is simply bridged -[_WKWebAuthenticationPanel cancel] into AuthenticatorManager. Noted, this patch follows the spec to wait until time out to notify RPs. References: i) Step 20 of https://www.w3.org/TR/webauthn/#createCredential, ii) Step 18 of https://www.w3.org/TR/webauthn/#getAssertion As for what the cancel actually does, it: 1) stops any HID/NFC scanning; 2) sends CTAPHID_CANCEL to any HID authenticators that have been added. Reference: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb-hid-cancel Sending CTAPHID_CANCEL, however, is not trivial. An abstract class FidoAuthenticator is crafted to do this labor for both CtapAuthenticator and U2fAuthenticator during the time of destructions. Noted: The CtapHidDriver is the only CtapDriver implements the cancel method. Since the message is sent during state reset, lifecycle of the HidConenction and HidService which manage the underlying IOHIDDeviceRef is very hard to hold. This is required for the regular async sender. Therefore, HidConnection::sendSync is crafted to send the message synchronously to get rid of the tediousness of managing those lifecycles. P.S. Vector::grow doesn't initialize POD types. Therefore, this patch also appends it with memset for FidoHidPacket. P.S.S. This patch also simplifies AuthenticatorCoordinatorClient by: i) moving code from AuthenticatorCoordinatorClient to WebAuthenticatorCoordinatorClient, and ii) using sendWithAsyncReply. The latter allows us to get rid of the complex mechanism of ensuring the right reply is returned. * DerivedSources.make: * Sources.txt: * UIProcess/API/APIWebAuthenticationPanel.cpp: (API::WebAuthenticationPanel::create): (API::WebAuthenticationPanel::WebAuthenticationPanel): (API::WebAuthenticationPanel::cancel const): * UIProcess/API/APIWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (-[_WKWebAuthenticationPanel cancel]): * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::cancelRequest): (WebKit::AuthenticatorManager::clearState): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::resetState): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/HidConnection.h: (WebKit::HidConnection::isInitialized const): (WebKit::HidConnection::setIsInitialized): * UIProcess/WebAuthentication/Cocoa/HidConnection.mm: (WebKit::HidConnection::~HidConnection): (WebKit::HidConnection::initialize): (WebKit::HidConnection::terminate): (WebKit::HidConnection::sendSync): (WebKit::HidConnection::send): (WebKit::HidConnection::registerDataReceivedCallback): * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::initialize): (WebKit::MockHidConnection::terminate): (WebKit::MockHidConnection::sendSync): (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::feedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential): (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion): (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest): (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable): (WebKit::WebAuthenticatorCoordinatorProxy::requestReply): Deleted. * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in: * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::CtapAuthenticator): (WebKit::CtapAuthenticator::makeCredential): (WebKit::CtapAuthenticator::getAssertion): (WebKit::CtapAuthenticator::tryDowngrade): * UIProcess/WebAuthentication/fido/CtapAuthenticator.h: * UIProcess/WebAuthentication/fido/CtapDriver.h: (WebKit::CtapDriver::cancel): * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: (WebKit::CtapHidDriver::Worker::write): (WebKit::CtapHidDriver::Worker::read): (WebKit::CtapHidDriver::Worker::returnMessage): (WebKit::CtapHidDriver::Worker::reset): (WebKit::CtapHidDriver::Worker::cancel): (WebKit::CtapHidDriver::continueAfterChannelAllocated): (WebKit::CtapHidDriver::continueAfterResponseReceived): (WebKit::CtapHidDriver::returnResponse): (WebKit::CtapHidDriver::reset): (WebKit::CtapHidDriver::cancel): * UIProcess/WebAuthentication/fido/CtapHidDriver.h: * UIProcess/WebAuthentication/fido/FidoAuthenticator.cpp: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp. (WebKit::FidoAuthenticator::FidoAuthenticator): (WebKit::FidoAuthenticator::~FidoAuthenticator): (WebKit::FidoAuthenticator::driver const): (WebKit::FidoAuthenticator::releaseDriver): * UIProcess/WebAuthentication/fido/FidoAuthenticator.h: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp. * UIProcess/WebAuthentication/fido/FidoService.cpp: (WebKit::FidoService::continueAfterGetInfo): * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: (WebKit::U2fAuthenticator::U2fAuthenticator): (WebKit::U2fAuthenticator::issueCommand): * UIProcess/WebAuthentication/fido/U2fAuthenticator.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::resetState): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didDestroyFrame): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::WebAuthenticatorCoordinator): (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): (WebKit::WebAuthenticatorCoordinator::~WebAuthenticatorCoordinator): Deleted. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h: * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in: Removed. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::fromCoreFrame): * WebProcess/WebPage/WebFrame.h: Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebCore/FidoHidMessageTest.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: (-[TestWebAuthenticationPanelUIDelegate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid-cancel.html: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid.html. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-nfc.html: * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion.html: LayoutTests: Modified one of the error message that is no longer emitted. * 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-get-failure.https.html: * http/wpt/webauthn/public-key-credential-get-success-hid.https.html: Canonical link: https://commits.webkit.org/216561@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251295 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-18 20:55:56 +00:00
boolean expectCancel = false;
[WebAuthn] Support CTAP Client Pin https://bugs.webkit.org/show_bug.cgi?id=191516 <rdar://problem/56558558> Reviewed by Brent Fulgham. Source/WebCore: Covered by API tests. * Modules/webauthn/fido/DeviceRequestConverter.cpp: (fido::encodeMakeCredenitalRequestAsCBOR): (fido::encodeGetAssertionRequestAsCBOR): * Modules/webauthn/fido/Pin.cpp: (fido::pin::RetriesResponse::parse): (fido::pin::TokenResponse::parse): (fido::pin::TokenRequest::tryCreate): (fido::pin::encodeAsCBOR): * Modules/webauthn/fido/Pin.h: * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::transformAES_CBC): (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Source/WebKit: This patch implements authenticatorClientPIN from the spec: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorClientPIN Specifically, it implements section 5.5.1, 5.5.3, 5.5.4, 5.5.7, and 5.5.8. Here is the flow how makeCredential/getAssertion works with a PIN in our implementation: 1. Determine if the connected authenticator has a PIN; 2. If yes, send the makeCredential/getAssertion request to the authenticator with an empty pinAuth such that the authenticator will wink for user gestures. This step intends to confirm the authenticator is the one the user wants to use. Otherwise, we don't know which authenticator to send the PIN if multiple are connected; 3. Once the user confirms the authetnicator, it will return either CTAP2_ERR_PIN_INVALID or CTAP2_ERR_PIN_AUTH_INVALID. Some authenticators return CTAP2_ERR_PIN_AUTH_INVALID even though it is not suggested by the spec; 4. Get retries from the authenticator; 5. Get key agreement from the authenticator; 6. Ask the UI client for the PIN and at the meantime inform it the retries; 7. Get pin token from the authenticator; 8. Resend the makeCredential/getAssertion request with the desired pinAuth. Besides implementating the above flow, this patch also fixes some bugs within the PIN commands encoder: 1. pinAuth/pinProtocol are wrongly encoded for makeCredential/getAssertion; 2. AES CBC should be called without any padding. Therefore, CryptoAlgorithmAES_CBC adds a no padding mode; 3. The sharedSecret is the SHA256 digest of the ECDH key agreement instead of the raw key agreement. * UIProcess/API/APIWebAuthenticationPanelClient.h: (API::WebAuthenticationPanelClient::requestPin const): * UIProcess/WebAuthentication/Authenticator.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::requestPin): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient): (WebKit::WebAuthenticationPanelClient::requestPin const): * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::feedReports): * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::makeCredential): (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived): (WebKit::CtapAuthenticator::getAssertion): (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived): (WebKit::CtapAuthenticator::getRetries): (WebKit::CtapAuthenticator::continueGetKeyAgreementAfterGetRetries): (WebKit::CtapAuthenticator::continueRequestPinAfterGetKeyAgreement): (WebKit::CtapAuthenticator::continueGetPinTokenAfterRequestPin): (WebKit::CtapAuthenticator::continueRequestAfterGetPinToken): (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived const): Deleted. * UIProcess/WebAuthentication/fido/CtapAuthenticator.h: Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebCore/CtapPinTest.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/FidoTestData.h: * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: (-[TestWebAuthenticationPanelDelegate panel:requestPINWithRemainingRetries:completionHandler:]): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid-pin.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid-pin-get-key-agreement-error.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid-pin-get-pin-token-error.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid-pin-get-retries-error.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid-pin.html: Added. Canonical link: https://commits.webkit.org/219272@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-13 18:53:59 +00:00
boolean supportClientPin = false;
[WebAuthn] Move the mock testing entrance to Internals https://bugs.webkit.org/show_bug.cgi?id=202560 <rdar://problem/55973793> Reviewed by Chris Dumez. Source/WebCore: This patch moves TestRunner.setWebAuthenticationMockConfiguration to Internals.setMockWebAuthenticationConfiguration and removes the old entrance. The purpose of this patch is to allow API tests to use the same mock infrastructure that is used by layout tests. No new tests, covered by updates on existing tests. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * WebCore.xcodeproj/project.pbxproj: * page/ChromeClient.h: (WebCore::ChromeClient::setMockWebAuthenticationConfiguration): * testing/Internals.cpp: (WebCore::Internals::setMockWebAuthenticationConfiguration): * testing/Internals.h: * testing/Internals.idl: * testing/MockWebAuthenticationConfiguration.h: Added. (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Added. Source/WebKit: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::createMock): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): (WebKit::MockHidConnection::shouldContinueFeedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockHidService.cpp: (WebKit::MockHidService::MockHidService): * UIProcess/WebAuthentication/Mock/MockHidService.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): * UIProcess/WebAuthentication/Mock/MockLocalService.h: * UIProcess/WebAuthentication/Mock/MockLocalService.mm: (WebKit::MockLocalService::MockLocalService): * UIProcess/WebAuthentication/Mock/MockNfcService.h: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (WebKit::MockNfcService::MockNfcService): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): * WebProcess/WebCoreSupport/WebChromeClient.h: Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * 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-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/resources/public-key-credential-ip-address.https.html: Canonical link: https://commits.webkit.org/216232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-09 23:03:06 +00:00
};
[
Conditional=WEB_AUTHN,
] dictionary MockNfcConfiguration {
MockNfcError error = "success";
sequence<DOMString> payloadBase64;
boolean multipleTags = false;
[WebAuthn] Warn users when multiple NFC tags present https://bugs.webkit.org/show_bug.cgi?id=200932 <rdar://problem/54890736> Reviewed by Brent Fulgham. Source/WebCore: Covered by new tests in existing test file. * testing/MockWebAuthenticationConfiguration.h: (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Adds a new test option. Source/WebKit: This patch utilizes -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] to inform clients about multiple physical tags are presenting such that clients can instruct users to select only one of them physically. Given a physical tag could have multiple different interfaces, which NearField will treat them into different NFTags, the tagID is then used to identify if there are actually multiple physical tags. This patch also adds the ability to restart polling of a partiuclar NFReaderSession to NfcConnection and the ability to restart the whole session to NfcService. The former is used to recover from errors in the discovery stages, and the latter is used to recover from errors returned from authenticators in the request stages. For the latter, given NfcConnection is not awared of the syntax of FIDO2/U2F protocol, and CtapAuthenticator/U2fAuthenticator are not awared the transport of the underneath driver. A generic restartDiscovery process is added to each service and it is up to the actual service to implement the actual process such that AuthenticatorManager can arbitrarily call it after exceptions are returned to restart the whole NFC session. To achieve restartDiscovery, NfcConnection is made RefCounted as well such that both the NfcService and the CtapNfcDriver could hold it at the same time. CtapNfcDriver uses the connection to complete requests as before while NfcService has the new capability to use it to stop the current session when restartDiscovery kicks off. * Platform/spi/Cocoa/NearFieldSPI.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::serviceStatusUpdated): (WebKit::AuthenticatorManager::respondReceived): (WebKit::AuthenticatorManager::restartDiscovery): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::startDiscovery): (WebKit::AuthenticatorTransportService::restartDiscovery): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: (WebKit::AuthenticatorTransportService::restartDiscoveryInternal): * UIProcess/WebAuthentication/Cocoa/NfcConnection.h: * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm: (WebKit::NfcConnection::create): (WebKit::NfcConnection::NfcConnection): (WebKit::NfcConnection::~NfcConnection): (WebKit::NfcConnection::stop const): (WebKit::NfcConnection::didDetectTags): (WebKit::NfcConnection::restartPolling): (WebKit::NfcConnection::startPolling): (WebKit::NfcConnection::didDetectTags const): Deleted. * UIProcess/WebAuthentication/Cocoa/NfcService.h: * UIProcess/WebAuthentication/Cocoa/NfcService.mm: (WebKit::NfcService::NfcService): (WebKit::NfcService::didConnectTag): (WebKit::NfcService::didDetectMultipleTags const): (WebKit::NfcService::setConnection): (WebKit::NfcService::restartDiscoveryInternal): (WebKit::NfcService::platformStartDiscovery): (WebKit::NfcService::setDriver): Deleted. * UIProcess/WebAuthentication/Mock/MockNfcService.h: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (-[WKMockNFTag tagID]): (-[WKMockNFTag initWithNFTag:]): (-[WKMockNFTag dealloc]): (-[WKMockNFTag initWithType:]): (-[WKMockNFTag initWithType:tagID:]): (WebKit::MockNfcService::receiveStopPolling): (WebKit::MockNfcService::receiveStartPolling): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags): (WebKit::MockNfcService::detectTags const): Deleted. * UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp: (WebKit::CtapNfcDriver::CtapNfcDriver): * UIProcess/WebAuthentication/fido/CtapNfcDriver.h: * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: (-[TestWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:]): (TestWebKitAPI::TEST): Adds a new test for -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:]. * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-nfc-multiple-tags.html: Added. LayoutTests: * http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-nfc.https.html: Adds new tests for multiple physical tags and service restart. Canonical link: https://commits.webkit.org/216872@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-27 22:53:33 +00:00
boolean multiplePhysicalTags = false;
[WebAuthn] Move the mock testing entrance to Internals https://bugs.webkit.org/show_bug.cgi?id=202560 <rdar://problem/55973793> Reviewed by Chris Dumez. Source/WebCore: This patch moves TestRunner.setWebAuthenticationMockConfiguration to Internals.setMockWebAuthenticationConfiguration and removes the old entrance. The purpose of this patch is to allow API tests to use the same mock infrastructure that is used by layout tests. No new tests, covered by updates on existing tests. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * WebCore.xcodeproj/project.pbxproj: * page/ChromeClient.h: (WebCore::ChromeClient::setMockWebAuthenticationConfiguration): * testing/Internals.cpp: (WebCore::Internals::setMockWebAuthenticationConfiguration): * testing/Internals.h: * testing/Internals.idl: * testing/MockWebAuthenticationConfiguration.h: Added. (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): (WebCore::MockWebAuthenticationConfiguration::encode const): (WebCore::MockWebAuthenticationConfiguration::decode): * testing/MockWebAuthenticationConfiguration.idl: Added. Source/WebKit: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: (WebKit::AuthenticatorTransportService::createMock): * UIProcess/WebAuthentication/AuthenticatorTransportService.h: * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: (WebKit::MockHidConnection::send): (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): (WebKit::MockHidConnection::parseRequest): (WebKit::MockHidConnection::feedReports): (WebKit::MockHidConnection::shouldContinueFeedReports): * UIProcess/WebAuthentication/Mock/MockHidConnection.h: * UIProcess/WebAuthentication/Mock/MockHidService.cpp: (WebKit::MockHidService::MockHidService): * UIProcess/WebAuthentication/Mock/MockHidService.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::MockLocalConnection): * UIProcess/WebAuthentication/Mock/MockLocalService.h: * UIProcess/WebAuthentication/Mock/MockLocalService.mm: (WebKit::MockLocalService::MockLocalService): * UIProcess/WebAuthentication/Mock/MockNfcService.h: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (WebKit::MockNfcService::MockNfcService): (WebKit::MockNfcService::platformStartDiscovery): (WebKit::MockNfcService::detectTags const): * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): * WebProcess/WebCoreSupport/WebChromeClient.h: Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted. * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * 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-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/resources/public-key-credential-ip-address.https.html: Canonical link: https://commits.webkit.org/216232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-09 23:03:06 +00:00
};