Changeset 254894 in webkit
- Timestamp:
- Jan 21, 2020 5:25:57 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r254890 r254894 1 2020-01-21 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Incorporate more detailed UnknownError messages for LocalAuthenticator 4 https://bugs.webkit.org/show_bug.cgi?id=191530 5 6 Reviewed by Brent Fulgham. 7 8 * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: 9 1 10 2020-01-21 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html
r250940 r254894 119 119 if (window.internals) 120 120 internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } }); 121 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), " Unknown internal error.");121 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Couldn't attest: The operation couldn't complete."); 122 122 }, "PublicKeyCredential's [[create]] without attestation in a mock local authenticator."); 123 123 … … 141 141 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, userhandleBase64); 142 142 } 143 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), " Unknown internal error.").then(() => {143 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Couldn't attest: The operation couldn't complete.").then(() => { 144 144 if (window.testRunner) 145 145 assert_false(testRunner.keyExistsInKeychain(testRpId, userhandleBase64)); -
trunk/Source/WebKit/ChangeLog
r254892 r254894 1 2020-01-21 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Incorporate more detailed UnknownError messages for LocalAuthenticator 4 https://bugs.webkit.org/show_bug.cgi?id=191530 5 6 Reviewed by Brent Fulgham. 7 8 This patch replaces UnknownError messages within LocalAuthenticator with the LOG_ERROR 9 messages. At the meantime, it enhances MockLocalConnection::getAttestation to return 10 errors instead of assertions. 11 12 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 13 (WebKit::LocalAuthenticator::makeCredential): 14 (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented): 15 (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): 16 (WebKit::LocalAuthenticator::getAssertion): 17 (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): 18 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: 19 (WebKit::MockLocalConnection::getAttestation const): 20 1 21 2020-01-21 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
r253398 r254894 132 132 if (status && status != errSecItemNotFound) { 133 133 LOG_ERROR("Couldn't query Keychain: %d", status); 134 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});134 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't query Keychain: ", status) }); 135 135 return; 136 136 } … … 187 187 OSStatus status = SecItemDelete((__bridge CFDictionaryRef)deleteQuery); 188 188 if (status && status != errSecItemNotFound) { 189 LOG_ERROR("Couldn't de tele older credential: %d", status);190 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});189 LOG_ERROR("Couldn't delete older credential: %d", status); 190 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't delete older credential: ", status) }); 191 191 return; 192 192 } … … 212 212 if (error) { 213 213 LOG_ERROR("Couldn't attest: %@", error); 214 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});214 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't attest: ", String(error.localizedDescription)) }); 215 215 return; 216 216 } … … 250 250 if (status) { 251 251 LOG_ERROR("Couldn't get Credential ID: %d", status); 252 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});252 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't get Credential ID: ", status) }); 253 253 return; 254 254 } … … 275 275 if (status) { 276 276 LOG_ERROR("Couldn't update the Keychain item: %d", status); 277 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});277 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't update the Keychain item: ", status) }); 278 278 return; 279 279 } … … 296 296 if (errorRef) { 297 297 LOG_ERROR("Couldn't export the public key: %@", (NSError*)errorRef); 298 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});298 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't export the public key: ", String(((NSError*)errorRef).localizedDescription)) }); 299 299 return; 300 300 } … … 328 328 if (errorRef) { 329 329 LOG_ERROR("Couldn't generate the signature: %@", (NSError*)errorRef); 330 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});330 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't generate the signature: ", String(((NSError*)errorRef).localizedDescription)) }); 331 331 return; 332 332 } … … 380 380 if (status && status != errSecItemNotFound) { 381 381 LOG_ERROR("Couldn't query Keychain: %d", status); 382 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});382 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't query Keychain: ", status) }); 383 383 return; 384 384 } … … 462 462 if (status) { 463 463 LOG_ERROR("Couldn't get the private key reference: %d", status); 464 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});464 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't get the private key reference: ", status) }); 465 465 return; 466 466 } … … 476 476 if (errorRef) { 477 477 LOG_ERROR("Couldn't generate the signature: %@", (NSError*)errorRef); 478 receiveRespond(ExceptionData { UnknownError, "Unknown internal error."_s});478 receiveRespond(ExceptionData { UnknownError, makeString("Couldn't generate the signature: ", String(((NSError*)errorRef).localizedDescription)) }); 479 479 return; 480 480 } -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
r250940 r254894 74 74 ASSERT(configuration.local); 75 75 if (!configuration.local->acceptAttestation) { 76 callback(NULL, NULL, [NSError errorWithDomain: NSOSStatusErrorDomain code:-1 userInfo:nil]);76 callback(NULL, NULL, [NSError errorWithDomain:@"WebAuthentication" code:-1 userInfo:@{ NSLocalizedDescriptionKey: @"The operation couldn't complete." }]); 77 77 return; 78 78 } … … 90 90 &errorRef 91 91 )); 92 ASSERT(!errorRef); 92 if (errorRef) { 93 callback(NULL, NULL, (NSError *)errorRef); 94 return; 95 } 93 96 94 97 // Mock what DeviceIdentity would do. … … 100 103 }; 101 104 OSStatus status = SecItemAdd((__bridge CFDictionaryRef)addQuery, NULL); 102 ASSERT_UNUSED(status, !status); 105 if (status) { 106 callback(NULL, NULL, [NSError errorWithDomain:@"WebAuthentication" code:status userInfo:@{ NSLocalizedDescriptionKey: @"Couldn't add the key to the keychain." }]); 107 return; 108 } 103 109 104 110 auto attestationCertificate = adoptCF(SecCertificateCreateWithData(NULL, (__bridge CFDataRef)adoptNS([[NSData alloc] initWithBase64EncodedString:configuration.local->userCertificateBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get()));
Note: See TracChangeset
for help on using the changeset viewer.