Title: [141445] trunk/Source/WebKit2
Revision
141445
Author
[email protected]
Date
2013-01-31 11:05:30 -0800 (Thu, 31 Jan 2013)

Log Message

        WebProcess sandbox profile overhaul.

        Reviewed by Sam Weinig.

        Moves some rules together by susbystem for easier maintenance.

        Addresses <rdar://problem/9276393>, <rdar://problem/10844321>, <rdar://problem/12408537>,
        <rdar://problem/12558524>.

        * WebProcess/com.apple.WebProcess.sb.in:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (141444 => 141445)


--- trunk/Source/WebKit2/ChangeLog	2013-01-31 19:01:31 UTC (rev 141444)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-31 19:05:30 UTC (rev 141445)
@@ -1,3 +1,16 @@
+2013-01-31  Alexey Proskuryakov  <[email protected]>
+
+        WebProcess sandbox profile overhaul.
+
+        Reviewed by Sam Weinig.
+
+        Moves some rules together by susbystem for easier maintenance.
+
+        Addresses <rdar://problem/9276393>, <rdar://problem/10844321>, <rdar://problem/12408537>,
+        <rdar://problem/12558524>.
+
+        * WebProcess/com.apple.WebProcess.sb.in:
+
 2013-01-31  Simon Hausmann  <[email protected]>
 
         Unreviewed trivial build fix: Pre C++11 the use of

Modified: trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in (141444 => 141445)


--- trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in	2013-01-31 19:01:31 UTC (rev 141444)
+++ trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in	2013-01-31 19:05:30 UTC (rev 141445)
@@ -3,11 +3,7 @@
 (allow ipc-posix-shm system-audit system-socket file-read-metadata)
 
 (import "system.sb")
-(import "com.apple.corefoundation.sb")
 
-;; Distributed notifications, local pasteboard client
-(corefoundation)
-
 ;; Utility functions for home directory relative path filters
 (define (home-regex home-relative-regex)
   (regex (string-append "^" (regex-quote (param "HOME_DIR")) home-relative-regex)))
@@ -24,6 +20,24 @@
             (allow file-read* (subpath path))
             (allow file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read") (subpath path))))))
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
+;; Low level networking. Defined in system.sb on newer OS versions.
+(define (system-network)
+  (allow file-read*
+         (literal "/Library/Preferences/com.apple.networkd.plist"))
+  (allow mach-lookup
+         (global-name "com.apple.SystemConfiguration.PPPController") ;; FIXME (13121943): Is this necessary?
+         (global-name "com.apple.SystemConfiguration.SCNetworkReachability")
+         (global-name "com.apple.networkd"))
+  (allow network-outbound
+         (control-name "com.apple.netsrc")
+         (control-name "com.apple.network.statistics"))
+  (allow system-socket
+         (require-all (socket-domain AF_SYSTEM)
+                      (socket-protocol 2)) ; SYSPROTO_CONTROL
+         (socket-domain AF_ROUTE)))
+#endif
+
 ;; Read-only preferences and data
 (allow file-read*
        ;; Basic system paths
@@ -31,20 +45,10 @@
        (subpath "/Library/Fonts")
        (subpath "/Library/Frameworks")
        (subpath "/Library/Managed Preferences")
-       (subpath "/private/var/db/mds")
-       (subpath "/private/var/db/DetachedSignatures")
        (regex #"^/private/etc/(hosts|group|passwd)$")
 
-       ;; FIXME: This should be removed when <rdar://problem/10479685> is fixed.
-       (subpath "/Library/Keychains")
-
        ;; System and user preferences
        (literal "/Library/Preferences/.GlobalPreferences.plist")
-       (literal "/Library/Preferences/com.apple.crypto.plist")
-       (literal "/Library/Preferences/com.apple.networkd.plist")
-       (literal "/Library/Preferences/com.apple.security.plist")
-       (literal "/Library/Preferences/com.apple.security.common.plist")
-       (literal "/Library/Preferences/com.apple.security.revocation.plist")
        (regex #"^/Library/Managed Preferences/[^/]+/com\.apple\.networkConnect\.plist$")
        (home-literal "/Library/Preferences/.GlobalPreferences.plist")
        (home-regex #"/Library/Preferences/ByHost/\.GlobalPreferences\.")
@@ -58,10 +62,6 @@
        (home-literal "/Library/Preferences/com.apple.WebFoundation.plist")
        (home-literal "/Library/Preferences/com.apple.avfoundation.plist")
        (home-literal "/Library/Preferences/com.apple.coremedia.plist")
-       (home-literal "/Library/Preferences/com.apple.security.plist")
-       (home-literal "/Library/Preferences/com.apple.security.revocation.plist")
-       (home-literal "/Library/Preferences/com.apple.speech.recognition.AppleSpeechRecognition.prefs.plist")
-       (home-literal "/Library/Application Support/SyncServices/Local/ClientsWithChanges/com.apple.Keychain")
        (home-regex #"/Library/Preferences/com\.apple\.driver\.(AppleBluetoothMultitouch\.mouse|AppleBluetoothMultitouch\.trackpad|AppleHIDMouse)\.plist$")
 
        ;; FIXME: This should be removed when <rdar://problem/8957845> is fixed.
@@ -101,15 +101,8 @@
 ;; Writable preferences and temporary files
 (allow file*
        (home-regex #"/Library/Preferences/ByHost/com\.apple\.HIToolbox\.")
-       (home-regex #"/Library/Preferences/com\.apple\.WebProcess\.")
+       (home-regex #"/Library/Preferences/com\.apple\.WebProcess\."))
 
-       ;; FIXME: This should be removed when <rdar://problem/10479685> is fixed.
-       (home-subpath "/Library/Keychains"))
-
-;; Non-user Security mds caches
-(allow file*
-    (subpath "/private/var/db/mds/system"))
-
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
 (if (positive? (string-length (param "DARWIN_USER_CACHE_DIR")))
     (allow file* (subpath (param "DARWIN_USER_CACHE_DIR"))))
@@ -139,24 +132,18 @@
 
 ;; Various services required by AppKit and other frameworks
 (allow mach-lookup
-       (global-name "com.apple.CoreServices.coreservicesd")
        (global-name "com.apple.DiskArbitration.diskarbitrationd")
        (global-name "com.apple.FileCoordination")
        (global-name "com.apple.FontObjectsServer")
        (global-name "com.apple.FontServer")
-       (global-name "com.apple.SecurityServer")
        (global-name "com.apple.SystemConfiguration.configd")
        (global-name "com.apple.SystemConfiguration.PPPController") ;; FIXME (13121943): Is this necessary?
-       (global-name "com.apple.SystemConfiguration.SCNetworkReachability")
        (global-name "com.apple.audio.VDCAssistant")
        (global-name "com.apple.audio.audiohald")
        (global-name "com.apple.audio.coreaudiod")
        (global-name "com.apple.cookied")
        (global-name "com.apple.cvmsServ")
-       (global-name "com.apple.networkd")
        (global-name "com.apple.dock.server")
-       (global-name "com.apple.ocspd")
-       (global-name "com.apple.pasteboard.1")
        (global-name "com.apple.system.opendirectoryd.api")
        (global-name "com.apple.tccd")
        (global-name "com.apple.tccd.system")
@@ -164,26 +151,50 @@
        (global-name "com.apple.windowserver.active")
        (global-name "com.apple.cfnetwork.AuthBrokerAgent")
        (global-name "com.apple.PowerManagement.control")
-       (global-name "com.apple.speech.recognitionserver")
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
        (global-name "com.apple.coreservices.launchservicesd")
 #endif
+)
 
-       ;; FIXME: This should be removed when <rdar://problem/9276393> is fixed.
-       (global-name "com.apple.metadata.mds"))
+;; Security framework
+(allow mach-lookup
+       (global-name "com.apple.ocspd")
+       (global-name "com.apple.SecurityServer"))
+(allow file-read* file-write* (home-subpath "/Library/Keychains")) ;; FIXME: This should be removed when <rdar://problem/10479685> is fixed.
+(allow file-read*
+       (subpath "/Library/Keychains")
+       (subpath "/private/var/db/mds")
+       (literal "/private/var/db/DetachedSignatures")
+       (literal "/Library/Preferences/com.apple.crypto.plist")
+       (literal "/Library/Preferences/com.apple.security.plist")
+       (literal "/Library/Preferences/com.apple.security.common.plist")
+       (literal "/Library/Preferences/com.apple.security.revocation.plist")
+       (home-literal "/Library/Application Support/SyncServices/Local/ClientsWithChanges/com.apple.Keychain")
+       (home-literal "/Library/Preferences/com.apple.security.plist")
+       (home-literal "/Library/Preferences/com.apple.security.revocation.plist"))
 
-(allow system-socket (socket-domain AF_ROUTE))
-(allow system-socket (require-all (socket-domain AF_SYSTEM) (socket-protocol 2))) ; SYSPROTO_CONTROL
+;; CoreFoundation. We don't import com.apple.corefoundation.sb, because it allows unnecessary access to pasteboard.
+(allow mach-lookup
+    (global-name-regex #"^com.apple.distributed_notifications")                                                       
+    (global-name "com.apple.CoreServices.coreservicesd"))
+(allow file-read-data
+     (literal "/dev/autofs_nowait")) ; Used by CF to circumvent automount triggers
+
+;; Networking
+(system-network)
 (allow network-outbound
-       ;; Kernel controls
-       (control-name "com.apple.network.statistics")
-       (control-name "com.apple.netsrc")
-
        ;; Local mDNSResponder for DNS, arbitrary outbound TCP
        (literal "/private/var/run/mDNSResponder")
        (remote tcp))
 
+;; Needed for NSAttributedString, <rdar://problem/10844321>.
+(allow file-read*
+       (home-literal "/Library/Preferences/pbs.plist")
+       (home-literal "/Library/Preferences/com.apple.ServicesMenu.Services.plist"))
+(allow mach-lookup
+       (global-name "com.apple.pbs.fetch_services"))
+
 ;; FIXME should be removed when <rdar://problem/9347205> + related radar in Safari is fixed
 (allow mach-lookup
        (global-name "org.h5l.kcm")
@@ -202,16 +213,23 @@
         (literal "/private/etc/services")
         (literal "/private/etc/host"))
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+(deny file-write-create (vnode-type SYMLINK))
+#endif
+
 (deny file-read* file-write* (with no-log)
-       ;; FIXME: Should be removed after <rdar://problem/9422957> is fixed.
-       (home-literal "/Library/Caches/Cache.db")
+#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
+       (home-literal "/Library/Caches/Cache.db") ;; <rdar://problem/9422957>
+#endif
 
        ;; FIXME: Should be removed after <rdar://problem/10463881> is fixed.
        (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2")
        (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2-journal"))
 
+;; Deny access needed for unnecessary NSApplication initialization.
+;; FIXME: This can be removed once <rdar://problem/13011633> is fixed.
 (deny file-read* (with no-log)
-       ;; FIXME: This should not be necessary once <rdar://problem/13011633> is fixed.
+       (home-literal "/Library/Preferences/com.apple.speech.recognition.AppleSpeechRecognition.prefs.plist")
        (subpath "/Library/Components")
        (subpath "/Library/Keyboard Layouts")
        (subpath "/Library/Input Methods")
@@ -223,9 +241,10 @@
        (literal (string-append (param "DARWIN_USER_CACHE_DIR") "/com.apple.IntlDataCache.le.kbdx"))
 #endif
        )
-
 (deny mach-lookup (with no-log)
-       (global-name "com.apple.coreservices.appleevents"))
+       (global-name "com.apple.coreservices.appleevents")
+       (global-name "com.apple.pasteboard.1")
+       (global-name "com.apple.speech.recognitionserver"))
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
 ;; FIXME: This should be removed, see <rdar://problem/12976385>.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to