Changeset 284532 in webkit
- Timestamp:
- Oct 20, 2021, 8:01:41 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html (modified) (2 diffs)
-
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r284530 r284532 1 2021-10-20 John Pascoe <j_pascoe@apple.com> 2 3 WebAuthn] Obtain consent to create new credential when platform authenticator in excludedCredentials 4 https://bugs.webkit.org/show_bug.cgi?id=219813 5 <rdar://problem/72484635> 6 7 Reviewed by Brent Fulgham. 8 9 Modify layout tests to reflect different exception returned when consent is provided 10 11 * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html: 12 * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: 13 1 14 2021-10-20 Alan Bujtas <zalan@apple.com> 2 15 -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html
r284429 r284532 51 51 if (window.testRunner) 52 52 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, testUserEntityBundleBase64); 53 return promiseRejects(t, " NotAllowedError", navigator.credentials.create(options), "Operation timed out.").then(() => {53 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => { 54 54 if (window.testRunner) 55 55 testRunner.cleanUpKeychain(testRpId, credentialIDBase64); … … 85 85 if (window.testRunner) 86 86 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, testUserEntityBundleBase64); 87 return promiseRejects(t, " NotAllowedError", navigator.credentials.create(options), "Operation timed out.").then(() => {87 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => { 88 88 if (window.testRunner) 89 89 testRunner.cleanUpKeychain(testRpId, credentialIDBase64); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html
r284429 r284532 49 49 if (window.testRunner) 50 50 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, testUserEntityBundleBase64); 51 return promiseRejects(t, " NotAllowedError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => {51 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => { 52 52 if (window.testRunner) 53 53 testRunner.cleanUpKeychain(testRpId, credentialIDBase64); … … 82 82 if (window.testRunner) 83 83 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, testUserEntityBundleBase64); 84 return promiseRejects(t, " NotAllowedError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => {84 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => { 85 85 if (window.testRunner) 86 86 testRunner.cleanUpKeychain(testRpId, credentialIDBase64); -
trunk/Source/WebKit/ChangeLog
r284528 r284532 1 2021-10-20 John Pascoe <j_pascoe@apple.com> 2 [WebAuthn] Obtain consent to create new credential when platform authenticator in excludedCredentials 3 https://bugs.webkit.org/show_bug.cgi?id=219813 4 <rdar://problem/72484635> 5 6 Reviewed by Brent Fulgham. 7 8 Currently, whenever the platform authenticator is within excludedCredentials during makeCredential we 9 always return NotAllowedError and merely flash a consent screen. This does not match the spec per Step 3.1 10 of makeCredential (https://w3c.github.io/webauthn/#sctn-op-make-cred). Instead, we should always obtain consent 11 and return a different error depending on consent was obtained. 12 13 A fixme to add this was inadvertently removed in https://bugs.webkit.org/attachment.cgi?id=393180&action=prettypatch 14 15 Added api test TestWebKitAPI.WebAuthenticationPanel.LADuplicateCredentialWithConsent 16 17 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 18 (WebKit::LocalAuthenticator::makeCredential): 19 1 20 2021-10-20 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
r284429 r284532 228 228 return excludeCredentialIds.contains(base64EncodeToString(rawId->data(), rawId->byteLength())); 229 229 })) { 230 receiveException({ NotAllowedError, "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator."_s }, WebAuthenticationStatus::LAExcludeCredentialsMatched); 230 // Obtain consent per Step 3.1 231 auto callback = [weakThis = WeakPtr { *this }] (LocalAuthenticatorPolicy policy) { 232 ASSERT(RunLoop::isMain()); 233 if (!weakThis) 234 return; 235 236 if (policy == LocalAuthenticatorPolicy::Allow) 237 weakThis->receiveException({ InvalidStateError, "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator."_s }, WebAuthenticationStatus::LAExcludeCredentialsMatched); 238 else 239 weakThis->receiveException({ NotAllowedError, "This request has been cancelled by the user."_s }); 240 }; 241 observer()->decidePolicyForLocalAuthenticator(WTFMove(callback)); 231 242 return; 232 243 } -
trunk/Tools/ChangeLog
r284528 r284532 1 2021-10-20 John Pascoe <j_pascoe@apple.com> 2 [WebAuthn] Obtain consent to create new credential when platform authenticator in excludedCredentials 3 https://bugs.webkit.org/show_bug.cgi?id=219813 4 <rdar://problem/72484635> 5 6 Reviewed by Brent Fulgham. 7 8 Currently, whenever the platform authenticator is within excludedCredentials during makeCredential we 9 always return NotAllowedError and merely flash a consent screen. This does not match the spec per Step 3.1 10 of makeCredential (https://w3c.github.io/webauthn/#sctn-op-make-cred). Instead, we should always obtain consent 11 and return a different error depending on consent was obtained. 12 13 This adds a test to confirm a different path is taken whenever consent is obtained. 14 15 * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: 16 (TestWebKitAPI::TEST): 17 1 18 2021-10-20 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm
r284429 r284532 1383 1383 ASSERT_TRUE(addKeyToKeychain(testES256PrivateKeyBase64, "", testUserEntityBundleBase64)); 1384 1384 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1385 Util::run(&webAuthenticationPanelFailed); 1386 cleanUpKeychain(""); 1387 } 1388 1389 TEST(WebAuthenticationPanel, LADuplicateCredentialWithConsent) 1390 { 1391 reset(); 1392 RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"web-authentication-make-credential-la-duplicate-credential" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 1393 1394 auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 1395 [[configuration preferences] _setEnabled:YES forExperimentalFeature:webAuthenticationExperimentalFeature()]; 1396 [[configuration preferences] _setEnabled:NO forExperimentalFeature:webAuthenticationModernExperimentalFeature()]; 1397 1398 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSZeroRect configuration:configuration]); 1399 auto delegate = adoptNS([[TestWebAuthenticationPanelUIDelegate alloc] init]); 1400 [webView setUIDelegate:delegate.get()]; 1401 [webView focus]; 1402 1403 ASSERT_TRUE(addKeyToKeychain(testES256PrivateKeyBase64, "", testUserEntityBundleBase64)); 1404 1405 localAuthenticatorPolicy = _WKLocalAuthenticatorPolicyAllow; 1406 1407 [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]]; 1385 1408 Util::run(&webAuthenticationPanelUpdateLAExcludeCredentialsMatched); 1386 1409 cleanUpKeychain("");
Note:
See TracChangeset
for help on using the changeset viewer.