RESOLVED FIXED 137300
[SOUP] TLS errors should take precedence over HTTP authentication
https://bugs.webkit.org/show_bug.cgi?id=137300
Summary [SOUP] TLS errors should take precedence over HTTP authentication
Carlos Garcia Campos
Reported 2014-10-01 06:24:24 PDT
When not ignoring TLS errors we should fail before showing the HTTP auth dialog in case of invalid certificate. See also https://bugzilla.gnome.org/show_bug.cgi?id=633366
Attachments
Patch (7.20 KB, patch)
2014-10-01 06:29 PDT, Carlos Garcia Campos
svillar: review+
svillar: commit-queue-
Patch (7.74 KB, patch)
2014-10-06 09:09 PDT, Carlos Garcia Campos
svillar: review+
Carlos Garcia Campos
Comment 1 2014-10-01 06:29:12 PDT
Michael Catanzaro
Comment 2 2014-10-01 07:51:02 PDT
I'm not sure if your test works. The server isn't set up to use HTTP authentication; I think you need to add a SoupAuthDomain for "/auth" using soup_server_add_auth_domain().
Carlos Garcia Campos
Comment 3 2014-10-01 08:20:43 PDT
(In reply to comment #2) > I'm not sure if your test works. The server isn't set up to use HTTP authentication; I think you need to add a SoupAuthDomain for "/auth" using soup_server_add_auth_domain(). I wrote the test before the patch, the test does the same than the auth tests
Michael Catanzaro
Comment 4 2014-10-01 08:38:14 PDT
OK, I guess the WWW-Authenticate header is sufficient.
Sergio Villar Senin
Comment 5 2014-10-06 01:05:01 PDT
Comment on attachment 239022 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=239022&action=review The change looks conceptually good to me. I was wondering if it wouldn't be better to listen to tls-errors notifications from the SoupMessage instead of having to handle these things in different parts of our code... > Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:-577 > - if (!response.soupMessageTLSErrors() || gIgnoreSSLErrors) I guess this deserves a comment explaining that in the case of authentication challenge, the response has not been updated with the SoupMessage contents yet. > Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:593 > + handle->client()->didFail(handle, ResourceError::tlsError(d->m_soupRequest.get(), tlsErrors, certificate)); So I guess both soupMessageCertificate() and soupMessageTLSErrors() became unused methods with these changes. Time to remove them?
Carlos Garcia Campos
Comment 6 2014-10-06 02:18:41 PDT
(In reply to comment #5) > (From update of attachment 239022 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=239022&action=review > > The change looks conceptually good to me. I was wondering if it wouldn't be better to listen to tls-errors notifications from the SoupMessage instead of having to handle these things in different parts of our code... Yes, but unfortunately libsoup doesn't emit notify for tls-errors nor flags properties. > > Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:-577 > > - if (!response.soupMessageTLSErrors() || gIgnoreSSLErrors) > > I guess this deserves a comment explaining that in the case of authentication challenge, the response has not been updated with the SoupMessage contents yet. Ok. > > Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp:593 > > + handle->client()->didFail(handle, ResourceError::tlsError(d->m_soupRequest.get(), tlsErrors, certificate)); > > So I guess both soupMessageCertificate() and soupMessageTLSErrors() became unused methods with these changes. Time to remove them? No, those are used by CertificateInfo when created for a ResourceResponse
Sergio Villar Senin
Comment 7 2014-10-06 03:15:20 PDT
Comment on attachment 239022 [details] Patch I'll r+ it now but I'd like to hear Dan's opinion on the matter before landing.
Dan Winship
Comment 8 2014-10-06 06:11:28 PDT
(In reply to comment #6) > (In reply to comment #5) > > The change looks conceptually good to me. I was wondering if it wouldn't be better to listen to tls-errors notifications from the SoupMessage instead of having to handle these things in different parts of our code... > > Yes, but unfortunately libsoup doesn't emit notify for tls-errors nor flags properties. Hm... it's a bug that :flags doesn't get notified when CERTIFICATE_TRUSTED changes. But :tls-errors definitely should be getting notified (and the flags will have already changed at the point when :tls-errors is notified).
Carlos Garcia Campos
Comment 9 2014-10-06 08:59:44 PDT
So, Dan confirmed I was wrong, I was not getting the tls-errors notify signal because I was connecting in request-started and it's too late. But I realized we are connecting to got-headers, that is also emitted before authenticate and tls errors are already set at that point so it looks like a good place to handle TLS errors.
Carlos Garcia Campos
Comment 10 2014-10-06 09:09:54 PDT
Created attachment 239338 [details] Patch Updated patch, now TLS errors are handled in a single place.
Sergio Villar Senin
Comment 11 2014-10-07 00:29:51 PDT
Comment on attachment 239338 [details] Patch Much better now.
Carlos Garcia Campos
Comment 12 2014-10-07 08:49:19 PDT
Note You need to log in before you can comment on or make changes to this bug.