Changeset 230225 in webkit
- Timestamp:
- Apr 3, 2018, 4:50:14 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h (modified) (1 diff)
-
WebCore/Modules/webauthn/cocoa/LocalAuthenticator.mm (modified) (2 diffs)
-
WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm (modified) (5 diffs)
-
WebCore/platform/mac/SSLKeyGeneratorMac.mm (modified) (2 diffs)
-
WebCore/platform/network/mac/ResourceHandleMac.mm (modified) (3 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/cf/ArgumentCodersCF.cpp (modified) (9 diffs)
-
WebKit/Shared/mac/SecItemShim.cpp (modified) (8 diffs)
-
WebKit/WebProcess/cocoa/WebProcessCocoa.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r230224 r230225 1 2018-04-03 Brent Fulgham <bfulgham@apple.com> 2 3 Guard against keychain/certificate access outside the network process 4 https://bugs.webkit.org/show_bug.cgi?id=184214 5 <rdar://problem/38734795> 6 7 Reviewed by Youenn Fablet. 8 9 Use the ProcessPrivilege assertions to guard against accessing the Keychain from 10 a non-Networking process. 11 12 * Modules/webauthn/cocoa/LocalAuthenticator.mm: 13 (WebCore::LocalAuthenticator::makeCredential): Assert if we access the keychain from 14 a proces other than the Network or UI process. 15 (WebCore::LocalAuthenticator::getAssertion): Ditto. 16 (WebCore::LocalAuthenticator::issueClientCertificate const): Ditto. 17 * crypto/mac/SerializedCryptoKeyWrapMac.mm: 18 (WebCore::createAndStoreMasterKey): Ditto. 19 (WebCore::findMasterKey): Ditto. 20 (WebCore::deleteDefaultWebCryptoMasterKey): Ditto. 21 * platform/mac/SSLKeyGeneratorMac.mm: 22 (WebCore::signedPublicKeyAndChallengeString): Ditto. 23 * platform/network/cocoa/NetworkStorageSessionCocoa.mm: 24 (WebCore::createPrivateStorageSession): Ditto. 25 * platform/network/mac/ResourceHandleMac.mm: 26 (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Ditto. 27 1 28 2018-04-03 Youenn Fablet <youenn@apple.com> 2 29 -
trunk/Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h
r230012 r230225 48 48 WTF_MAKE_NONCOPYABLE(LocalAuthenticator); 49 49 public: 50 LocalAuthenticator() = default;50 LocalAuthenticator(); 51 51 virtual ~LocalAuthenticator() = default; 52 52 -
trunk/Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.mm
r230012 r230225 40 40 #import <wtf/HashSet.h> 41 41 #import <wtf/MainThread.h> 42 #import <wtf/ProcessPrivilege.h> 42 43 #import <wtf/RetainPtr.h> 43 44 #import <wtf/Vector.h> … … 109 110 110 111 } // LocalAuthenticatorInternal 112 113 LocalAuthenticator::LocalAuthenticator() 114 { 115 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 116 } 111 117 112 118 void LocalAuthenticator::makeCredential(const Vector<uint8_t>& hash, const PublicKeyCredentialCreationOptions& options, CreationCallback&& callback, ExceptionCallback&& exceptionCallback) -
trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm
r226483 r230225 1 1 /* 2 * Copyright (C) 2014 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2014-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 #include <wtf/text/CString.h> 37 37 #include <wtf/CryptographicUtilities.h> 38 #include <wtf/ProcessPrivilege.h> 38 39 #include <wtf/RetainPtr.h> 39 40 … … 81 82 static bool createAndStoreMasterKey(Vector<uint8_t>& masterKeyData) 82 83 { 84 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 85 83 86 masterKeyData.resize(masterKeySizeInBytes); 84 87 int rc = CCRandomCopyBytes(kCCRandomDefault, masterKeyData.data(), masterKeyData.size()); … … 152 155 static bool findMasterKey(Vector<uint8_t>& masterKeyData) 153 156 { 157 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 158 154 159 NSDictionary *query = @{ 155 160 (id)kSecClass : (id)kSecClassGenericPassword, … … 181 186 bool deleteDefaultWebCryptoMasterKey() 182 187 { 188 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 189 183 190 NSDictionary *query = @{ 184 191 (id)kSecClass : (id)kSecClassGenericPassword, -
trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm
r228531 r230225 1 1 /* 2 * Copyright (C) 2003 , 2005, 2008, 2011Apple Inc. All rights reserved.2 * Copyright (C) 2003-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 #import <Security/SecAsn1Templates.h> 35 35 #import <Security/SecEncodeTransform.h> 36 #import <wtf/ProcessPrivilege.h> 36 37 #import <wtf/RetainPtr.h> 37 38 #import <wtf/Scope.h> -
trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
r229977 r230225 1 1 /* 2 * Copyright (C) 2004-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2004-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 51 51 #import <wtf/BlockObjCExceptions.h> 52 52 #import <wtf/CompletionHandler.h> 53 #import <wtf/ProcessPrivilege.h> 53 54 #import <wtf/Ref.h> 54 55 #import <wtf/SchedulePair.h> … … 496 497 // return NO to -connectionShouldUseCredentialStorage: for <rdar://problem/7704943>. 497 498 if (!challenge.previousFailureCount() && challenge.protectionSpace().isProxy()) { 499 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 498 500 NSURLAuthenticationChallenge *macChallenge = mac(challenge); 499 501 if (NSURLCredential *credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:[macChallenge protectionSpace]]) { -
trunk/Source/WebKit/ChangeLog
r230224 r230225 1 2018-04-03 Brent Fulgham <bfulgham@apple.com> 2 3 Guard against keychain/certificate access outside the network process 4 https://bugs.webkit.org/show_bug.cgi?id=184214 5 <rdar://problem/38734795> 6 7 Reviewed by Youenn Fablet. 8 9 Use the ProcessPrivilege assertions to guard against accessing the Keychain from 10 a non-Networking process. 11 12 * Shared/cf/ArgumentCodersCF.cpp: 13 (IPC::encode): Assert if we access the keychain from a proces other than the Network or UI process. 14 (IPC::decode): Ditto. 15 1 16 2018-04-03 Youenn Fablet <youenn@apple.com> 2 17 -
trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp
r226499 r230225 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #include "Encoder.h" 32 32 #include <WebCore/CFURLExtras.h> 33 #include <wtf/ProcessPrivilege.h> 33 34 #include <wtf/Vector.h> 34 35 #include <wtf/spi/cocoa/SecuritySPI.h> … … 645 646 static CFDataRef copyPersistentRef(SecKeyRef key) 646 647 { 648 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 647 649 // This function differs from SecItemCopyPersistentRef in that it specifies an access group. 648 650 // This is necessary in case there are multiple copies of the key in the keychain, because we … … 675 677 #endif 676 678 #if PLATFORM(MAC) 679 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 677 680 SecKeychainItemCreatePersistentReference((SecKeychainItemRef)key, &keyData); 678 681 #endif … … 688 691 bool decode(Decoder& decoder, RetainPtr<SecIdentityRef>& result) 689 692 { 693 #if PLATFORM(COCOA) 694 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 695 #endif 696 690 697 RetainPtr<SecCertificateRef> certificate; 691 698 if (!decode(decoder, certificate)) … … 722 729 void encode(Encoder& encoder, SecKeychainItemRef keychainItem) 723 730 { 731 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 732 724 733 CFDataRef data; 725 734 if (SecKeychainItemCreatePersistentReference(keychainItem, &data) == errSecSuccess) { … … 731 740 bool decode(Decoder& decoder, RetainPtr<SecKeychainItemRef>& result) 732 741 { 742 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 743 733 744 RetainPtr<CFDataRef> data; 734 745 if (!IPC::decode(decoder, data)) … … 747 758 void encode(Encoder& encoder, SecAccessControlRef accessControl) 748 759 { 760 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 749 761 RetainPtr<CFDataRef> data = adoptCF(SecAccessControlCopyData(accessControl)); 750 762 if (data) … … 754 766 bool decode(Decoder& decoder, RetainPtr<SecAccessControlRef>& result) 755 767 { 768 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 756 769 RetainPtr<CFDataRef> data; 757 770 if (!decode(decoder, data)) -
trunk/Source/WebKit/Shared/mac/SecItemShim.cpp
r219595 r230225 1 1 /* 2 * Copyright (C) 2011 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 39 39 #include <dlfcn.h> 40 40 #include <mutex> 41 #include <wtf/ProcessPrivilege.h> 41 42 42 43 #if USE(APPLE_INTERNAL_SDK) … … 73 74 static std::optional<SecItemResponseData> sendSecItemRequest(SecItemRequestData::Type requestType, CFDictionaryRef query, CFDictionaryRef attributesToMatch = 0) 74 75 { 76 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 77 75 78 std::optional<SecItemResponseData> response; 76 79 … … 91 94 static OSStatus webSecItemCopyMatching(CFDictionaryRef query, CFTypeRef* result) 92 95 { 96 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 93 97 auto response = sendSecItemRequest(SecItemRequestData::CopyMatching, query); 94 98 if (!response) … … 101 105 static OSStatus webSecItemAdd(CFDictionaryRef query, CFTypeRef* result) 102 106 { 107 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 103 108 auto response = sendSecItemRequest(SecItemRequestData::Add, query); 104 109 if (!response) … … 112 117 static OSStatus webSecItemUpdate(CFDictionaryRef query, CFDictionaryRef attributesToUpdate) 113 118 { 119 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 114 120 auto response = sendSecItemRequest(SecItemRequestData::Update, query, attributesToUpdate); 115 121 if (!response) … … 121 127 static OSStatus webSecItemDelete(CFDictionaryRef query) 122 128 { 129 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 123 130 auto response = sendSecItemRequest(SecItemRequestData::Delete, query); 124 131 if (!response) … … 130 137 void initializeSecItemShim(ChildProcess& process) 131 138 { 139 RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessCredentials)); 132 140 sharedProcess = &process; 133 141 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r229878 r230225 34 34 #import "SandboxExtension.h" 35 35 #import "SandboxInitializationParameters.h" 36 #import "SecItemShim.h"37 36 #import "SessionTracker.h" 38 37 #import "WKAPICast.h" … … 305 304 registerWithStateDumper(); 306 305 #endif 307 308 #if ENABLE(SEC_ITEM_SHIM)309 initializeSecItemShim(*this);310 #endif311 306 } 312 307
Note:
See TracChangeset
for help on using the changeset viewer.