Changeset 223889 in webkit
- Timestamp:
- Oct 24, 2017 9:21:36 AM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223887 r223889 1 2017-10-24 Brent Fulgham <bfulgham@apple.com> 2 3 Adopt new secure coding APIs 4 https://bugs.webkit.org/show_bug.cgi?id=178484 5 <rdar://problem/34837193> 6 7 Reviewed by Tim Horton. 8 9 Switch to new NSKeyed[Un]Archiver methods that active and use 10 NSSecureCoding by default. 11 12 Most of the new API is wrapped in a set of convenience methods so we can 13 build without the new API on older systems. 14 15 No change in behavior. 16 17 * editing/cocoa/EditorCocoa.mm: 18 (WebCore::archivedDataForAttributedString): Use new convenience method 19 to archive the string object. 20 * loader/archive/cf/LegacyWebArchiveMac.mm: 21 (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to 22 use secure coding where possible. 23 (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto. 24 * platform/ios/PlatformPasteboardIOS.mm: 25 (WebCore::PlatformPasteboard::write): Use new secure API. 26 (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto. 27 * testing/cocoa/WebArchiveDumpSupport.mm: 28 (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to 29 secure coding API where possible. 30 1 31 2017-10-24 Miguel Gomez <magomez@igalia.com> 2 32 -
trunk/Source/WebCore/PAL/ChangeLog
r223791 r223889 1 2017-10-24 Brent Fulgham <bfulgham@apple.com> 2 3 Adopt new secure coding APIs 4 https://bugs.webkit.org/show_bug.cgi?id=178484 5 <rdar://problem/34837193> 6 7 Reviewed by Tim Horton. 8 9 Add new convenience methods (and SPI headers) so we can adopt new NSKeyedArchiver 10 API that uses secure coding by default. 11 12 * PAL.xcodeproj/project.pbxproj: 13 * pal/spi/cocoa/NSKeyedArchiverSPI.h: Added. 14 (securelyArchivedDataWithRootObject): New convenience method. 15 (securelyUnarchiveRootObjectOfClassFromData): Ditto. 16 (secureArchiverFromMutableData): Ditto. 17 (secureUnarchiverFromData): Ditto. 18 1 19 2017-10-20 Alex Christensen <achristensen@webkit.org> 2 20 -
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
r223206 r223889 109 109 1C4876D91F8D7F4E00CCEEBD /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4876D71F8D7F4E00CCEEBD /* Logging.h */; }; 110 110 1C4876E01F8D837500CCEEBD /* LoggingCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C4876DF1F8D837500CCEEBD /* LoggingCocoa.mm */; }; 111 7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; }; 111 112 A10265871F56746100B4C844 /* FoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265861F56746100B4C844 /* FoundationSPI.h */; }; 112 113 A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265881F56747A00B4C844 /* HIToolboxSPI.h */; }; … … 250 251 1C67CEA11E32EDA800F80F2E /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; }; 251 252 1C67CEA21E32EE2600F80F2E /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; }; 253 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKeyedArchiverSPI.h; sourceTree = "<group>"; }; 252 254 A10265861F56746100B4C844 /* FoundationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FoundationSPI.h; sourceTree = "<group>"; }; 253 255 A10265881F56747A00B4C844 /* HIToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIToolboxSPI.h; sourceTree = "<group>"; }; … … 363 365 0C2DA1321F3BEB4900DBC317 /* NSExtensionSPI.h */, 364 366 0C2DA1331F3BEB4900DBC317 /* NSFileManagerSPI.h */, 367 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */, 365 368 0C2DA1341F3BEB4900DBC317 /* NSStringSPI.h */, 366 369 0C2DA1351F3BEB4900DBC317 /* NSTouchBarSPI.h */, … … 651 654 A10826FE1F58A433004772AC /* NSGraphicsSPI.h in Headers */, 652 655 0C7785911F45130F00F4EBB6 /* NSImmediateActionGestureRecognizerSPI.h in Headers */, 656 7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */, 653 657 0C7785921F45130F00F4EBB6 /* NSMenuSPI.h in Headers */, 654 658 0C7785931F45130F00F4EBB6 /* NSPasteboardSPI.h in Headers */, -
trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm
r223678 r223889 53 53 #import "markup.h" 54 54 #import <pal/spi/cocoa/NSAttributedStringSPI.h> 55 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 55 56 #import <wtf/BlockObjCExceptions.h> 56 57 … … 142 143 return nullptr; 143 144 144 return SharedBuffer::create( [NSKeyedArchiver archivedDataWithRootObject:attributedString]);145 return SharedBuffer::create(securelyArchivedDataWithRootObject(attributedString)); 145 146 } 146 147 -
trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm
r222779 r223889 27 27 */ 28 28 29 #include "config.h" 30 #include "LegacyWebArchive.h" 29 #import "config.h" 30 #import "LegacyWebArchive.h" 31 32 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 31 33 32 34 namespace WebCore { … … 43 45 44 46 NSURLResponse *response = nil; 45 NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]; 47 auto unarchiver = secureUnarchiverFromData((NSData *)responseData); 48 @try { 46 49 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS) 47 // Because of <rdar://problem/34063313> we can't use this for decoding in older OS's.48 [unarchiver setRequiresSecureCoding:YES];49 @try {50 50 response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:LegacyWebArchiveResourceResponseKey]; 51 51 #else 52 @try { 52 // Because of <rdar://problem/34063313> we can't use secure coding for decoding in older OS's. 53 [unarchiver setRequiresSecureCoding:NO]; 53 54 id responseObject = [unarchiver decodeObjectForKey:LegacyWebArchiveResourceResponseKey]; 54 55 if ([responseObject isKindOfClass:[NSURLResponse class]]) … … 60 61 response = nil; 61 62 } 62 [unarchiver release]; 63 63 64 64 return ResourceResponse(response); 65 65 } … … 74 74 CFMutableDataRef responseData = CFDataCreateMutable(0, 0); 75 75 76 NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:(NSMutableData *)responseData];76 auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:(NSMutableData *)responseData]); 77 77 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS) 78 78 // Because of <rdar://problem/34063313> we can't use this for encoding in older OS's. … … 81 81 [archiver encodeObject:nsResponse forKey:LegacyWebArchiveResourceResponseKey]; 82 82 [archiver finishEncoding]; 83 [archiver release]; 84 83 85 84 return adoptCF(responseData); 86 85 } -
trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
r223678 r223889 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 #import <UIKit/UIImage.h> 38 38 #import <UIKit/UIPasteboard.h> 39 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 39 40 #import <pal/spi/ios/UIKitSPI.h> 40 41 #import <wtf/ListHashSet.h> … … 265 266 266 267 if (content.dataInAttributedStringFormat) { 267 NSAttributedString *attributedString = [NSKeyedUnarchiver unarchiveObjectWithData:content.dataInAttributedStringFormat->createNSData().get()];268 NSAttributedString *attributedString = securelyUnarchiveObjectOfClassFromData([NSAttributedString class], content.dataInAttributedStringFormat->createNSData().get()); 268 269 if (attributedString) 269 270 [representationsToRegister addRepresentingObject:attributedString]; … … 380 381 continue; 381 382 382 id teamDataObject = [NSKeyedUnarchiver unarchiveObjectWithData:provider.teamData];383 if (!teamDataObject || ![teamDataObject isKindOfClass:[NSDictionary class]])384 continue; 385 386 id originInTeamData = [ (NSDictionary *)teamDataObject objectForKey:@(originKeyForTeamData)];383 NSDictionary *teamDataObject = securelyUnarchiveObjectOfClassFromData([NSDictionary class], provider.teamData); 384 if (!teamDataObject) 385 continue; 386 387 id originInTeamData = [teamDataObject objectForKey:@(originKeyForTeamData)]; 387 388 if (![originInTeamData isKindOfClass:[NSString class]]) 388 389 continue; … … 445 446 for (auto& type : data.orderedTypes) 446 447 [typesAsNSArray addObject:type]; 447 [representationsToRegister setTeamData:[NSKeyedArchiver archivedDataWithRootObject:@{ 448 @(originKeyForTeamData) : data.origin, @(customTypesKeyForTeamData) : typesAsNSArray }]]; 448 [representationsToRegister setTeamData:securelyArchivedDataWithRootObject(@{ @(originKeyForTeamData) : data.origin, @(customTypesKeyForTeamData) : typesAsNSArray })]; 449 449 [representationsToRegister addData:serializedSharedBuffer.get() forType:@(PasteboardCustomData::cocoaType())]; 450 450 } -
trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm
r222786 r223889 31 31 #import <CFNetwork/CFNetwork.h> 32 32 #import <pal/spi/cf/CFNetworkSPI.h> 33 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 33 34 #import <wtf/NeverDestroyed.h> 34 35 #import <wtf/RetainPtr.h> … … 41 42 static CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData) 42 43 { 43 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);44 44 NSURLResponse *response; 45 auto unarchiver = secureUnarchiverFromData((NSData *)responseData); 46 @try { 45 47 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS) 46 // Because of <rdar://problem/34063313> we can't use this for decoding in older OS's.47 [unarchiver setRequiresSecureCoding:YES];48 @try {49 48 response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m 50 49 #else 51 @try { 50 // Because of <rdar://problem/34063313> we can't use secure coding for decoding in older OS's. 51 [unarchiver setRequiresSecureCoding:NO]; 52 52 response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m 53 53 #endif -
trunk/Source/WebKit/ChangeLog
r223884 r223889 1 2017-10-24 Brent Fulgham <bfulgham@apple.com> 2 3 Adopt new secure coding APIs 4 https://bugs.webkit.org/show_bug.cgi?id=178484 5 <rdar://problem/34837193> 6 7 Reviewed by Tim Horton. 8 9 Switch to new NSKeyed[Un]Archiver methods that active and use 10 NSSecureCoding by default. 11 12 * Platform/ios/AccessibilityIOS.mm: 13 (WebKit::newAccessibilityRemoteToken): Use secure-by-default API. 14 * Shared/Cocoa/DataDetectionResult.mm: 15 (WebKit::DataDetectionResult::encode const): Ditto. 16 (WebKit::DataDetectionResult::decode): Ditto. 17 * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: 18 (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto. 19 (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto. 20 (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto. 21 (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto. 22 (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto. 23 (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto. 24 (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto. 25 (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto. 26 * Shared/ios/InteractionInformationAtPosition.mm: 27 (WebKit::InteractionInformationAtPosition::encode const): Ditto. 28 (WebKit::InteractionInformationAtPosition::decode): Ditto. 29 * Shared/mac/WebCoreArgumentCodersMac.mm: 30 (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto. 31 (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto. 32 (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto. 33 (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto. 34 (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto. 35 (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto. 36 (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto. 37 (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto. 38 * Shared/mac/WebHitTestResultData.mm: 39 (WebKit::WebHitTestResultData::platformEncode const): Ditto. 40 (WebKit::WebHitTestResultData::platformDecode): Ditto. 41 * UIProcess/API/Cocoa/WKProcessPool.mm: 42 (-[WKProcessPool _setObject:forBundleParameter:]): Ditto. 43 (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto. 44 * UIProcess/API/Cocoa/WKWebView.mm: 45 (-[WKWebView _setInputDelegate:]): Ditto. 46 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 47 (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto. 48 * UIProcess/ios/PageClientImplIOS.mm: 49 (WebKit::PageClientImpl::startAssistingNode): Ditto. 50 * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: 51 (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto. 52 * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: 53 (WebKit::InjectedBundle::initialize): Ditto. 54 (WebKit::InjectedBundle::setBundleParameter): Ditto. 55 (WebKit::InjectedBundle::setBundleParameters): Ditto. 56 1 57 2017-10-24 Zan Dobersek <zdobersek@igalia.com> 2 58 -
trunk/Source/WebKit/Platform/ios/AccessibilityIOS.mm
r191904 r223889 26 26 #import "config.h" 27 27 #import "AccessibilityIOS.h" 28 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 28 29 29 30 #if PLATFORM(IOS) … … 35 36 if (!uuid) 36 37 return nil; 37 return [NSKeyedArchiver archivedDataWithRootObject:@{ @"ax-pid" : @(getpid()), @"ax-uuid" : [uuid UUIDString], @"ax-register" : @YES }];38 return securelyArchivedDataWithRootObject(@{ @"ax-pid" : @(getpid()), @"ax-uuid" : [uuid UUIDString], @"ax-register" : @YES }); 38 39 } 39 40 -
trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm
r220506 r223889 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #import "WebCoreArgumentCoders.h" 31 31 #import <pal/spi/cocoa/DataDetectorsCoreSPI.h> 32 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 32 33 #import <wtf/SoftLinking.h> 33 34 … … 42 43 { 43 44 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 44 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 45 [archiver setRequiresSecureCoding:YES]; 45 auto archiver = secureArchiverFromMutableData(data.get()); 46 46 [archiver encodeObject:results.get() forKey:@"dataDetectorResults"]; 47 47 [archiver finishEncoding]; … … 55 55 if (!IPC::decode(decoder, data)) 56 56 return false; 57 58 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 59 [unarchiver setRequiresSecureCoding:YES]; 57 58 auto unarchiver = secureUnarchiverFromData((NSData *)data.get()); 60 59 @try { 61 60 result.results = [unarchiver decodeObjectOfClasses:[NSSet setWithArray:@[ [NSArray class], getDDScannerResultClass()] ] forKey:@"dataDetectorResults"]; -
trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
r222584 r223889 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #import "DataReference.h" 32 32 #import <WebCore/PaymentAuthorizationStatus.h> 33 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 33 34 #import <pal/spi/cocoa/PassKitSPI.h> 34 35 #import <wtf/SoftLinking.h> … … 52 53 { 53 54 auto data = adoptNS([[NSMutableData alloc] init]); 54 auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 55 56 [archiver setRequiresSecureCoding:YES]; 55 auto archiver = secureArchiverFromMutableData(data.get()); 57 56 58 57 [archiver encodeObject:payment.pkPayment() forKey:NSKeyedArchiveRootObjectKey]; … … 69 68 70 69 auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]); 71 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]); 72 [unarchiver setRequiresSecureCoding:YES]; 70 auto unarchiver = secureUnarchiverFromData(data.get()); 73 71 @try { 74 72 PKPayment *pkPayment = [unarchiver decodeObjectOfClass:getPKPaymentClass() forKey:NSKeyedArchiveRootObjectKey]; … … 107 105 { 108 106 auto data = adoptNS([[NSMutableData alloc] init]); 109 auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 110 111 [archiver setRequiresSecureCoding:YES]; 107 auto archiver = secureArchiverFromMutableData(data.get()); 112 108 113 109 [archiver encodeObject:paymentContact.pkContact() forKey:NSKeyedArchiveRootObjectKey]; … … 124 120 125 121 auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]); 126 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]); 127 [unarchiver setRequiresSecureCoding:YES]; 122 auto unarchiver = secureUnarchiverFromData(data.get()); 128 123 @try { 129 124 PKContact *pkContact = [unarchiver decodeObjectOfClass:getPKContactClass() forKey:NSKeyedArchiveRootObjectKey]; … … 168 163 { 169 164 auto data = adoptNS([[NSMutableData alloc] init]); 170 auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 171 172 [archiver setRequiresSecureCoding:YES]; 165 auto archiver = secureArchiverFromMutableData(data.get()); 173 166 174 167 [archiver encodeObject:paymentMerchantSession.pkPaymentMerchantSession() forKey:NSKeyedArchiveRootObjectKey]; … … 185 178 186 179 auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]); 187 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]); 188 [unarchiver setRequiresSecureCoding:YES]; 180 auto unarchiver = secureUnarchiverFromData(data.get()); 189 181 @try { 190 182 PKPaymentMerchantSession *pkPaymentMerchantSession = [unarchiver decodeObjectOfClass:getPKPaymentMerchantSessionClass() forKey:NSKeyedArchiveRootObjectKey]; … … 196 188 197 189 [unarchiver finishDecoding]; 198 199 190 return true; 200 191 } … … 203 194 { 204 195 auto data = adoptNS([[NSMutableData alloc] init]); 205 auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 206 207 [archiver setRequiresSecureCoding:YES]; 196 auto archiver = secureArchiverFromMutableData(data.get()); 208 197 209 198 [archiver encodeObject:paymentMethod.pkPaymentMethod() forKey:NSKeyedArchiveRootObjectKey]; … … 220 209 221 210 auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(dataReference.data())) length:dataReference.size() freeWhenDone:NO]); 222 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]); 223 [unarchiver setRequiresSecureCoding:YES]; 211 auto unarchiver = secureUnarchiverFromData(data.get()); 224 212 @try { 225 213 PKPaymentMethod *pkPaymentMethod = [unarchiver decodeObjectOfClass:getPKPaymentMethodClass() forKey:NSKeyedArchiveRootObjectKey]; -
trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm
r222584 r223889 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #import "WebCoreArgumentCoders.h" 31 31 #import <pal/spi/cocoa/DataDetectorsCoreSPI.h> 32 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 32 33 #import <wtf/SoftLinking.h> 33 34 … … 74 75 encoder << dataDetectorIdentifier; 75 76 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 76 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 77 [archiver setRequiresSecureCoding:YES]; 77 auto archiver = secureArchiverFromMutableData(data.get()); 78 78 [archiver encodeObject:dataDetectorResults.get() forKey:@"dataDetectorResults"]; 79 79 [archiver finishEncoding]; … … 169 169 return false; 170 170 171 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 172 [unarchiver setRequiresSecureCoding:YES]; 171 auto unarchiver = secureUnarchiverFromData((NSData *)data.get()); 173 172 @try { 174 173 result.dataDetectorResults = [unarchiver decodeObjectOfClasses:[NSSet setWithArray:@[ [NSArray class], getDDScannerResultClass()] ] forKey:@"dataDetectorResults"]; -
trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm
r223408 r223889 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010-2017 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2013 Company 100 Inc. All rights reserved. 4 4 * … … 39 39 #import <WebCore/ResourceRequest.h> 40 40 #import <pal/spi/cf/CFNetworkSPI.h> 41 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 41 42 42 43 #if USE(CFURLCONNECTION) … … 473 474 void ArgumentCoder<ProtectionSpace>::encodePlatformData(Encoder& encoder, const ProtectionSpace& space) 474 475 { 475 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 476 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 477 [archiver setRequiresSecureCoding:YES]; 476 auto data = adoptNS([[NSMutableData alloc] init]); 477 auto archiver = secureArchiverFromMutableData(data.get()); 478 478 [archiver encodeObject:space.nsSpace() forKey:@"protectionSpace"]; 479 479 [archiver finishEncoding]; … … 487 487 return false; 488 488 489 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 490 [unarchiver setRequiresSecureCoding:YES]; 489 auto unarchiver = secureUnarchiverFromData((NSData *)data.get()); 491 490 @try { 492 491 if (RetainPtr<NSURLProtectionSpace> nsSpace = [unarchiver decodeObjectOfClass:[NSURLProtectionSpace class] forKey:@"protectionSpace"]) … … 520 519 521 520 encoder << false; 522 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 523 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 524 [archiver setRequiresSecureCoding:YES]; 521 auto data = adoptNS([[NSMutableData alloc] init]); 522 auto archiver = secureArchiverFromMutableData(data.get()); 525 523 [archiver encodeObject:nsCredential forKey:@"credential"]; 526 524 [archiver finishEncoding]; … … 561 559 return false; 562 560 563 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 564 [unarchiver setRequiresSecureCoding:YES]; 561 auto unarchiver = secureUnarchiverFromData((NSData *)data.get()); 565 562 @try { 566 563 if (RetainPtr<NSURLCredential> nsCredential = [unarchiver decodeObjectOfClass:[NSURLCredential class] forKey:@"credential"]) … … 623 620 void ArgumentCoder<ContentFilterUnblockHandler>::encode(Encoder& encoder, const ContentFilterUnblockHandler& contentFilterUnblockHandler) 624 621 { 625 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 626 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 627 [archiver setRequiresSecureCoding:YES]; 622 auto data = adoptNS([[NSMutableData alloc] init]); 623 auto archiver = secureArchiverFromMutableData(data.get()); 628 624 contentFilterUnblockHandler.encode(archiver.get()); 629 625 [archiver finishEncoding]; … … 637 633 return false; 638 634 639 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 640 [unarchiver setRequiresSecureCoding:YES]; 635 auto unarchiver = secureUnarchiverFromData((NSData *)data.get()); 641 636 if (!ContentFilterUnblockHandler::decode(unarchiver.get(), contentFilterUnblockHandler)) 642 637 return false; … … 657 652 void ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const MediaPlaybackTargetContext& target) 658 653 { 659 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 660 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 661 [archiver setRequiresSecureCoding:YES]; 654 auto data = adoptNS([[NSMutableData alloc] init]); 655 auto archiver = secureArchiverFromMutableData(data.get()); 662 656 663 657 if ([getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)]) … … 678 672 return false; 679 673 680 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 681 [unarchiver setRequiresSecureCoding:YES]; 674 auto unarchiver = secureUnarchiverFromData((NSData *)data.get()); 682 675 683 676 AVOutputContext *context = nil; -
trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm
r222584 r223889 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 #import "WebCoreArgumentCoders.h" 35 35 #import <WebCore/TextIndicator.h> 36 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 36 37 #import <pal/spi/mac/DataDetectorsSPI.h> 37 38 … … 45 46 return; 46 47 47 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 48 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 49 [archiver setRequiresSecureCoding:YES]; 48 auto data = adoptNS([[NSMutableData alloc] init]); 49 auto archiver = secureArchiverFromMutableData(data.get()); 50 50 [archiver encodeObject:detectedDataActionContext.get() forKey:@"actionContext"]; 51 51 [archiver finishEncoding]; … … 76 76 return false; 77 77 78 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 79 [unarchiver setRequiresSecureCoding:YES]; 78 auto unarchiver = secureUnarchiverFromData((NSData *)data.get()); 80 79 @try { 81 80 hitTestResultData.detectedDataActionContext = [unarchiver decodeObjectOfClass:getDDActionContextClass() forKey:@"actionContext"]; -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
r222613 r223889 49 49 #import <WebCore/PluginData.h> 50 50 #import <pal/spi/cf/CFNetworkSPI.h> 51 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 51 52 #import <wtf/RetainPtr.h> 52 53 … … 214 215 215 216 auto data = adoptNS([[NSMutableData alloc] init]); 216 auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 217 [keyedArchiver setRequiresSecureCoding:YES]; 217 auto keyedArchiver = secureArchiverFromMutableData(data.get()); 218 218 219 219 @try { … … 237 237 238 238 auto data = adoptNS([[NSMutableData alloc] init]); 239 auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 240 [keyedArchiver setRequiresSecureCoding:YES]; 239 auto keyedArchiver = secureArchiverFromMutableData(data.get()); 241 240 242 241 @try { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r223726 r223889 103 103 #import <WebCore/ViewportArguments.h> 104 104 #import <WebCore/WritingMode.h> 105 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 105 106 #import <pal/spi/mac/NSTextFinderSPI.h> 106 107 #import <wtf/BlockPtr.h> … … 4526 4527 if (API::Data* data = static_cast<API::Data*>(userData)) { 4527 4528 auto nsData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(data->bytes())) length:data->size() freeWhenDone:NO]); 4528 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:nsData.get()]); 4529 [unarchiver setRequiresSecureCoding:YES]; 4529 auto unarchiver = secureUnarchiverFromData(nsData.get()); 4530 4530 @try { 4531 4531 userObject = [unarchiver decodeObjectOfClass:[NSObject class] forKey:@"userObject"]; -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r223207 r223889 50 50 #import <WebCore/SharedBuffer.h> 51 51 #import <pal/spi/cf/CFNetworkSPI.h> 52 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 52 53 #import <sys/param.h> 53 54 … … 216 217 if (m_bundleParameters) { 217 218 auto data = adoptNS([[NSMutableData alloc] init]); 218 auto keyedArchiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 219 220 [keyedArchiver setRequiresSecureCoding:YES]; 219 auto keyedArchiver = secureArchiverFromMutableData(data.get()); 221 220 222 221 @try { -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r221873 r223889 56 56 #import <WebCore/TextIndicator.h> 57 57 #import <WebCore/ValidationBubble.h> 58 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 58 59 #import <wtf/BlockPtr.h> 59 60 … … 548 549 if (API::Data* data = static_cast<API::Data*>(userData)) { 549 550 auto nsData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(data->bytes())) length:data->size() freeWhenDone:NO]); 550 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:nsData.get()]); 551 [unarchiver setRequiresSecureCoding:YES]; 551 auto unarchiver = secureUnarchiverFromData(nsData.get()); 552 552 @try { 553 553 userObject = [unarchiver decodeObjectOfClass:[NSObject class] forKey:@"userObject"]; -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
r218321 r223889 66 66 #import <WebCore/HTMLInputElement.h> 67 67 #import <WebCore/MainFrame.h> 68 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 68 69 69 70 using namespace WebCore; … … 485 486 486 487 auto data = adoptNS([[NSMutableData alloc] init]); 487 auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 488 [archiver setRequiresSecureCoding:YES]; 488 auto archiver = secureArchiverFromMutableData(data.get()); 489 489 @try { 490 490 [archiver encodeObject:userObject forKey:@"userObject"]; -
trunk/Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm
r190678 r223889 35 35 #import "WebProcessCreationParameters.h" 36 36 #import <Foundation/NSBundle.h> 37 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h> 37 38 #import <stdio.h> 38 39 #import <wtf/RetainPtr.h> … … 86 87 auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(parameters.bundleParameterData->bytes())) length:parameters.bundleParameterData->size() freeWhenDone:NO]); 87 88 88 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:bundleParameterData.get()]); 89 [unarchiver setRequiresSecureCoding:YES]; 89 auto unarchiver = secureUnarchiverFromData(bundleParameterData.get()); 90 90 91 91 NSDictionary *dictionary = nil; … … 161 161 auto bundleParameterData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(value.data())) length:value.size() freeWhenDone:NO]); 162 162 163 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:bundleParameterData.get()]); 164 [unarchiver setRequiresSecureCoding:YES]; 163 auto unarchiver = secureUnarchiverFromData(bundleParameterData.get()); 165 164 166 165 id parameter = nil; … … 184 183 auto bundleParametersData = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(value.data())) length:value.size() freeWhenDone:NO]); 185 184 186 auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:bundleParametersData.get()]); 187 [unarchiver setRequiresSecureCoding:YES]; 185 auto unarchiver = secureUnarchiverFromData(bundleParametersData.get()); 188 186 189 187 NSDictionary *parameters = nil;
Note: See TracChangeset
for help on using the changeset viewer.