Skip to content
Permalink
Browse files
Fix issue where WebAuth timeouts lead to an incorrect error
https://bugs.webkit.org/show_bug.cgi?id=249612
rdar://100825830

Reviewed by J Pascoe.

This corrects an issue where we unconditionally return a
WKErrorUnknown. This later leads to other issues when we
cast this error back to a WebCore::ExceptionCode, resulting
in an unrelated error being thrown.

* Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel getAssertionWithChallenge:origin:options:completionHandler:]):
(-[_WKWebAuthenticationPanel getAssertionWithMediationRequirement:clientDataHash:options:completionHandler:]):

Canonical link: https://commits.webkit.org/258116@main
  • Loading branch information
charliewolfe authored and johnwilander committed Dec 20, 2022
1 parent 03b0d03 commit 56aa37f2fb910067390d664215376202a81cf464
Showing 1 changed file with 2 additions and 2 deletions.
@@ -1044,7 +1044,7 @@ - (void)getAssertionWithChallenge:(NSData *)challenge origin:(NSString *)origin
WTF::switchOn(result, [&](const Ref<WebCore::AuthenticatorResponse>& response) {
handler(wkAuthenticatorAssertionResponse(response->data(), clientDataJSON.get(), response->attachment()).get(), nil);
}, [&](const WebCore::ExceptionData& exception) {
handler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:nil]);
handler(nil, [NSError errorWithDomain:WKErrorDomain code:exception.code userInfo:@{ NSLocalizedDescriptionKey: exception.message }]);
});
};
_panel->handleRequest({ WTFMove(hash), [_WKWebAuthenticationPanel convertToCoreRequestOptionsWithOptions:options], nullptr, WebKit::WebAuthenticationPanelResult::Unavailable, nullptr, std::nullopt, { }, true, String(), nullptr, std::nullopt, std::nullopt }, WTFMove(callback));
@@ -1058,7 +1058,7 @@ - (void)getAssertionWithMediationRequirement:(_WKWebAuthenticationMediationRequi
WTF::switchOn(result, [&](const Ref<WebCore::AuthenticatorResponse>& response) {
handler(wkAuthenticatorAssertionResponse(response->data(), nullptr, response->attachment()).get(), nil);
}, [&](const WebCore::ExceptionData& exception) {
handler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:nil]);
handler(nil, [NSError errorWithDomain:WKErrorDomain code:exception.code userInfo:@{ NSLocalizedDescriptionKey: exception.message }]);
});
};
_panel->handleRequest({ vectorFromNSData(clientDataHash), [_WKWebAuthenticationPanel convertToCoreRequestOptionsWithOptions:options], nullptr, WebKit::WebAuthenticationPanelResult::Unavailable, nullptr, std::nullopt, { }, true, String(), nullptr, toWebCore(mediation), std::nullopt }, WTFMove(callback));

0 comments on commit 56aa37f

Please sign in to comment.