RESOLVED FIXED188592
NetworkCORSPreflightChecker should proceed in case of ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested even though the WebKit app is not implementing the didReceiveAuthenticationChallenge/didReceiveAuthenticationChallengeInFrame callback
https://bugs.webkit.org/show_bug.cgi?id=188592
Summary NetworkCORSPreflightChecker should proceed in case of ProtectionSpaceAuthenti...
youenn fablet
Reported 2018-08-14 16:53:28 PDT
Otherwise the preflight check might hang
Attachments
Patch (4.42 KB, patch)
2018-08-14 17:00 PDT, youenn fablet
no flags
Patch (20.40 KB, patch)
2018-08-15 11:34 PDT, Alex Christensen
no flags
Patch (23.27 KB, patch)
2018-08-15 11:39 PDT, Alex Christensen
no flags
Patch (23.47 KB, patch)
2018-08-15 12:10 PDT, Alex Christensen
no flags
youenn fablet
Comment 1 2018-08-14 16:53:53 PDT
youenn fablet
Comment 2 2018-08-14 17:00:31 PDT
Alex Christensen
Comment 3 2018-08-14 17:04:08 PDT
Comment on attachment 347132 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=347132&action=review > Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:107 > + // FIXME: We should implement PROTECTION_SPACE_AUTH_CALLBACK code path. We most definitely should not. We should deprecate and remove it, not add to it.
Alex Christensen
Comment 4 2018-08-14 17:08:54 PDT
Comment on attachment 347132 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=347132&action=review > Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:109 > + if (disposition == AuthenticationChallengeDisposition::Cancel && weakThis) This feels iffy to me. What about RejectProtectionSpace? > Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:111 > + weakThis->wasBlocked(); > + completionHandler(disposition, credential); This flow is not very clear. Why do we need to call a completionHandler and m_completionCallback, which seem to do separate things?
Chris Dumez
Comment 5 2018-08-14 17:13:10 PDT
Comment on attachment 347132 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=347132&action=review > Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:98 > + completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { }); The changelog says you proceed but here it seems to reject? > Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.h:45 > struct Parameters { I admit, I do not really understand the change. I thought I had re-introduced previous behavior but apparently not?
youenn fablet
Comment 6 2018-08-14 20:45:00 PDT
Comment on attachment 347132 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=347132&action=review >> Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:98 >> + completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { }); > > The changelog says you proceed but here it seems to reject? We reject the protection space, we do not cancel the load. This is what happens for NetworkResourceLoader in NetworkLoad::continueCanAuthenticateAgainstProtectionSpace and what was used before r234626. >> Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:107 >> + // FIXME: We should implement PROTECTION_SPACE_AUTH_CALLBACK code path. > > We most definitely should not. We should deprecate and remove it, not add to it. We should be consistent with NetworkResourceLoader, whatever the code path is. >> Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:109 >> + if (disposition == AuthenticationChallengeDisposition::Cancel && weakThis) > > This feels iffy to me. What about RejectProtectionSpace? This is called for client certificate challenges only. If the result is cancel (which is what happens if the callback is not implemented), we should make sure the preflight checker completion handler is called. Ideally, if the callback is not implemented, it should return something like AuthenticationChallengeDisposition::Default but this is risky to do that change right now. >> Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:111 >> + completionHandler(disposition, credential); > > This flow is not very clear. Why do we need to call a completionHandler and m_completionCallback, which seem to do separate things? They indeed do different things. We need to call completionHandler as it is a CompletionHandler. We need to call m_completionCallback so that the network preflight checker is completed and does not hang. >> Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.h:45 >> struct Parameters { > > I admit, I do not really understand the change. I thought I had re-introduced previous behavior but apparently not? NetworkResourceLoader is using NetworkLoad while NetworkCORSPreflightChecker is using NetworkDataTask. See NetworkLoad::continueCanAuthenticateAgainstProtectionSpace for instance.
youenn fablet
Comment 7 2018-08-15 11:04:34 PDT
> >> Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp:107 > >> + // FIXME: We should implement PROTECTION_SPACE_AUTH_CALLBACK code path. > > > > We most definitely should not. We should deprecate and remove it, not add to it. Discussing with Alex, we will probably go down that way so that even for preflights, the app is notified of this challenge.
Alex Christensen
Comment 8 2018-08-15 11:34:12 PDT
Alex Christensen
Comment 9 2018-08-15 11:39:49 PDT
youenn fablet
Comment 10 2018-08-15 12:02:21 PDT
Comment on attachment 347183 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=347183&action=review > Source/WebKit/NetworkProcess/NetworkProcess.cpp:681 > + m_canAuthenticateAgainstProtectionSpaceCompletionHandlers.set(completionHandlerID, WTFMove(completionHandler)); s/set/add/, could add ASSERT(!contains...) in case we want to be extra sure. id could be an ObjectIdentfiier as well but it is simpler to limit the changes. > Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp:342 > + m_client->didReceiveChallenge(WTFMove(challenge), [this, protectedThis = makeRef(*this), challenge](AuthenticationChallengeDisposition disposition, const Credential& credential) { Probably need to copy internals of challenge, protectionSpace maybe only? > Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp:523 > + m_client->didReceiveChallenge(WTFMove(challenge), [this, protectedThis = makeRef(*this), challenge](AuthenticationChallengeDisposition disposition, const Credential& credential) { Same issue for soup.
Alex Christensen
Comment 11 2018-08-15 12:10:01 PDT
Alex Christensen
Comment 12 2018-08-15 13:16:12 PDT
Ross Kirsling
Comment 13 2018-08-15 13:35:11 PDT
Comment on attachment 347191 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=347191&action=review > Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp:342 > + m_client->didReceiveChallenge(AuthenticationChallenge(challenge), [this, protectedThis = makeRef(*this), ](AuthenticationChallengeDisposition disposition, const Credential& credential) { The syntax error on this line (dangling comma) breaks the WinCairo build.
Ross Kirsling
Comment 14 2018-08-15 17:05:07 PDT
Note You need to log in before you can comment on or make changes to this bug.