Title: [222760] trunk
Revision
222760
Author
[email protected]
Date
2017-10-02 17:13:13 -0700 (Mon, 02 Oct 2017)

Log Message

[Mac] Use safer decoding practices for NSKeyedUnarchiver
https://bugs.webkit.org/show_bug.cgi?id=175887
<rdar://problem/33435281>

Reviewed by Daniel Bates.

Source/WebCore:

* loader/archive/cf/LegacyWebArchiveMac.mm:
(WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Use NSSecureCoding to unarchive.
(WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto for archiving.
* testing/cocoa/WebArchiveDumpSupport.mm:
(WebCoreTestSupport::createCFURLResponseFromResponseData): Update to use NSSecureCoding if possible.

LayoutTests:

Mark two tests as flaky for now, until the relevant CFNetwork changes are available on the test systems.
1. webarchive/loading/cache-expired-subresource.html
2. webarchive/loading/test-loading-archive-subresource-null-mimetype.html

* platform/ios/TestExpectations:
* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (222759 => 222760)


--- trunk/LayoutTests/ChangeLog	2017-10-02 23:55:19 UTC (rev 222759)
+++ trunk/LayoutTests/ChangeLog	2017-10-03 00:13:13 UTC (rev 222760)
@@ -1,3 +1,18 @@
+2017-10-02  Brent Fulgham  <[email protected]>
+
+        [Mac] Use safer decoding practices for NSKeyedUnarchiver
+        https://bugs.webkit.org/show_bug.cgi?id=175887
+        <rdar://problem/33435281>
+
+        Reviewed by Daniel Bates.
+
+        Mark two tests as flaky for now, until the relevant CFNetwork changes are available on the test systems.
+        1. webarchive/loading/cache-expired-subresource.html
+        2. webarchive/loading/test-loading-archive-subresource-null-mimetype.html
+
+        * platform/ios/TestExpectations:
+        * platform/mac/TestExpectations:
+
 2017-10-02  Andy Estes  <[email protected]>
 
         [Payment Request] Update payment-request imported tests
@@ -17680,6 +17695,22 @@
 
 2017-07-10  Brent Fulgham  <[email protected]>
 
+        Reset cookie partitioning state after network process crashes
+        https://bugs.webkit.org/show_bug.cgi?id=174306
+        <rdar://problem/33171605>
+
+        Reviewed by Daniel Bates.
+
+        * http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-network-process-crash-expected.txt: Added.
+        * http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-network-process-crash.html: Added.
+        * http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion-expected.txt: Rebaselined.
+        * http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt: Rebaselined.
+        * http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt: Rebaselined.
+        * http/tests/loading/resourceLoadStatistics/resources/get-cookies.php:
+        * http/tests/loading/resourceLoadStatistics/resources/set-cookie.php:
+
+2017-07-10  Brent Fulgham  <[email protected]>
+
         Resource Load Statistics: Prune statistics in orders of importance
         https://bugs.webkit.org/show_bug.cgi?id=174215
         <rdar://problem/33164403>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (222759 => 222760)


--- trunk/LayoutTests/platform/ios/TestExpectations	2017-10-02 23:55:19 UTC (rev 222759)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2017-10-03 00:13:13 UTC (rev 222760)
@@ -1128,6 +1128,10 @@
 webarchive/test-css-url-resources-inline-styles.html [ Failure ]
 webarchive/test-link-rel-icon.html [ Failure ]
 
+# The following two tests are expected to fail until <rdar://problem/34063313> is available on test systems.
+webarchive/loading/cache-expired-subresource.html [ Failure ]
+webarchive/loading/test-loading-archive-subresource-null-mimetype.html [ Crash ]
+
 # Webarchive tests that fail due to <https://bugs.webkit.org/show_bug.cgi?id=82665>:
 http/tests/webarchive/test-css-url-encoding-shift-jis.html
 http/tests/webarchive/test-css-url-encoding-utf-8.html

Modified: trunk/LayoutTests/platform/mac/TestExpectations (222759 => 222760)


--- trunk/LayoutTests/platform/mac/TestExpectations	2017-10-02 23:55:19 UTC (rev 222759)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2017-10-03 00:13:13 UTC (rev 222760)
@@ -209,6 +209,10 @@
 
 webkit.org/b/56685 webarchive/test-link-rel-icon.html [ Failure ]
 
+# The following two tests are expected to fail until <rdar://problem/34063313> is available on test systems.
+webarchive/loading/cache-expired-subresource.html [ Failure ]
+webarchive/loading/test-loading-archive-subresource-null-mimetype.html [ Crash ]
+
 # Quota API is not supported.
 storage/storageinfo-missing-arguments.html
 storage/storageinfo-no-callbacks.html

Modified: trunk/Source/WebCore/ChangeLog (222759 => 222760)


--- trunk/Source/WebCore/ChangeLog	2017-10-02 23:55:19 UTC (rev 222759)
+++ trunk/Source/WebCore/ChangeLog	2017-10-03 00:13:13 UTC (rev 222760)
@@ -1,3 +1,17 @@
+2017-10-02  Brent Fulgham  <[email protected]>
+
+        [Mac] Use safer decoding practices for NSKeyedUnarchiver
+        https://bugs.webkit.org/show_bug.cgi?id=175887
+        <rdar://problem/33435281>
+
+        Reviewed by Daniel Bates.
+
+        * loader/archive/cf/LegacyWebArchiveMac.mm:
+        (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Use NSSecureCoding to unarchive.
+        (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto for archiving.
+        * testing/cocoa/WebArchiveDumpSupport.mm:
+        (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to use NSSecureCoding if possible.
+
 2017-10-02  Daniel Bates  <[email protected]>
 
         Use InlineTextBox::lineFont() in more places

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm (222759 => 222760)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm	2017-10-02 23:55:19 UTC (rev 222759)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm	2017-10-03 00:13:13 UTC (rev 222760)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -43,12 +43,20 @@
     
     NSURLResponse *response = nil;
     NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData];
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS)
+    // Because of <rdar://problem/34063313> we can't use this for decoding in older OS's.
+    [unarchiver setRequiresSecureCoding:YES];
     @try {
+        response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:LegacyWebArchiveResourceResponseKey];
+#else
+    @try {
         id responseObject = [unarchiver decodeObjectForKey:LegacyWebArchiveResourceResponseKey];
         if ([responseObject isKindOfClass:[NSURLResponse class]])
             response = responseObject;
+#endif
         [unarchiver finishDecoding];
-    } @catch(id) {
+    } @catch (NSException *exception) {
+        LOG_ERROR("Failed to decode NS(HTTP)URLResponse: %@", exception);
         response = nil;
     }
     [unarchiver release];
@@ -66,6 +74,7 @@
     CFMutableDataRef responseData = CFDataCreateMutable(0, 0);
 
     NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:(NSMutableData *)responseData];
+    [archiver setRequiresSecureCoding:YES];
     [archiver encodeObject:nsResponse forKey:LegacyWebArchiveResourceResponseKey];
     [archiver finishEncoding];
     [archiver release];

Modified: trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm (222759 => 222760)


--- trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm	2017-10-02 23:55:19 UTC (rev 222759)
+++ trunk/Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm	2017-10-03 00:13:13 UTC (rev 222760)
@@ -41,8 +41,19 @@
 static CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
 {
     RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
-    NSURLResponse *response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
-    [unarchiver finishDecoding];
+    [unarchiver setRequiresSecureCoding:YES];
+    NSURLResponse *response;
+    @try {
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS)
+        response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
+#else
+        response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
+#endif
+        [unarchiver finishDecoding];
+    } @catch (NSException *exception) {
+        LOG_ERROR("Failed to decode NS(HTTP)URLResponse: %@", exception);
+        response = nil;
+    }
 
     if (![response isKindOfClass:[NSHTTPURLResponse class]])
         return CFURLResponseCreate(kCFAllocatorDefault, (CFURLRef)response.URL, (CFStringRef)response.MIMEType, response.expectedContentLength, (CFStringRef)response.textEncodingName, kCFURLCacheStorageAllowed);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to