Title: [244035] trunk/Source/WebKit
- Revision
- 244035
- Author
- [email protected]
- Date
- 2019-04-08 13:24:34 -0700 (Mon, 08 Apr 2019)
Log Message
Make HSTS list handling more robust against unexpected content
https://bugs.webkit.org/show_bug.cgi?id=196552
<rdar://problem/43403817>
Reviewed by Chris Dumez.
Crash logs indicate we sometimes encounter null key values during processing.
This patch adds some debug assertions to catch this in test environments, and
allows the code to skip the bad entries if encountered.
It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::filterPreloadHSTSEntry):
(WebKit::NetworkProcess::getHostNamesWithHSTSCache):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (244034 => 244035)
--- trunk/Source/WebKit/ChangeLog 2019-04-08 20:22:11 UTC (rev 244034)
+++ trunk/Source/WebKit/ChangeLog 2019-04-08 20:24:34 UTC (rev 244035)
@@ -1,3 +1,22 @@
+2019-04-08 Brent Fulgham <[email protected]>
+
+ Make HSTS list handling more robust against unexpected content
+ https://bugs.webkit.org/show_bug.cgi?id=196552
+ <rdar://problem/43403817>
+
+ Reviewed by Chris Dumez.
+
+ Crash logs indicate we sometimes encounter null key values during processing.
+ This patch adds some debug assertions to catch this in test environments, and
+ allows the code to skip the bad entries if encountered.
+
+ It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
+ by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
+
+ * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+ (WebKit::filterPreloadHSTSEntry):
+ (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
+
2019-04-05 Brian Burg <[email protected]>
Web Automation: clean up some WebAutomationSession methods to use modern async IPC
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (244034 => 244035)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm 2019-04-08 20:22:11 UTC (rev 244034)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm 2019-04-08 20:24:34 UTC (rev 244035)
@@ -149,7 +149,18 @@
static void filterPreloadHSTSEntry(const void* key, const void* value, void* context)
{
- HashSet<String>* hostnames = static_cast<HashSet<String>*>(context);
+ RELEASE_ASSERT(context);
+
+ ASSERT(key);
+ ASSERT(value);
+ if (!key || !value)
+ return;
+
+ ASSERT(key != kCFNull);
+ if (key == kCFNull)
+ return;
+
+ auto* hostnames = static_cast<HashSet<String>*>(context);
auto val = static_cast<CFDictionaryRef>(value);
if (CFDictionaryGetValue(val, _kCFNetworkHSTSPreloaded) != kCFBooleanTrue)
hostnames->add((CFStringRef)key);
@@ -157,8 +168,8 @@
void NetworkProcess::getHostNamesWithHSTSCache(WebCore::NetworkStorageSession& session, HashSet<String>& hostNames)
{
- auto HSTSPolicies = adoptCF(_CFNetworkCopyHSTSPolicies(session.platformSession()));
- CFDictionaryApplyFunction(HSTSPolicies.get(), filterPreloadHSTSEntry, &hostNames);
+ if (auto HSTSPolicies = adoptCF(_CFNetworkCopyHSTSPolicies(session.platformSession())))
+ CFDictionaryApplyFunction(HSTSPolicies.get(), filterPreloadHSTSEntry, &hostNames);
}
void NetworkProcess::deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession& session, const Vector<String>& hostNames)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes