WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
189668
Clean up AuthenticationChallengeProxy
https://bugs.webkit.org/show_bug.cgi?id=189668
Summary
Clean up AuthenticationChallengeProxy
Alex Christensen
Reported
2018-09-17 10:52:54 PDT
Clean up AuthenticationChallengeProxy
Attachments
Patch
(37.39 KB, patch)
2018-09-17 10:55 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(41.63 KB, patch)
2018-09-17 11:21 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(41.61 KB, patch)
2018-09-17 12:28 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(41.33 KB, patch)
2018-09-17 13:29 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(41.55 KB, patch)
2018-09-17 13:43 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews106 for mac-sierra-wk2
(3.55 MB, application/zip)
2018-09-17 15:36 PDT
,
EWS Watchlist
no flags
Details
Patch
(43.64 KB, patch)
2018-09-18 11:31 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(43.53 KB, patch)
2018-09-18 12:04 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(43.52 KB, patch)
2018-09-18 12:35 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2018-09-17 10:55:38 PDT
Created
attachment 349905
[details]
Patch
Alex Christensen
Comment 2
2018-09-17 11:21:01 PDT
Created
attachment 349911
[details]
Patch
EWS Watchlist
Comment 3
2018-09-17 11:22:53 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See
http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Alex Christensen
Comment 4
2018-09-17 12:28:28 PDT
Created
attachment 349917
[details]
Patch
Alex Christensen
Comment 5
2018-09-17 13:29:27 PDT
Created
attachment 349932
[details]
Patch
Alex Christensen
Comment 6
2018-09-17 13:43:04 PDT
Created
attachment 349934
[details]
Patch
EWS Watchlist
Comment 7
2018-09-17 15:36:49 PDT
Comment on
attachment 349934
[details]
Patch
Attachment 349934
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/9248186
New failing tests: accessibility/smart-invert-reference.html
EWS Watchlist
Comment 8
2018-09-17 15:36:51 PDT
Created
attachment 349954
[details]
Archive of layout-test-results from ews106 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
Alex Christensen
Comment 9
2018-09-17 17:07:05 PDT
test failure unrelated
youenn fablet
Comment 10
2018-09-17 21:15:49 PDT
Comment on
attachment 349934
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=349934&action=review
> Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp:101 > + challenge->listener().useCredential(WebCredential::create(credential).ptr());
Preexisting code but it seems a bit weird to wrap the WebCore credential into a WebCredential one. Could the listener directly take a WebCore::Credential*? If it exposes this API, I guess WebCredential makes sense. Maybe it could also directly take a WebCore::credential overload.
> Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp:45 > +AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore)
A null connection does not make a lot of sense probably, could be a Connection& probably. Since it is refed by the lambda, it could be made a Ref<>&&.
> Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp:47 > + , m_listener(AuthenticationDecisionListener::create([challengeID, connection = makeRefPtr(connection), secKeyProxyStore = WTFMove(secKeyProxyStore)](AuthenticationChallengeDisposition disposition, WebCredential* credential) {
I am not sure how readable that is to make a big lambda in the constructor. Here it seems to make sense to take a WebCore credential.
> Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp:69 > + }
Previously in the code, if m_secKeyProxyStore is null, we were sending ContinueWithoutCredentialForChallenge. Now we are sending UseCredentialForChallenge even though we might not send the client certificate. Is there no change of behavior? Should we assert that secKeyProxyStore is not null if having ProtectionSpaceAuthenticationSchemeClientCertificateRequested?
> Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp:52 > + if (m_completionHandler)
Can we have normal cases where we would call useCredential() and m_completionHandler be null? Should we assert?
> Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp:53 > + m_completionHandler(AuthenticationChallengeDisposition::UseCredential, credential);
By going with the completion handler, we end-up with an unneeded switch in the completion handler, slight loss of efficiency here. It might be slightly clearer to have a ContinueWithoutCredential in case credential is nullptr, or maybe surface a continueWithoutCredential so that we would pass a Credential& here.
> Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp:59 > + m_completionHandler(AuthenticationChallengeDisposition::Cancel, nullptr);
With Expected<Credential*, Action>, we would not need this nullptr, here and below. But we probably more often end up without credential than with credentials.
> Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h:31 > #include <wtf/RefPtr.h>
Is RefPtr.h include needed?
> Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:39 > +void AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc(IPC::Connection* connection, SecKeyProxyStore& secKeyProxyStore, uint64_t challengeID, const WebCore::Credential& credential)
Connection& probably.
Alex Christensen
Comment 11
2018-09-17 23:00:11 PDT
Comment on
attachment 349934
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=349934&action=review
Thanks for the great review. I'll make this patch even better with this feedback.
>> Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp:69 >> + } > > Previously in the code, if m_secKeyProxyStore is null, we were sending ContinueWithoutCredentialForChallenge. > Now we are sending UseCredentialForChallenge even though we might not send the client certificate. > Is there no change of behavior? Should we assert that secKeyProxyStore is not null if having ProtectionSpaceAuthenticationSchemeClientCertificateRequested?
A SecKeyProxyStore has a lifetime that is tied to the WebsiteDataStore. If there's no SecKeyProxyStore it means we are stopping the entire session, so it doesn't matter what we do because everything is in the process of being cancelled. In this case, using a credential without a SecKeyProxyStore will just cause a different failure right before cancelling. I think this is significantly more elegant than having to capture whether the protection space is a client certificate request and having complex logic here.
>> Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp:53 >> + m_completionHandler(AuthenticationChallengeDisposition::UseCredential, credential); > > By going with the completion handler, we end-up with an unneeded switch in the completion handler, slight loss of efficiency here. > > It might be slightly clearer to have a ContinueWithoutCredential in case credential is nullptr, or maybe surface a continueWithoutCredential so that we would pass a Credential& here.
I plan to get rid of ContinueWithoutCredential and replace it with UseCredentialForChallenge with no credential. This matches the NSURLSession API, and it removes an unnecessary duplicate code path.
Alex Christensen
Comment 12
2018-09-18 11:31:40 PDT
Created
attachment 350034
[details]
Patch
Alex Christensen
Comment 13
2018-09-18 12:04:37 PDT
Created
attachment 350037
[details]
Patch
Alex Christensen
Comment 14
2018-09-18 12:35:42 PDT
Created
attachment 350039
[details]
Patch
Alex Christensen
Comment 15
2018-09-18 13:56:13 PDT
http://trac.webkit.org/r236153
Radar WebKit Bug Importer
Comment 16
2018-09-18 13:57:22 PDT
<
rdar://problem/44574166
>
Jiewen Tan
Comment 17
2018-09-25 12:03:56 PDT
Have done a manual test on tlstestwebkit.org. Doesn't seem to break anything.
youenn fablet
Comment 18
2018-09-26 13:45:33 PDT
This patch seems to break Safari with WebKit nightly builds: - Open a new tab and try loading google.com by clicking an icon: will hang - Open google.com through "Open on new tab" and it will succeed.
youenn fablet
Comment 19
2018-09-26 13:47:51 PDT
(In reply to youenn fablet from
comment #18
)
> This patch seems to break Safari with WebKit nightly builds: > - Open a new tab and try loading google.com by clicking an icon: will hang > - Open google.com through "Open on new tab" and it will succeed.
Tested on High Sierra
youenn fablet
Comment 20
2018-10-02 08:51:37 PDT
(In reply to youenn fablet from
comment #19
)
> (In reply to youenn fablet from
comment #18
) > > This patch seems to break Safari with WebKit nightly builds: > > - Open a new tab and try loading google.com by clicking an icon: will hang > > - Open google.com through "Open on new tab" and it will succeed. > > Tested on High Sierra
Filed
https://bugs.webkit.org/show_bug.cgi?id=190202
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug