Title: [229168] trunk/Source
Revision
229168
Author
m...@apple.com
Date
2018-03-02 00:20:56 -0800 (Fri, 02 Mar 2018)

Log Message

Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
https://bugs.webkit.org/show_bug.cgi?id=183275

Reviewed by Tim Horton.

Source/WebKit:

* UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Return false if this is
  a platform binary. We can also return false unconditionally when building for any shipping
  major macOS release.

Source/WTF:

* wtf/spi/cocoa/SecuritySPI.h: Declared SecTaskGetCodeSignStatus.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (229167 => 229168)


--- trunk/Source/WTF/ChangeLog	2018-03-02 07:58:38 UTC (rev 229167)
+++ trunk/Source/WTF/ChangeLog	2018-03-02 08:20:56 UTC (rev 229168)
@@ -1,3 +1,12 @@
+2018-03-02  Dan Bernstein  <m...@apple.com>
+
+        Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
+        https://bugs.webkit.org/show_bug.cgi?id=183275
+
+        Reviewed by Tim Horton.
+
+        * wtf/spi/cocoa/SecuritySPI.h: Declared SecTaskGetCodeSignStatus.
+
 2018-02-27  Karlen Simonyan  <szkar...@gmail.com>
 
         [Win64] JSCOnly compile error using VS2017 and cmake

Modified: trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h (229167 => 229168)


--- trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h	2018-03-02 07:58:38 UTC (rev 229167)
+++ trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h	2018-03-02 08:20:56 UTC (rev 229168)
@@ -71,6 +71,7 @@
 CFStringRef SecTaskCopySigningIdentifier(SecTaskRef, CFErrorRef *);
 extern const SecAsn1Template kSecAsn1AlgorithmIDTemplate[];
 extern const SecAsn1Template kSecAsn1SubjectPublicKeyInfoTemplate[];
+uint32_t SecTaskGetCodeSignStatus(SecTaskRef);
 #endif
 
 #if HAVE(SEC_TRUST_SERIALIZATION)

Modified: trunk/Source/WebKit/ChangeLog (229167 => 229168)


--- trunk/Source/WebKit/ChangeLog	2018-03-02 07:58:38 UTC (rev 229167)
+++ trunk/Source/WebKit/ChangeLog	2018-03-02 08:20:56 UTC (rev 229168)
@@ -1,3 +1,15 @@
+2018-03-02  Dan Bernstein  <m...@apple.com>
+
+        Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
+        https://bugs.webkit.org/show_bug.cgi?id=183275
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/mac/WebProcessProxyMac.mm:
+        (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Return false if this is
+          a platform binary. We can also return false unconditionally when building for any shipping
+          major macOS release.
+
 2018-03-01  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r229153.

Modified: trunk/Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm (229167 => 229168)


--- trunk/Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm	2018-03-02 07:58:38 UTC (rev 229167)
+++ trunk/Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm	2018-03-02 08:20:56 UTC (rev 229168)
@@ -31,6 +31,11 @@
 
 #import "WKFullKeyboardAccessWatcher.h"
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#import <Kernel/kern/cs_blobs.h>
+#import <wtf/spi/cocoa/SecuritySPI.h>
+#endif
+
 namespace WebKit {
 
 bool WebProcessProxy::fullKeyboardAccessEnabled()
@@ -40,6 +45,7 @@
 
 bool WebProcessProxy::shouldAllowNonValidInjectedCode() const
 {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     static bool isSystemWebKit = [] {
 #if WK_API_ENABLED
         NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];
@@ -52,8 +58,15 @@
     if (!isSystemWebKit)
         return false;
 
+    static bool isPlatformBinary = SecTaskGetCodeSignStatus(adoptCF(SecTaskCreateFromSelf(kCFAllocatorDefault)).get()) & CS_PLATFORM_BINARY;
+    if (isPlatformBinary)
+        return false;
+
     const String& path = m_processPool->configuration().injectedBundlePath();
     return !path.isEmpty() && !path.startsWith("/System/");
+#else
+    return false;
+#endif
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to