Diff
Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (285453 => 285454)
--- branches/safari-612-branch/Source/WebKit/ChangeLog 2021-11-09 01:08:38 UTC (rev 285453)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog 2021-11-09 01:08:41 UTC (rev 285454)
@@ -1,5 +1,46 @@
2021-11-08 Kocsen Chung <[email protected]>
+ Cherry-pick r283180. rdar://problem/85168105
+
+ Validate DeviceIdHashSaltStorage persistent data
+ https://bugs.webkit.org/show_bug.cgi?id=230852
+ <rdar://problem/83615408>
+
+ Reviewed by Eric Carlson.
+
+ Source/WebKit:
+
+ Add nullptr check to decoded data.
+ Covered by API test.
+
+ * UIProcess/DeviceIdHashSaltStorage.cpp:
+ (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
+
+ Tools:
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
+ * TestWebKitAPI/Tests/WebKit/invalidDeviceIDHashSalts: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-28 Youenn Fablet <[email protected]>
+
+ Validate DeviceIdHashSaltStorage persistent data
+ https://bugs.webkit.org/show_bug.cgi?id=230852
+ <rdar://problem/83615408>
+
+ Reviewed by Eric Carlson.
+
+ Add nullptr check to decoded data.
+ Covered by API test.
+
+ * UIProcess/DeviceIdHashSaltStorage.cpp:
+ (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
+
+2021-11-08 Kocsen Chung <[email protected]>
+
Cherry-pick r281970. rdar://problem/85173043
REGRESSION (r280767): Caret color is black after pasting rich text in Mail compose in dark mode
Modified: branches/safari-612-branch/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp (285453 => 285454)
--- branches/safari-612-branch/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp 2021-11-09 01:08:38 UTC (rev 285453)
+++ branches/safari-612-branch/Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp 2021-11-09 01:08:41 UTC (rev 285454)
@@ -137,6 +137,8 @@
}
auto hashSaltForOrigin = getDataFromDecoder(decoder.get(), WTFMove(deviceIdHashSalt));
+ if (!hashSaltForOrigin)
+ continue;
auto origins = makeString(hashSaltForOrigin->documentOrigin.toString(), hashSaltForOrigin->parentOrigin.toString());
auto deviceIdHashSaltForOrigin = deviceIdHashSaltForOrigins.ensure(origins, [hashSaltForOrigin = WTFMove(hashSaltForOrigin)] () mutable {
Modified: branches/safari-612-branch/Tools/ChangeLog (285453 => 285454)
--- branches/safari-612-branch/Tools/ChangeLog 2021-11-09 01:08:38 UTC (rev 285453)
+++ branches/safari-612-branch/Tools/ChangeLog 2021-11-09 01:08:41 UTC (rev 285454)
@@ -1,3 +1,42 @@
+2021-11-08 Kocsen Chung <[email protected]>
+
+ Cherry-pick r283180. rdar://problem/85168105
+
+ Validate DeviceIdHashSaltStorage persistent data
+ https://bugs.webkit.org/show_bug.cgi?id=230852
+ <rdar://problem/83615408>
+
+ Reviewed by Eric Carlson.
+
+ Source/WebKit:
+
+ Add nullptr check to decoded data.
+ Covered by API test.
+
+ * UIProcess/DeviceIdHashSaltStorage.cpp:
+ (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
+
+ Tools:
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
+ * TestWebKitAPI/Tests/WebKit/invalidDeviceIDHashSalts: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-28 Youenn Fablet <[email protected]>
+
+ Validate DeviceIdHashSaltStorage persistent data
+ https://bugs.webkit.org/show_bug.cgi?id=230852
+ <rdar://problem/83615408>
+
+ Reviewed by Eric Carlson.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
+ * TestWebKitAPI/Tests/WebKit/invalidDeviceIDHashSalts: Added.
+
2021-11-04 Russell Epstein <[email protected]>
Cherry-pick r285239. rdar://problem/80991209
Modified: branches/safari-612-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (285453 => 285454)
--- branches/safari-612-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-11-09 01:08:38 UTC (rev 285453)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-11-09 01:08:41 UTC (rev 285454)
@@ -51,6 +51,7 @@
0713704A265320E500CA2C9A /* AudioBufferSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07137049265320E500CA2C9A /* AudioBufferSize.mm */; };
07492B3B1DF8B14C00633DE1 /* EnumerateMediaDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07492B3A1DF8AE2D00633DE1 /* EnumerateMediaDevices.cpp */; };
07492B3C1DF8B86600633DE1 /* enumerateMediaDevices.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 07492B391DF8ADA400633DE1 /* enumerateMediaDevices.html */; };
+ 074994421EA5034B000DA44D /* invalidDeviceIDHashSalts in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4A410F4D19AF7BEF002EBAB4 /* invalidDeviceIDHashSalts */; };
074994421EA5034B000DA44E /* getUserMedia.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */; };
074994421EA5034B000DA44F /* ondevicechange.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4A410F4D19AF7BEF002EBAB6 /* ondevicechange.html */; };
074994421EA5034B000DA45E /* getUserMediaAudioVideoCapture.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4A410F4D19AF7BEF002EBAC5 /* getUserMediaAudioVideoCapture.html */; };
@@ -1514,6 +1515,7 @@
07E1F6A21FFC44FA0096C7EC /* getDisplayMedia.html in Copy Resources */,
467C565321B5ED130057516D /* GetSessionCookie.html in Copy Resources */,
41661C662355E85E00D33C27 /* getUserMedia-webaudio.html in Copy Resources */,
+ 074994421EA5034B000DA44D /* invalidDeviceIDHashSalts in Copy Resources */,
074994421EA5034B000DA44E /* getUserMedia.html in Copy Resources */,
074994521EA5034B000DA44E /* getUserMedia2.html in Copy Resources */,
074994421EA5034B000DA45E /* getUserMediaAudioVideoCapture.html in Copy Resources */,
@@ -2144,6 +2146,7 @@
49D7FBA7241FDDDA00AB67FA /* in-app-browser-privacy-local-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "in-app-browser-privacy-local-file.html"; sourceTree = "<group>"; };
49EF6AD42677C0BE007967DC /* AppPrivacyReport.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppPrivacyReport.mm; sourceTree = "<group>"; };
4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMedia.cpp; sourceTree = "<group>"; };
+ 4A410F4D19AF7BEF002EBAB4 /* invalidDeviceIDHashSalts */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.bplist; path = invalidDeviceIDHashSalts; sourceTree = "<group>"; };
4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMedia.html; sourceTree = "<group>"; };
4A410F4D19AF7BEF002EBAB6 /* ondevicechange.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ondevicechange.html; sourceTree = "<group>"; };
4A410F4D19AF7BEF002EBAC5 /* getUserMediaAudioVideoCapture.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMediaAudioVideoCapture.html; sourceTree = "<group>"; };
@@ -4624,6 +4627,7 @@
BCBD372E125ABBE600D2C29F /* icon.png */,
1CC80CE92474F1F7004DC489 /* idempotent-mode-autosizing-only-honors-percentages.html */,
CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */,
+ 4A410F4D19AF7BEF002EBAB4 /* invalidDeviceIDHashSalts */,
C9B4AD2B1ECA6F7600F5FEA0 /* js-autoplay-audio.html */,
C99B675B1E3971FC00FC6C80 /* js-play-with-controls.html */,
55226A2E1EB969B600C36AD0 /* large-red-square-image.html */,
Modified: branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm (285453 => 285454)
--- branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm 2021-11-09 01:08:38 UTC (rev 285453)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm 2021-11-09 01:08:41 UTC (rev 285454)
@@ -41,9 +41,11 @@
#import <WebKit/WKWebViewConfiguration.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
#import <WebKit/WKWebViewPrivateForTesting.h>
+#import <WebKit/WKWebsiteDataStorePrivate.h>
#import <WebKit/_WKExperimentalFeature.h>
#import <WebKit/_WKInternalDebugFeature.h>
#import <WebKit/_WKProcessPoolConfiguration.h>
+#import <WebKit/_WKWebsiteDataStoreConfiguration.h>
#import <wtf/text/StringBuilder.h>
#import <wtf/text/WTFString.h>
@@ -895,6 +897,43 @@
}
#endif // PLATFORM(MAC)
+TEST(WebKit, InvalidDeviceIdHashSalts)
+{
+ NSURL *tempDir = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"InvalidDeviceIdHashSaltsPathsTest"] isDirectory:YES];
+ NSURL *hashSaltLocation = [tempDir URLByAppendingPathComponent:@"1"];
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ [fileManager createDirectoryAtURL:hashSaltLocation withIntermediateDirectories:YES attributes:nil error:nil];
+
+ NSString *fileName = @"CBF3087F32B7E19D13F683C9973060819F869CA9298B405E";
+ NSURL *filePath = [hashSaltLocation URLByAppendingPathComponent:fileName];
+
+ // Prepare invalid data.
+ if ([fileManager fileExistsAtPath:filePath.path])
+ [fileManager removeItemAtPath:filePath.path error:nil];
+ auto *fileData = [NSData dataWithContentsOfURL:[NSBundle.mainBundle URLForResource:@"invalidDeviceIDHashSalts" withExtension:@"" subdirectory:@"TestWebKitAPI.resources"]];
+ EXPECT_TRUE([fileManager createFileAtPath:filePath.path contents:fileData attributes: nil]);
+ while (![fileManager fileExistsAtPath:filePath.path])
+ Util::spinRunLoop();
+
+ // Prepare web view to use the invalid data
+ auto websiteDataStoreConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] init]);
+ [websiteDataStoreConfiguration setDeviceIdHashSaltsStorageDirectory:tempDir];
+
+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [configuration setWebsiteDataStore:adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration.get()]).get()];
+ auto preferences = [configuration preferences];
+ configuration.get()._mediaCaptureEnabled = YES;
+ preferences._mediaCaptureRequiresSecureConnection = NO;
+ preferences._mockCaptureDevicesEnabled = YES;
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get()]);
+ auto delegate = adoptNS([[UserMediaCaptureUIDelegate alloc] init]);
+ [webView setUIDelegate:delegate.get()];
+
+ // Wait for invalid data to be loaded.
+ [webView loadTestPageNamed:@"getUserMedia"];
+ [delegate waitUntilPrompted];
+}
+
} // namespace TestWebKitAPI
#endif // ENABLE(MEDIA_STREAM)
Added: branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKit/invalidDeviceIDHashSalts (0 => 285454)
--- branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKit/invalidDeviceIDHashSalts (rev 0)
+++ branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebKit/invalidDeviceIDHashSalts 2021-11-09 01:08:41 UTC (rev 285454)
@@ -0,0 +1 @@
+bplist00\xD3Voriginn\parentOrigin\lastTimeUsedS__0#A\xD8T\xB8\xEFc\xB1#04��������������������������������������������������������=
\ No newline at end of file