Changeset 283515 in webkit
- Timestamp:
- Oct 4, 2021, 2:47:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/testing/MockWebAuthenticationConfiguration.h (modified) (3 diffs)
-
Source/WebCore/testing/MockWebAuthenticationConfiguration.idl (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (5 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (modified) (2 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid-internal-uv.html (added)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid-internal-uv.html (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r283511 r283515 1 2021-10-04 John Pascoe <j_pascoe@apple.com> 2 3 [WebAuthn] Prefer internal user verification if available over pin entry. 4 https://bugs.webkit.org/show_bug.cgi?id=213903 5 <rdar://problem/65359269> 6 7 Reviewed by Brent Fulgham. 8 9 This adds an option to mock internal user verification in tests. 10 11 * testing/MockWebAuthenticationConfiguration.h: 12 (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): 13 (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): 14 * testing/MockWebAuthenticationConfiguration.idl: 15 1 16 2021-10-04 Sam Weinig <weinig@apple.com> 2 17 -
trunk/Source/WebCore/testing/MockWebAuthenticationConfiguration.h
r278253 r283515 93 93 bool expectCancel { false }; 94 94 bool supportClientPin { false }; 95 bool supportInternalUV { false }; 95 96 96 97 template<class Encoder> void encode(Encoder&) const; … … 170 171 void MockWebAuthenticationConfiguration::HidConfiguration::encode(Encoder& encoder) const 171 172 { 172 encoder << payloadBase64 << stage << subStage << error << isU2f << keepAlive << fastDataArrival << continueAfterErrorData << canDowngrade << expectCancel << supportClientPin ;173 encoder << payloadBase64 << stage << subStage << error << isU2f << keepAlive << fastDataArrival << continueAfterErrorData << canDowngrade << expectCancel << supportClientPin << supportInternalUV; 173 174 } 174 175 … … 198 199 return std::nullopt; 199 200 if (!decoder.decode(result.supportClientPin)) 201 return std::nullopt; 202 if (!decoder.decode(result.supportInternalUV)) 200 203 return std::nullopt; 201 204 return result; -
trunk/Source/WebCore/testing/MockWebAuthenticationConfiguration.idl
r276180 r283515 103 103 boolean expectCancel = false; 104 104 boolean supportClientPin = false; 105 boolean supportInternalUV = false; 105 106 }; 106 107 -
trunk/Source/WebKit/ChangeLog
r283514 r283515 1 2021-10-04 John Pascoe <j_pascoe@apple.com> 2 3 [WebAuthn] Prefer internal user verification if available over pin entry. 4 https://bugs.webkit.org/show_bug.cgi?id=213903 5 <rdar://problem/65359269> 6 7 Reviewed by Brent Fulgham. 8 9 * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: 10 (WebKit::MockHidConnection::feedReports): 11 * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: 12 (WebKit::CtapAuthenticator::makeCredential): 13 (WebKit::CtapAuthenticator::getAssertion): 14 (WebKit::fido::toStatus): Deleted. 15 (WebKit::fido::isPinError): Deleted. 16 1 17 2021-10-04 John Pascoe <j_pascoe@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp
r278253 r283515 229 229 if (m_configuration.hid->canDowngrade) 230 230 infoData = encodeAsCBOR(AuthenticatorGetInfoResponse({ ProtocolVersion::kCtap, ProtocolVersion::kU2f }, Vector<uint8_t>(aaguidLength, 0u))); 231 else if (m_configuration.hid->supportClientPin){231 else { 232 232 AuthenticatorGetInfoResponse infoResponse({ ProtocolVersion::kCtap }, Vector<uint8_t>(aaguidLength, 0u)); 233 infoResponse.setPinProtocols({ pin::kProtocolVersion });234 233 AuthenticatorSupportedOptions options; 235 options.setClientPinAvailability(AuthenticatorSupportedOptions::ClientPinAvailability::kSupportedAndPinSet); 234 if (m_configuration.hid->supportClientPin) { 235 infoResponse.setPinProtocols({ pin::kProtocolVersion }); 236 options.setClientPinAvailability(AuthenticatorSupportedOptions::ClientPinAvailability::kSupportedAndPinSet); 237 } 238 if (m_configuration.hid->supportInternalUV) 239 options.setUserVerificationAvailability(AuthenticatorSupportedOptions::UserVerificationAvailability::kSupportedAndConfigured); 236 240 infoResponse.setOptions(WTFMove(options)); 237 241 infoData = encodeAsCBOR(infoResponse); 238 } else 239 infoData = encodeAsCBOR(AuthenticatorGetInfoResponse({ ProtocolVersion::kCtap }, Vector<uint8_t>(aaguidLength, 0u))); 242 } 240 243 infoData.insert(0, static_cast<uint8_t>(CtapDeviceResponseCode::kSuccess)); // Prepend status code. 241 244 if (stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongChannelId) -
trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp
r278358 r283515 48 48 using namespace fido; 49 49 50 using UVAvailability = AuthenticatorSupportedOptions::UserVerificationAvailability; 51 50 52 namespace { 51 53 WebAuthenticationStatus toStatus(const CtapDeviceResponseCode& error) … … 93 95 Vector<uint8_t> cborCmd; 94 96 auto& options = WTF::get<PublicKeyCredentialCreationOptions>(requestData().options); 95 if (m_info.options().clientPinAvailability() == AuthenticatorSupportedOptions::ClientPinAvailability::kSupportedAndPinSet) 96 cborCmd = encodeMakeCredenitalRequestAsCBOR(requestData().hash, options, m_info.options().userVerificationAvailability(), PinParameters { pin::kProtocolVersion, m_pinAuth }); 97 auto internalUVAvailability = m_info.options().userVerificationAvailability(); 98 // If UV is required, then either built-in uv or a pin will work. 99 if (internalUVAvailability == UVAvailability::kSupportedAndConfigured && (!options.authenticatorSelection || options.authenticatorSelection->userVerification != UserVerificationRequirement::Discouraged)) 100 cborCmd = encodeMakeCredenitalRequestAsCBOR(requestData().hash, options, internalUVAvailability); 101 else if (m_info.options().clientPinAvailability() == AuthenticatorSupportedOptions::ClientPinAvailability::kSupportedAndPinSet) 102 cborCmd = encodeMakeCredenitalRequestAsCBOR(requestData().hash, options, internalUVAvailability, PinParameters { pin::kProtocolVersion, m_pinAuth }); 97 103 else 98 cborCmd = encodeMakeCredenitalRequestAsCBOR(requestData().hash, options, m_info.options().userVerificationAvailability());104 cborCmd = encodeMakeCredenitalRequestAsCBOR(requestData().hash, options, internalUVAvailability); 99 105 driver().transact(WTFMove(cborCmd), [weakThis = makeWeakPtr(*this)](Vector<uint8_t>&& data) { 100 106 ASSERT(RunLoop::isMain()); … … 134 140 Vector<uint8_t> cborCmd; 135 141 auto& options = WTF::get<PublicKeyCredentialRequestOptions>(requestData().options); 136 if (m_info.options().clientPinAvailability() == AuthenticatorSupportedOptions::ClientPinAvailability::kSupportedAndPinSet && options.userVerification != UserVerificationRequirement::Discouraged) 137 cborCmd = encodeGetAssertionRequestAsCBOR(requestData().hash, options, m_info.options().userVerificationAvailability(), PinParameters { pin::kProtocolVersion, m_pinAuth }); 142 auto internalUVAvailability = m_info.options().userVerificationAvailability(); 143 // If UV is required, then either built-in uv or a pin will work. 144 if (internalUVAvailability == UVAvailability::kSupportedAndConfigured && options.userVerification != UserVerificationRequirement::Discouraged) 145 cborCmd = encodeGetAssertionRequestAsCBOR(requestData().hash, options, internalUVAvailability); 146 else if (m_info.options().clientPinAvailability() == AuthenticatorSupportedOptions::ClientPinAvailability::kSupportedAndPinSet && options.userVerification != UserVerificationRequirement::Discouraged) 147 cborCmd = encodeGetAssertionRequestAsCBOR(requestData().hash, options, internalUVAvailability, PinParameters { pin::kProtocolVersion, m_pinAuth }); 138 148 else 139 cborCmd = encodeGetAssertionRequestAsCBOR(requestData().hash, options, m_info.options().userVerificationAvailability());149 cborCmd = encodeGetAssertionRequestAsCBOR(requestData().hash, options, internalUVAvailability); 140 150 driver().transact(WTFMove(cborCmd), [weakThis = makeWeakPtr(*this)](Vector<uint8_t>&& data) { 141 151 ASSERT(RunLoop::isMain()); -
trunk/Tools/ChangeLog
r283514 r283515 1 2021-10-04 John Pascoe <j_pascoe@apple.com> 2 3 [WebAuthn] Prefer internal user verification if available over pin entry. 4 https://bugs.webkit.org/show_bug.cgi?id=213903 5 <rdar://problem/65359269> 6 7 Reviewed by Brent Fulgham. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: 11 (TestWebKitAPI::TEST): 12 * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion-hid-internal-uv.html: Added. 13 * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid-internal-uv.html: Added. 14 1 15 2021-10-04 John Pascoe <j_pascoe@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r283476 r283515 396 396 524BBCA119E30C77002F1AF1 /* test.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 524BBCA019E30C63002F1AF1 /* test.mp4 */; }; 397 397 52B8CF9815868D9100281053 /* SetDocumentURI.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 52B8CF9415868CF000281053 /* SetDocumentURI.html */; }; 398 52C8C1382706437C00BDF3B7 /* web-authentication-make-credential-hid-internal-uv.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 52C8C1372706437C00BDF3B7 /* web-authentication-make-credential-hid-internal-uv.html */; }; 399 52C8C13A2706439000BDF3B7 /* web-authentication-get-assertion-hid-internal-uv.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 52C8C1392706439000BDF3B7 /* web-authentication-get-assertion-hid-internal-uv.html */; }; 398 400 52D5D6C021B9F1B30046ABA6 /* RenderingProgress.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5D6BD21B9F1B20046ABA6 /* RenderingProgress.mm */; }; 399 401 52D673EE1AFB127300FA19FE /* WKPageCopySessionStateWithFiltering.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52D673EC1AFB126800FA19FE /* WKPageCopySessionStateWithFiltering.cpp */; }; … … 1753 1755 CD577799211CE0E4001B371E /* web-audio-only.html in Copy Resources */, 1754 1756 57663DF32357E48900E85E09 /* web-authentication-get-assertion-hid-cancel.html in Copy Resources */, 1757 52C8C13A2706439000BDF3B7 /* web-authentication-get-assertion-hid-internal-uv.html in Copy Resources */, 1755 1758 579F1C0123C93AF500C7D4B4 /* web-authentication-get-assertion-hid-multiple-accounts.html in Copy Resources */, 1756 1759 577454D02359B378008E1ED7 /* web-authentication-get-assertion-hid-no-credentials.html in Copy Resources */, … … 1766 1769 577454D22359BB01008E1ED7 /* web-authentication-get-assertion-u2f-no-credentials.html in Copy Resources */, 1767 1770 57C624502346C21E00383FE7 /* web-authentication-get-assertion.html in Copy Resources */, 1771 52C8C1382706437C00BDF3B7 /* web-authentication-make-credential-hid-internal-uv.html in Copy Resources */, 1768 1772 578DA44823ECD09B00246010 /* web-authentication-make-credential-hid-pin-auth-blocked-error.html in Copy Resources */, 1769 1773 570D26F423C3CA6A00D5CF67 /* web-authentication-make-credential-hid-pin-get-key-agreement-error.html in Copy Resources */, … … 2258 2262 52B8CF9415868CF000281053 /* SetDocumentURI.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = SetDocumentURI.html; sourceTree = "<group>"; }; 2259 2263 52B8CF9515868CF000281053 /* SetDocumentURI.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetDocumentURI.mm; sourceTree = "<group>"; }; 2264 52C8C1372706437C00BDF3B7 /* web-authentication-make-credential-hid-internal-uv.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = "web-authentication-make-credential-hid-internal-uv.html"; path = "Tests/WebKitCocoa/web-authentication-make-credential-hid-internal-uv.html"; sourceTree = "<group>"; }; 2265 52C8C1392706439000BDF3B7 /* web-authentication-get-assertion-hid-internal-uv.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = "web-authentication-get-assertion-hid-internal-uv.html"; path = "Tests/WebKitCocoa/web-authentication-get-assertion-hid-internal-uv.html"; sourceTree = "<group>"; }; 2260 2266 52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadAlternateHTMLStringWithNonDirectoryURL.cpp; sourceTree = "<group>"; }; 2261 2267 52D5D6BD21B9F1B20046ABA6 /* RenderingProgress.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderingProgress.mm; sourceTree = "<group>"; }; … … 3255 3261 isa = PBXGroup; 3256 3262 children = ( 3263 52C8C1392706439000BDF3B7 /* web-authentication-get-assertion-hid-internal-uv.html */, 3264 52C8C1372706437C00BDF3B7 /* web-authentication-make-credential-hid-internal-uv.html */, 3257 3265 49AEEF682407276F00C87E4C /* Info.plist */, 3258 3266 5C9D922622D7DD7B008E9266 /* Derived Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm
r283514 r283515 1124 1124 } 1125 1125 1126 TEST(WebAuthenticationPanel, MakeCredentialInternalUV) 1127 { 1128 reset(); 1129 RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"web-authentication-make-credential-hid-internal-uv" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 1130 1131 auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 1132 [[configuration preferences] _setEnabled:YES forExperimentalFeature:webAuthenticationExperimentalFeature()]; 1133 [[configuration preferences] _setEnabled:NO forExperimentalFeature:webAuthenticationModernExperimentalFeature()]; 1134 1135 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSZeroRect configuration:configuration]); 1136 auto delegate = adoptNS([[TestWebAuthenticationPanelUIDelegate alloc] init]); 1137 [webView setUIDelegate:delegate.get()]; 1138 [webView focus]; 1139 1140 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1141 [webView waitForMessage:@"Succeeded!"]; 1142 } 1143 1126 1144 TEST(WebAuthenticationPanel, MakeCredentialPin) 1127 1145 { … … 1199 1217 1200 1218 webAuthenticationPanelPin = "1234"; 1219 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1220 [webView waitForMessage:@"Succeeded!"]; 1221 } 1222 1223 TEST(WebAuthenticationPanel, GetAssertionInternalUV) 1224 { 1225 reset(); 1226 RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"web-authentication-get-assertion-hid-internal-uv" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 1227 1228 auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 1229 [[configuration preferences] _setEnabled:YES forExperimentalFeature:webAuthenticationExperimentalFeature()]; 1230 [[configuration preferences] _setEnabled:NO forExperimentalFeature:webAuthenticationModernExperimentalFeature()]; 1231 1232 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSZeroRect configuration:configuration]); 1233 auto delegate = adoptNS([[TestWebAuthenticationPanelUIDelegate alloc] init]); 1234 [webView setUIDelegate:delegate.get()]; 1235 [webView focus]; 1236 1201 1237 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1202 1238 [webView waitForMessage:@"Succeeded!"];
Note:
See TracChangeset
for help on using the changeset viewer.