Title: [239892] tags/Safari-607.1.20.1/Source
Revision
239892
Author
[email protected]
Date
2019-01-11 17:50:27 -0800 (Fri, 11 Jan 2019)

Log Message

Cherry-pick r239792. rdar://problem/46627875

    Expand use of sourceApplicationAuditData
    https://bugs.webkit.org/show_bug.cgi?id=192995
    <rdar://problem/46627875>

    Reviewed by Brady Eidson.

    Source/WebKit:

    sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
    I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
    The NetworkProcess needed an additional entitlement on Mac to continue to load anything, which is desirable.

    * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
    (WebKit::NetworkProcess::sourceApplicationAuditData const):
    * Platform/IPC/Connection.h:
    * Platform/IPC/mac/ConnectionMac.mm:
    (IPC::Connection::getAuditToken):
    * WebProcess/WebProcess.cpp:
    (WebKit::WebProcess::initializeWebProcess):
    * WebProcess/cocoa/WebProcessCocoa.mm:
    (WebKit::WebProcess::sourceApplicationAuditData const):

    Source/WTF:

    * wtf/Platform.h:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239792 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: tags/Safari-607.1.20.1/Source/WTF/ChangeLog (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WTF/ChangeLog	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WTF/ChangeLog	2019-01-12 01:50:27 UTC (rev 239892)
@@ -1,3 +1,47 @@
+2019-01-11  Alan Coon  <[email protected]>
+
+        Cherry-pick r239792. rdar://problem/46627875
+
+    Expand use of sourceApplicationAuditData
+    https://bugs.webkit.org/show_bug.cgi?id=192995
+    <rdar://problem/46627875>
+    
+    Reviewed by Brady Eidson.
+    
+    Source/WebKit:
+    
+    sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
+    I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
+    The NetworkProcess needed an additional entitlement on Mac to continue to load anything, which is desirable.
+    
+    * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+    (WebKit::NetworkProcess::sourceApplicationAuditData const):
+    * Platform/IPC/Connection.h:
+    * Platform/IPC/mac/ConnectionMac.mm:
+    (IPC::Connection::getAuditToken):
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::initializeWebProcess):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::sourceApplicationAuditData const):
+    
+    Source/WTF:
+    
+    * wtf/Platform.h:
+    
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239792 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-09  Alex Christensen  <[email protected]>
+
+            Expand use of sourceApplicationAuditData
+            https://bugs.webkit.org/show_bug.cgi?id=192995
+            <rdar://problem/46627875>
+
+            Reviewed by Brady Eidson.
+
+            * wtf/Platform.h:
+
 2019-01-02  Alex Christensen  <[email protected]>
 
         Homograph with LATIN SMALL LETTER R WITH FISHHOOK

Modified: tags/Safari-607.1.20.1/Source/WTF/wtf/Platform.h (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WTF/wtf/Platform.h	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WTF/wtf/Platform.h	2019-01-12 01:50:27 UTC (rev 239892)
@@ -1359,6 +1359,10 @@
 #define HAVE_RSA_PSS 1
 #endif
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || PLATFORM(IOS_FAMILY)
+#define USE_SOURCE_APPLICATION_AUDIT_DATA 1
+#endif
+
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || PLATFORM(IOS) || PLATFORM(IOSMAC)
 #define HAVE_URL_FORMATTING 1
 #endif

Modified: tags/Safari-607.1.20.1/Source/WebKit/ChangeLog (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/ChangeLog	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/ChangeLog	2019-01-12 01:50:27 UTC (rev 239892)
@@ -1,3 +1,59 @@
+2019-01-11  Alan Coon  <[email protected]>
+
+        Cherry-pick r239792. rdar://problem/46627875
+
+    Expand use of sourceApplicationAuditData
+    https://bugs.webkit.org/show_bug.cgi?id=192995
+    <rdar://problem/46627875>
+    
+    Reviewed by Brady Eidson.
+    
+    Source/WebKit:
+    
+    sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
+    I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
+    The NetworkProcess needed an additional entitlement on Mac to continue to load anything, which is desirable.
+    
+    * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+    (WebKit::NetworkProcess::sourceApplicationAuditData const):
+    * Platform/IPC/Connection.h:
+    * Platform/IPC/mac/ConnectionMac.mm:
+    (IPC::Connection::getAuditToken):
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::initializeWebProcess):
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::sourceApplicationAuditData const):
+    
+    Source/WTF:
+    
+    * wtf/Platform.h:
+    
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239792 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-09  Alex Christensen  <[email protected]>
+
+            Expand use of sourceApplicationAuditData
+            https://bugs.webkit.org/show_bug.cgi?id=192995
+            <rdar://problem/46627875>
+
+            Reviewed by Brady Eidson.
+
+            sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
+            I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
+            The NetworkProcess needed an additional entitlement on Mac to continue to load anything, which is desirable.
+
+            * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+            (WebKit::NetworkProcess::sourceApplicationAuditData const):
+            * Platform/IPC/Connection.h:
+            * Platform/IPC/mac/ConnectionMac.mm:
+            (IPC::Connection::getAuditToken):
+            * WebProcess/WebProcess.cpp:
+            (WebKit::WebProcess::initializeWebProcess):
+            * WebProcess/cocoa/WebProcessCocoa.mm:
+            (WebKit::WebProcess::sourceApplicationAuditData const):
+
 2019-01-09  Alan Coon  <[email protected]>
 
         Cherry-pick r239776. rdar://problem/47147610

Added: tags/Safari-607.1.20.1/Source/WebKit/Configurations/Network-OSX-restricted.entitlements (0 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/Configurations/Network-OSX-restricted.entitlements	                        (rev 0)
+++ tags/Safari-607.1.20.1/Source/WebKit/Configurations/Network-OSX-restricted.entitlements	2019-01-12 01:50:27 UTC (rev 239892)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>com.apple.private.network.socket-delegate</key>
+	<true/>
+</dict>
+</plist>

Modified: tags/Safari-607.1.20.1/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2019-01-12 01:50:27 UTC (rev 239892)
@@ -133,12 +133,14 @@
 
 RetainPtr<CFDataRef> NetworkProcess::sourceApplicationAuditData() const
 {
-#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOSMAC)
-    audit_token_t auditToken;
+#if USE(SOURCE_APPLICATION_AUDIT_DATA)
     ASSERT(parentProcessConnection());
-    if (!parentProcessConnection() || !parentProcessConnection()->getAuditToken(auditToken))
+    if (!parentProcessConnection())
         return nullptr;
-    return adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
+    Optional<audit_token_t> auditToken = parentProcessConnection()->getAuditToken();
+    if (!auditToken)
+        return nullptr;
+    return adoptCF(CFDataCreate(nullptr, (const UInt8*)&*auditToken, sizeof(*auditToken)));
 #else
     return nullptr;
 #endif

Modified: tags/Safari-607.1.20.1/Source/WebKit/Platform/IPC/Connection.h (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/Platform/IPC/Connection.h	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/Platform/IPC/Connection.h	2019-01-12 01:50:27 UTC (rev 239892)
@@ -137,7 +137,7 @@
     };
     static bool identifierIsValid(Identifier identifier) { return MACH_PORT_VALID(identifier.port); }
     xpc_connection_t xpcConnection() const { return m_xpcConnection.get(); }
-    bool getAuditToken(audit_token_t&);
+    Optional<audit_token_t> getAuditToken();
     pid_t remoteProcessID() const;
 #elif OS(WINDOWS)
     typedef HANDLE Identifier;

Modified: tags/Safari-607.1.20.1/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm	2019-01-12 01:50:27 UTC (rev 239892)
@@ -603,13 +603,14 @@
     return Identifier(m_isServer ? m_receivePort : m_sendPort, m_xpcConnection);
 }
 
-bool Connection::getAuditToken(audit_token_t& auditToken)
+Optional<audit_token_t> Connection::getAuditToken()
 {
     if (!m_xpcConnection)
-        return false;
+        return WTF::nullopt;
     
+    audit_token_t auditToken;
     xpc_connection_get_audit_token(m_xpcConnection.get(), &auditToken);
-    return true;
+    return WTFMove(auditToken);
 }
 
 bool Connection::kill()

Modified: tags/Safari-607.1.20.1/Source/WebKit/Scripts/process-network-sandbox-entitlements.sh (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/Scripts/process-network-sandbox-entitlements.sh	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/Scripts/process-network-sandbox-entitlements.sh	2019-01-12 01:50:27 UTC (rev 239892)
@@ -8,6 +8,11 @@
     if [[ ${WK_USE_RESTRICTED_ENTITLEMENTS} == "YES" ]]; then
         echo "Processing restricted entitlements for Internal SDK";
 
+        if (( ${TARGET_MAC_OS_X_VERSION_MAJOR} >= 101500 )); then
+            echo "Adding macOS platform entitlements.";
+            /usr/libexec/PlistBuddy -c "Merge Configurations/Network-OSX-restricted.entitlements" "${PROCESSED_XCENT_FILE}";
+        fi
+
         echo "Adding sandbox entitlements for Network process.";
         /usr/libexec/PlistBuddy -c "Merge Configurations/Network-OSX-sandbox.entitlements" "${PROCESSED_XCENT_FILE}";
     fi

Modified: tags/Safari-607.1.20.1/Source/WebKit/WebKit.xcodeproj/project.pbxproj (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-01-12 01:50:27 UTC (rev 239892)
@@ -3451,6 +3451,7 @@
 		5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKURLSchemeTaskPrivate.h; sourceTree = "<group>"; };
 		5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImplCocoa.mm; sourceTree = "<group>"; };
 		5C6CE6D31F59EA350007C6CB /* PageClientImplCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImplCocoa.h; sourceTree = "<group>"; };
+		5C6F4EED21E5B11300BC8380 /* Network-OSX-restricted.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Network-OSX-restricted.entitlements"; sourceTree = "<group>"; };
 		5C74300E21500492004BFA17 /* WKWebProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcess.h; sourceTree = "<group>"; };
 		5C74300F21500492004BFA17 /* WKWebProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebProcess.cpp; sourceTree = "<group>"; };
 		5C7706731D111D8B0012700F /* WebSocketProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSocketProvider.cpp; path = Network/WebSocketProvider.cpp; sourceTree = "<group>"; };
@@ -4833,6 +4834,7 @@
 				1A4F976C100E7B6600637A18 /* FeatureDefines.xcconfig */,
 				37119A7D20CCB64E002C6DC9 /* Network-iOS-minimalsimulator.entitlements */,
 				7C0BB9A918DCDF5A0006C086 /* Network-iOS.entitlements */,
+				5C6F4EED21E5B11300BC8380 /* Network-OSX-restricted.entitlements */,
 				41D0FC7D20E43A5100076AE8 /* Network-OSX-sandbox.entitlements */,
 				5C7ACFD1218DD8BD004CBB59 /* Network-OSX.entitlements */,
 				BC8283AB16B4BEAD00A278FE /* NetworkService.xcconfig */,

Modified: tags/Safari-607.1.20.1/Source/WebKit/WebProcess/WebProcess.cpp (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/WebProcess/WebProcess.cpp	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/WebProcess/WebProcess.cpp	2019-01-12 01:50:27 UTC (rev 239892)
@@ -401,9 +401,8 @@
 #endif
 
 #if ENABLE(REMOTE_INSPECTOR) && PLATFORM(COCOA)
-    audit_token_t auditToken;
-    if (parentProcessConnection()->getAuditToken(auditToken)) {
-        RetainPtr<CFDataRef> auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
+    if (Optional<audit_token_t> auditToken = parentProcessConnection()->getAuditToken()) {
+        RetainPtr<CFDataRef> auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&*auditToken, sizeof(*auditToken)));
         Inspector::RemoteInspector::singleton().setParentProcessInformation(WebCore::presentingApplicationPID(), auditData);
     }
 #endif

Modified: tags/Safari-607.1.20.1/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (239891 => 239892)


--- tags/Safari-607.1.20.1/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-01-12 01:49:10 UTC (rev 239891)
+++ tags/Safari-607.1.20.1/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-01-12 01:50:27 UTC (rev 239892)
@@ -417,12 +417,14 @@
 
 RetainPtr<CFDataRef> WebProcess::sourceApplicationAuditData() const
 {
-#if PLATFORM(IOS_FAMILY)
-    audit_token_t auditToken;
+#if USE(SOURCE_APPLICATION_AUDIT_DATA)
     ASSERT(parentProcessConnection());
-    if (!parentProcessConnection() || !parentProcessConnection()->getAuditToken(auditToken))
+    if (!parentProcessConnection())
         return nullptr;
-    return adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
+    Optional<audit_token_t> auditToken = parentProcessConnection()->getAuditToken();
+    if (!auditToken)
+        return nullptr;
+    return adoptCF(CFDataCreate(nullptr, (const UInt8*)&*auditToken, sizeof(*auditToken)));
 #else
     return nullptr;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to