⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269162 in webkit


Ignore:
Timestamp:
Oct 29, 2020, 1:20:28 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Don't look in the keychain for a preferred client certificate in the network process
https://bugs.webkit.org/show_bug.cgi?id=218322
<rdar://problem/64931374>

Patch by Alex Christensen <achristensen@webkit.org> on 2020-10-29
Reviewed by Geoffrey Garen.

Often, based on a race condition of preconnecting to a server we have just been told to load and
the use of Safari's BackgroundLoad class when navigating to a page we have not received any data from yet,
and with an installed client certificate and an identity preference in the keychain, the user will be asked
if com.apple.WebKit.Networking can access a private key in the keychain instead of if Safari can access a
private key in the keychain. If the user types in the password and clicks "Always Allow" this does not make
it always allowed, but it would have if Safari had asked instead of com.apple.WebKit.Networking.
This is because Safari is responding to WKNavigationDelegate's didReceiveAuthenticationChallenge with
NSURLSessionAuthChallengeUseCredential and nil, which would cause CFNetwork to search in the keychain as the network
process for the preferred client certificate. What we want Safari's network process to do is not search in the keychain
for this preconnect request's challenge but wait until the actual request, at which time Safari will use its proper logic
to find the correct client certificate and AuthenticationManager::initializeConnection will create a SecKeyProxy
to do the signing in the UI process. Third party applications will not be affected because the SecKeyProxy path is the
only one that works for applications lacking Safari's entitlements. I used the steps in the radar to verify that this
is fixed. Unfortunately, it is not practical to make a unit test that installs a system client certificate and an
identity preference because doing so would require the entry of the login keychain password while running the unit test.

  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::configurationForSessionID):
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r269159 r269162  
     12020-10-29  Alex Christensen  <achristensen@webkit.org>
     2
     3        Don't look in the keychain for a preferred client certificate in the network process
     4        https://bugs.webkit.org/show_bug.cgi?id=218322
     5        <rdar://problem/64931374>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Often, based on a race condition of preconnecting to a server we have just been told to load and
     10        the use of Safari's BackgroundLoad class when navigating to a page we have not received any data from yet,
     11        and with an installed client certificate and an identity preference in the keychain, the user will be asked
     12        if com.apple.WebKit.Networking can access a private key in the keychain instead of if Safari can access a
     13        private key in the keychain.  If the user types in the password and clicks "Always Allow" this does not make
     14        it always allowed, but it would have if Safari had asked instead of com.apple.WebKit.Networking.
     15        This is because Safari is responding to WKNavigationDelegate's didReceiveAuthenticationChallenge with
     16        NSURLSessionAuthChallengeUseCredential and nil, which would cause CFNetwork to search in the keychain as the network
     17        process for the preferred client certificate.  What we want Safari's network process to do is not search in the keychain
     18        for this preconnect request's challenge but wait until the actual request, at which time Safari will use its proper logic
     19        to find the correct client certificate and AuthenticationManager::initializeConnection will create a SecKeyProxy
     20        to do the signing in the UI process.  Third party applications will not be affected because the SecKeyProxy path is the
     21        only one that works for applications lacking Safari's entitlements.  I used the steps in the radar to verify that this
     22        is fixed.  Unfortunately, it is not practical to make a unit test that installs a system client certificate and an
     23        identity preference because doing so would require the entry of the login keychain password while running the unit test.
     24
     25        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     26        (WebKit::configurationForSessionID):
     27        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
     28
    1292020-10-29  Said Abou-Hallawa  <said@apple.com>
    230
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r268261 r269162  
    10471047    if (session.isEphemeral()) {
    10481048        configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
    1049         configuration._shouldSkipPreferredClientCertificateLookup = YES;
    10501049#if HAVE(LOGGING_PRIVACY_LEVEL) && defined(NW_CONTEXT_HAS_PRIVACY_LEVEL_SILENT)
    10511050        loggingPrivacyLevel = nw_context_privacy_level_silent;
     
    10531052    } else
    10541053        configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
     1054    configuration._shouldSkipPreferredClientCertificateLookup = YES;
    10551055
    10561056#if HAVE(LOGGING_PRIVACY_LEVEL)
     
    12981298
    12991299    configuration.URLCredentialStorage = nil;
    1300     configuration._shouldSkipPreferredClientCertificateLookup = YES;
    13011300    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=177394
    13021301    // configuration.HTTPCookieStorage = nil;
Note: See TracChangeset for help on using the changeset viewer.