WebKit Bugzilla
Attachment 369335 Details for
Bug 197259
: Add SPI to set HSTS storage directory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197259-20190507165941.patch (text/plain), 11.90 KB, created by
Alex Christensen
on 2019-05-07 16:59:42 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-05-07 16:59:42 PDT
Size:
11.90 KB
patch
obsolete
>Index: Source/WTF/ChangeLog >=================================================================== >--- Source/WTF/ChangeLog (revision 245034) >+++ Source/WTF/ChangeLog (working copy) >@@ -1,3 +1,12 @@ >+2019-05-07 Alex Christensen <achristensen@webkit.org> >+ >+ Add SPI to set HSTS storage directory >+ https://bugs.webkit.org/show_bug.cgi?id=197259 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/Platform.h: >+ > 2019-05-07 Robin Morisset <rmorisset@apple.com> > > WTF::BitVector should have an isEmpty() method >Index: Source/WTF/wtf/Platform.h >=================================================================== >--- Source/WTF/wtf/Platform.h (revision 245034) >+++ Source/WTF/wtf/Platform.h (working copy) >@@ -1361,6 +1361,10 @@ > #define USE_SOURCE_APPLICATION_AUDIT_DATA 1 > #endif > >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) >+#define HAVE_HSTS_STORAGE_PATH 1 >+#endif >+ > #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || PLATFORM(IOS) || PLATFORM(IOSMAC) > #define HAVE_URL_FORMATTING 1 > #endif >Index: Source/WebCore/PAL/ChangeLog >=================================================================== >--- Source/WebCore/PAL/ChangeLog (revision 245034) >+++ Source/WebCore/PAL/ChangeLog (working copy) >@@ -1,3 +1,12 @@ >+2019-05-07 Alex Christensen <achristensen@webkit.org> >+ >+ Add SPI to set HSTS storage directory >+ https://bugs.webkit.org/show_bug.cgi?id=197259 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * pal/spi/cf/CFNetworkSPI.h: >+ > 2019-05-04 Alex Christensen <achristensen@webkit.org> > > Revert r244953 and r244954 because they broke internal builds. >Index: Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h >=================================================================== >--- Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (revision 245034) >+++ Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (working copy) >@@ -325,6 +325,10 @@ void _CFURLRequestCreateArchiveList(CFAl > CFMutableURLRequestRef _CFURLRequestCreateFromArchiveList(CFAllocatorRef, CFIndex version, CFTypeRef* objects, CFIndex objectCount, CFDictionaryRef protocolProperties); > void CFURLRequestSetProxySettings(CFMutableURLRequestRef, CFDictionaryRef); > >+#if HAVE(HSTS_STORAGE_PATH) >+void _CFNetworkSetHSTSStoragePath(CFStringRef); >+#endif >+ > #endif // !PLATFORM(WIN) > > CFN_EXPORT const CFStringRef kCFStreamPropertyCONNECTProxy; >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 245034) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,33 @@ >+2019-05-07 Alex Christensen <achristensen@webkit.org> >+ >+ Add SPI to set HSTS storage directory >+ https://bugs.webkit.org/show_bug.cgi?id=197259 >+ <rdar://problem/48797895> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It is with great sadness that I lament the design of this SPI, which is necessitated by the process-global nature of the SPI that >+ I must call and the time at which I must call it (before any networking calls have been made). >+ I'm also not thrilled about the fact that the unit test infrastructure I developed for this in r244594 cannot be used because >+ the SPI that I must call does not work on iOS simulator or Mac. I have verified the SPI is being called and that when called on iOS, >+ and that CFNetwork does the right thing with it. >+ >+ * NetworkProcess/NetworkProcessCreationParameters.cpp: >+ (WebKit::NetworkProcessCreationParameters::encode const): >+ (WebKit::NetworkProcessCreationParameters::decode): >+ * NetworkProcess/NetworkProcessCreationParameters.h: >+ * NetworkProcess/cocoa/NetworkProcessCocoa.mm: >+ (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): >+ * UIProcess/API/APIProcessPoolConfiguration.cpp: >+ (API::ProcessPoolConfiguration::copy): >+ * UIProcess/API/APIProcessPoolConfiguration.h: >+ * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: >+ * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: >+ (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]): >+ (-[_WKProcessPoolConfiguration hstsStorageDirectory]): >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::ensureNetworkProcess): >+ > 2019-05-07 Adrian Perez de Castro <aperez@igalia.com> > > [GTK][WPE] Cannot build documentation with gtk-doc >Index: Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp (revision 245034) >+++ Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp (working copy) >@@ -92,6 +92,8 @@ void NetworkProcessCreationParameters::e > encoder << downloadMonitorSpeedMultiplier; > encoder << isITPFirstPartyWebsiteDataRemovalEnabled; > encoder << enableAdClickAttributionDebugMode; >+ encoder << hstsStorageDirectory; >+ encoder << hstsStorageDirectoryExtensionHandle; > } > > bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProcessCreationParameters& result) >@@ -224,6 +226,12 @@ bool NetworkProcessCreationParameters::d > if (!decoder.decode(result.enableAdClickAttributionDebugMode)) > return false; > >+ if (!decoder.decode(result.hstsStorageDirectory)) >+ return false; >+ >+ if (!decoder.decode(result.hstsStorageDirectoryExtensionHandle)) >+ return false; >+ > return true; > } > >Index: Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h (revision 245034) >+++ Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h (working copy) >@@ -110,6 +110,8 @@ struct NetworkProcessCreationParameters > bool isITPFirstPartyWebsiteDataRemovalEnabled { true }; > uint32_t downloadMonitorSpeedMultiplier { 1 }; > bool enableAdClickAttributionDebugMode { false }; >+ String hstsStorageDirectory; >+ SandboxExtension::Handle hstsStorageDirectoryExtensionHandle; > }; > > } // namespace WebKit >Index: Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >=================================================================== >--- Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (revision 245034) >+++ Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (working copy) >@@ -72,6 +72,13 @@ void NetworkProcess::platformInitializeN > WebCore::setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier); > WebCore::setApplicationSDKVersion(parameters.uiProcessSDKVersion); > >+#if HAVE(HSTS_STORAGE_PATH) >+ if (!parameters.hstsStorageDirectory.isNull()) { >+ SandboxExtension::consumePermanently(parameters.hstsStorageDirectoryExtensionHandle); >+ _CFNetworkSetHSTSStoragePath(parameters.hstsStorageDirectory.createCFString().get()); >+ } >+#endif >+ > #if PLATFORM(IOS_FAMILY) > SandboxExtension::consumePermanently(parameters.cookieStorageDirectoryExtensionHandle); > SandboxExtension::consumePermanently(parameters.containerCachesDirectoryExtensionHandle); >Index: Source/WebKit/UIProcess/WebProcessPool.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebProcessPool.cpp (revision 245034) >+++ Source/WebKit/UIProcess/WebProcessPool.cpp (working copy) >@@ -535,6 +535,10 @@ NetworkProcessProxy& WebProcessPool::ens > #endif > #endif > >+ parameters.hstsStorageDirectory = m_configuration->hstsStorageDirectory(); >+ if (!parameters.hstsStorageDirectory.isNull()) >+ SandboxExtension::createHandleForReadWriteDirectory(parameters.hstsStorageDirectory, parameters.hstsStorageDirectoryExtensionHandle); >+ > parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession; > > parameters.urlSchemesRegisteredAsSecure = copyToVector(m_schemesToRegisterAsSecure); >Index: Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp >=================================================================== >--- Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp (revision 245034) >+++ Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp (working copy) >@@ -131,6 +131,7 @@ Ref<ProcessPoolConfiguration> ProcessPoo > #endif > copy->m_customWebContentServiceBundleIdentifier = this->m_customWebContentServiceBundleIdentifier; > copy->m_usesSingleWebProcess = m_usesSingleWebProcess; >+ copy->m_hstsStorageDirectory = m_hstsStorageDirectory; > > return copy; > } >Index: Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h >=================================================================== >--- Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (revision 245034) >+++ Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (working copy) >@@ -180,6 +180,9 @@ public: > const WTF::String& customWebContentServiceBundleIdentifier() const { return m_customWebContentServiceBundleIdentifier; } > void setCustomWebContentServiceBundleIdentifier(const WTF::String& customWebContentServiceBundleIdentifier) { m_customWebContentServiceBundleIdentifier = customWebContentServiceBundleIdentifier; } > >+ const WTF::String& hstsStorageDirectory() const { return m_hstsStorageDirectory; } >+ void setHSTSStorageDirectory(WTF::String&& directory) { m_hstsStorageDirectory = WTFMove(directory); } >+ > #if PLATFORM(COCOA) > bool suppressesConnectionTerminationOnSystemChange() const { return m_suppressesConnectionTerminationOnSystemChange; } > void setSuppressesConnectionTerminationOnSystemChange(bool suppressesConnectionTerminationOnSystemChange) { m_suppressesConnectionTerminationOnSystemChange = suppressesConnectionTerminationOnSystemChange; } >@@ -227,6 +230,7 @@ private: > bool m_isJITEnabled { true }; > bool m_usesSingleWebProcess { false }; > uint32_t m_downloadMonitorSpeedMultiplier { 1 }; >+ WTF::String m_hstsStorageDirectory; > > #if PLATFORM(IOS_FAMILY) > WTF::String m_ctDataConnectionServiceType; >Index: Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h (revision 245034) >+++ Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h (working copy) >@@ -70,6 +70,7 @@ WK_CLASS_AVAILABLE(macos(10.10), ios(8.0 > @property (nonatomic) BOOL suppressesConnectionTerminationOnSystemChange WK_API_AVAILABLE(macos(10.14), ios(12.0)); > @property (nonatomic, getter=isJITEnabled) BOOL JITEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); > @property (nonatomic) NSUInteger downloadMonitorSpeedMultiplierForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); >+@property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); > > @end > >Index: Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm (revision 245034) >+++ Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm (working copy) >@@ -328,6 +328,20 @@ - (NSUInteger)downloadMonitorSpeedMultip > return _processPoolConfiguration->downloadMonitorSpeedMultiplier(); > } > >+- (void)setHSTSStorageDirectory:(NSURL *)directory >+{ >+ if (directory && ![directory isFileURL]) >+ [NSException raise:NSInvalidArgumentException format:@"%@ is not a file URL", directory]; >+ >+ // FIXME: Move this to _WKWebsiteDataStoreConfiguration once rdar://problem/50109631 is fixed. >+ _processPoolConfiguration->setHSTSStorageDirectory(directory.path); >+} >+ >+- (NSURL *)hstsStorageDirectory >+{ >+ return [NSURL fileURLWithPath:_processPoolConfiguration->hstsStorageDirectory() isDirectory:YES]; >+} >+ > - (void)setDownloadMonitorSpeedMultiplierForTesting:(NSUInteger)multiplier > { > _processPoolConfiguration->setDownloadMonitorSpeedMultiplier(multiplier);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197259
:
368200
| 369335