Changeset 260322 in webkit


Ignore:
Timestamp:
Apr 18, 2020 2:39:16 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Fix client certificate authentication when using non-default WKWebsiteDataStores
https://bugs.webkit.org/show_bug.cgi?id=210681

Patch by Alex Christensen <achristensen@webkit.org> on 2020-04-18
Reviewed by Brady Eidson.

Source/WebKit:

NetworkProcessProxy was trying to keep a map of WebsiteDataStores, but it wasn't as accurate as the one WebsiteDataStore was maintaining.
Use the latter map instead and client certificate authentication works. Otherwise, the credential isn't serialized correctly.
I found this while working on <rdar://problem/60340449> but this was unrelated so I put it in a different change.
This may fix <rdar://problem/60910392>.

  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:

(TestWebKitAPI::TEST):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r260318 r260322  
     12020-04-18  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix client certificate authentication when using non-default WKWebsiteDataStores
     4        https://bugs.webkit.org/show_bug.cgi?id=210681
     5
     6        Reviewed by Brady Eidson.
     7
     8        NetworkProcessProxy was trying to keep a map of WebsiteDataStores, but it wasn't as accurate as the one WebsiteDataStore was maintaining.
     9        Use the latter map instead and client certificate authentication works.  Otherwise, the credential isn't serialized correctly.
     10        I found this while working on <rdar://problem/60340449> but this was unrelated so I put it in a different change.
     11        This may fix <rdar://problem/60910392>.
     12
     13        * UIProcess/Network/NetworkProcessProxy.cpp:
     14        (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID):
     15
    1162020-04-18  Pablo Saavedra  <psaavedra@igalia.com>
    217
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r260303 r260322  
    8585{
    8686    connect();
    87 
    88     if (auto* websiteDataStore = m_processPool.websiteDataStore())
    89         m_websiteDataStores.set(websiteDataStore->sessionID(), makeRef(*websiteDataStore));
    9087}
    9188
     
    12041201        createSymLinkForFileUpgrade(store->resolvedIndexedDatabaseDirectory());
    12051202#endif
    1206         m_websiteDataStores.set(sessionID, WTFMove(store));
    12071203    }
    12081204}
     
    12121208    if (canSendMessage())
    12131209        send(Messages::NetworkProcess::DestroySession { sessionID }, 0);
    1214     if (!sessionID.isEphemeral())
    1215         m_websiteDataStores.remove(sessionID);
    12161210}
    12171211
    12181212WebsiteDataStore* NetworkProcessProxy::websiteDataStoreFromSessionID(PAL::SessionID sessionID)
    12191213{
    1220     auto iterator = m_websiteDataStores.find(sessionID);
    1221     if (iterator != m_websiteDataStores.end())
    1222         return iterator->value.get();
    1223 
    1224     if (auto* websiteDataStore = m_processPool.websiteDataStore()) {
    1225         if (sessionID == websiteDataStore->sessionID())
    1226             return websiteDataStore;
    1227     }
    1228 
    1229     if (sessionID != PAL::SessionID::defaultSessionID())
    1230         return nullptr;
    1231 
    1232     return WebKit::WebsiteDataStore::defaultDataStore().ptr();
     1214    if (sessionID == PAL::SessionID::defaultSessionID())
     1215        return WebsiteDataStore::defaultDataStore().ptr();
     1216    return WebsiteDataStore::existingNonDefaultDataStoreForSessionID(sessionID);
    12331217}
    12341218
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

    r260303 r260322  
    310310#endif
    311311
    312     HashMap<PAL::SessionID, RefPtr<WebsiteDataStore>> m_websiteDataStores;
    313 
    314312    struct UploadActivity {
    315313        std::unique_ptr<ProcessAssertion> uiAssertion;
  • trunk/Tools/ChangeLog

    r260303 r260322  
     12020-04-18  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix client certificate authentication when using non-default WKWebsiteDataStores
     4        https://bugs.webkit.org/show_bug.cgi?id=210681
     5
     6        Reviewed by Brady Eidson.
     7
     8        * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:
     9        (TestWebKitAPI::TEST):
     10
    1112020-04-17  Kate Cheney  <katherine_cheney@apple.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm

    r260302 r260322  
    496496}
    497497
     498TEST(MultipleClientCertificateConnections, NonPersistentDataStore)
     499{
     500    auto server = clientCertServer();
     501
     502    Vector<RetainPtr<NSString>> methods;
     503    auto delegate = adoptNS([TestNavigationDelegate new]);
     504    delegate.get().didReceiveAuthenticationChallenge = challengeHandler(methods).get();
     505
     506    auto configuration = adoptNS([WKWebViewConfiguration new]);
     507    [configuration setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]];
     508    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
     509    [webView setNavigationDelegate:delegate.get()];
     510    [webView loadRequest:server.request()];
     511    [delegate waitForDidFinishNavigation];
     512    EXPECT_EQ(countClientCertChallenges(methods), 1u);
     513}
     514
    498515#endif // HAVE(NETWORK_FRAMEWORK)
    499516
Note: See TracChangeset for help on using the changeset viewer.