Changeset 171066 in webkit


Ignore:
Timestamp:
Jul 14, 2014 9:17:26 AM (10 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/17657391> [iOS] Networking process writes persistent credentials to the keychain
https://bugs.webkit.org/show_bug.cgi?id=134878

Reviewed by Sam Weinig.

Route CFNetwork’s calls to Security API through to the UI process.

  • NetworkProcess/ios/NetworkProcessIOS.mm:

(WebKit::NetworkProcess::platformInitializeNetworkProcess): Initialize SecItemShim.

  • Shared/mac/SecItemShim.cpp:

(WebKit::SecItemShim::initialize): On iOS, rather than using a shim library, supply
CFNetwork with alternate functions to call.

  • Shared/mac/SecItemShim.messages.in: Removed #if !PLATFORM(IOS).
  • UIProcess/mac/SecItemShimProxy.messages.in: Ditto.
  • config.h: Define ENABLE_SEC_ITEM_SHIM to 1 on iOS as well.
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r171061 r171066  
     12014-07-14  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/17657391> [iOS] Networking process writes persistent credentials to the keychain
     4        https://bugs.webkit.org/show_bug.cgi?id=134878
     5
     6        Reviewed by Sam Weinig.
     7
     8        Route CFNetwork’s calls to Security API through to the UI process.
     9
     10        * NetworkProcess/ios/NetworkProcessIOS.mm:
     11        (WebKit::NetworkProcess::platformInitializeNetworkProcess): Initialize SecItemShim.
     12
     13        * Shared/mac/SecItemShim.cpp:
     14        (WebKit::SecItemShim::initialize): On iOS, rather than using a shim library, supply
     15        CFNetwork with alternate functions to call.
     16
     17        * Shared/mac/SecItemShim.messages.in: Removed #if !PLATFORM(IOS).
     18        * UIProcess/mac/SecItemShimProxy.messages.in: Ditto.
     19
     20        * config.h: Define ENABLE_SEC_ITEM_SHIM to 1 on iOS as well.
     21
    1222014-07-14  Dan Bernstein  <mitz@apple.com>
    223
  • trunk/Source/WebKit2/NetworkProcess/ios/NetworkProcessIOS.mm

    r169533 r171066  
    3131#import "NetworkProcessCreationParameters.h"
    3232#import "SandboxInitializationParameters.h"
     33#import "SecItemShim.h"
    3334#import <WebCore/CertificateInfo.h>
    3435#import <WebCore/NotImplemented.h>
     
    8081void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
    8182{
     83#if ENABLE(SEC_ITEM_SHIM)
     84    SecItemShim::shared().initialize(this);
     85#endif
    8286    platformInitializeNetworkProcessCocoa(parameters);
    8387}
  • trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp

    r169518 r171066  
    4141#include <mutex>
    4242#include <wtf/NeverDestroyed.h>
     43
     44#if __has_include(<CFNetwork/CFURLConnectionPriv.h>)
     45#include <CFNetwork/CFURLConnectionPriv.h>
     46#else
     47struct _CFNFrameworksStubs {
     48    CFIndex version;
     49
     50    OSStatus (*SecItem_stub_CopyMatching)(CFDictionaryRef query, CFTypeRef *result);
     51    OSStatus (*SecItem_stub_Add)(CFDictionaryRef attributes, CFTypeRef *result);
     52    OSStatus (*SecItem_stub_Update)(CFDictionaryRef query, CFDictionaryRef attributesToUpdate);
     53    OSStatus (*SecItem_stub_Delete)(CFDictionaryRef query);
     54};
     55#endif
     56
     57extern "C" void _CFURLConnectionSetFrameworkStubs(const struct _CFNFrameworksStubs* stubs);
    4358
    4459namespace WebKit {
     
    137152    sharedProcess = process;
    138153
     154#if PLATFORM(IOS)
     155    struct _CFNFrameworksStubs stubs = {
     156        .version = 0,
     157        .SecItem_stub_CopyMatching = webSecItemCopyMatching,
     158        .SecItem_stub_Add = webSecItemAdd,
     159        .SecItem_stub_Update = webSecItemUpdate,
     160        .SecItem_stub_Delete = webSecItemDelete,
     161    };
     162
     163    _CFURLConnectionSetFrameworkStubs(&stubs);
     164#endif
     165
     166#if PLATFORM(MAC)
    139167    const SecItemShimCallbacks callbacks = {
    140168        webSecItemCopyMatching,
     
    146174    SecItemShimInitializeFunc func = reinterpret_cast<SecItemShimInitializeFunc>(dlsym(RTLD_DEFAULT, "WebKitSecItemShimInitialize"));
    147175    func(callbacks);
     176#endif
    148177}
    149178
  • trunk/Source/WebKit2/Shared/mac/SecItemShim.messages.in

    r160117 r171066  
    2121# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2222
    23 #if !PLATFORM(IOS)
    2423messages -> SecItemShim {
    2524
     
    2928
    3029}
    31 #endif
  • trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.messages.in

    r160117 r171066  
    2121# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2222
    23 #if !PLATFORM(IOS)
    2423messages -> SecItemShimProxy {
    2524
     
    2928
    3029}
    31 #endif
  • trunk/Source/WebKit2/config.h

    r171060 r171066  
    7676
    7777#ifndef ENABLE_SEC_ITEM_SHIM
    78 #if PLATFORM(MAC)
     78#if PLATFORM(MAC) || PLATFORM(IOS)
    7979#define ENABLE_SEC_ITEM_SHIM 1
    8080#endif
Note: See TracChangeset for help on using the changeset viewer.