summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
blob: cdb236d62c7e37770b7c4453f7191539526c27d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
(version 1)
(deny default (with partial-symbolication))
(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)))

(define (home-subpath home-relative-subpath)
  (subpath (string-append (param "HOME_DIR") home-relative-subpath)))

(define (home-literal home-relative-literal)
  (literal (string-append (param "HOME_DIR") home-relative-literal)))

;; Read-only preferences and data
(allow file-read*
       ;; Basic system paths
       (subpath "/Library/Dictionaries")
       (subpath "/Library/Fonts")
       (subpath "/Library/Frameworks")
       (subpath "/Library/Keychains")
       (subpath "/private/var/db/mds")
       (subpath "/private/var/db/DetachedSignatures")
       (regex #"^/private/etc/(hosts|group|passwd)$")

       ;; Plugins
       (subpath "/Library/Internet Plug-Ins")
       (home-subpath "/Library/Internet Plug-Ins")

       ;; System and user preferences
       (literal "/Library/Preferences/.GlobalPreferences.plist")
       (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")
       (regex #"^/Library/Managed Preferences/[^/]+/com\.apple\.networkConnect\.plist$")
       (home-literal "/Library/Preferences/.GlobalPreferences.plist")
       (home-regex "/Library/Preferences/ByHost/\.GlobalPreferences\.")
       (home-regex "/Library/Preferences/ByHost/com\.apple\.networkConnect\.")
       (home-literal "/Library/Preferences/com.apple.ATS.plist")
       (home-literal "/Library/Preferences/com.apple.DownloadAssessment.plist")
       (home-literal "/Library/Preferences/com.apple.HIToolbox.plist")
       (home-literal "/Library/Preferences/com.apple.LaunchServices.plist")
       (home-literal "/Library/Preferences/com.apple.WebFoundation.plist")
       (home-literal "/Library/Preferences/com.apple.security.plist")
       (home-literal "/Library/Preferences/com.apple.security.revocation.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$")

       ;; On-disk WebKit2 framework location, to account for debug installations
       ;; outside of /System/Library/Frameworks
       (subpath (param "WEBKIT2_FRAMEWORK_DIR"))

       ;; FIXME: This should be removed when <rdar://problem/8957845> is fixed.
       (home-subpath "/Library/Fonts")

       ;; FIXME: These should be removed when <rdar://problem/9217757> is fixed.
       (home-subpath "/Library/Audio/Plug-Ins/Components")
       (home-subpath "/Library/Preferences/QuickTime Preferences")
       (home-literal "/Library/Caches/com.apple.coreaudio.components.plist")
       (subpath "/Library/Audio/Plug-Ins/Components")
       (subpath "/Library/Audio/Plug-Ins/HAL")
       (subpath "/Library/Video/Plug-Ins")
       (subpath "/Library/QuickTime")

       ;; FIXME: This should be removed when <rdar://problem/9237619> is fixed.
       (home-literal "/Library/Preferences/com.apple.universalaccess.plist")

       ;; FIXME: This should be removed when <rdar://problem/9276253> is fixed.
       (home-subpath "/Library/Keyboard Layouts")

       ;; FIXME: This should be removed when <rdar://problem/9276268> is fixed.
       (home-subpath "/Library/Input Methods")

       (home-subpath "/Library/Dictionaries"))

;; This should be updated when <rdar://problem/9355830> is fixed.
;; Read-only extensions from UIProcess
(if (defined? 'extension-class)
    (allow file-read* (extension "com.apple.app-sandbox.read")))

;; Read-write extensions from UIProcess
(allow file-read* file-write* (extension))

;; Writable preferences and temporary files
(allow file*
       (home-subpath "/Library/Caches/com.apple.WebProcess")
       (home-regex "/Library/Preferences/ByHost/com\.apple\.HIToolbox\.")
       (home-regex "/Library/Preferences/com\.apple\.WebProcess\.")
       (home-subpath "/Library/Keychains")

       ;; FIXME: This should be removed when <rdar://problem/9276430> is fixed.
       (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2"))

;; Darwin temporary files and Security mds caches, if present
(if (positive? (string-length (param "DARWIN_USER_CACHE_DIR")))
    (allow file* (subpath (string-append (param "DARWIN_USER_CACHE_DIR") "/mds"))))
(if (positive? (string-length (param "DARWIN_USER_TEMP_DIR")))
    (allow file* (subpath (param "DARWIN_USER_TEMP_DIR"))))

;; Database dir
(if (positive? (string-length (param "WEBKIT_DATABASE_DIR")))
    (allow file* (subpath (param "WEBKIT_DATABASE_DIR"))))

;; LocalStorage dir
(if (positive? (string-length (param "WEBKIT_LOCALSTORAGE_DIR")))
    (allow file* (subpath (param "WEBKIT_LOCALSTORAGE_DIR"))))

;; The NSURLCache directory.
(if (positive? (string-length (param "NSURL_CACHE_DIR")))
    (allow file* (subpath (param "NSURL_CACHE_DIR"))))

;; The bundle resource path of the UI process.
(if (positive? (string-length (param "UI_PROCESS_BUNDLE_RESOURCE_DIR")))
    (allow file-read* (subpath (param "UI_PROCESS_BUNDLE_RESOURCE_DIR"))))

;; IOKit user clients
(allow iokit-open
       (iokit-connection "IOAccelerator")
       (iokit-user-client-class "IOAccelerationUserClient")
       (iokit-user-client-class "IOFramebufferSharedUserClient")
       (iokit-user-client-class "AppleGraphicsControlClient")
       (iokit-user-client-class "AGPMClient")
       (iokit-user-client-class "IOHIDParamUserClient")
       (iokit-user-client-class "RootDomainUserClient")
       (iokit-user-client-class "IOSurfaceRootUserClient")
       (iokit-user-client-class "IOSurfaceSendRight")
       (iokit-user-client-class "IOAudioControlUserClient")
       (iokit-user-client-class "IOAudioEngineUserClient"))

;; 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")
       (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.window_proxies")
       (global-name "com.apple.windowserver.active")
       (global-name-regex #"^com\.apple\.WebKit\.WebProcess-")

       ;; FIXME: This should be removed when <rdar://problem/9276393> is fixed.
       (global-name "com.apple.metadata.mds"))

(allow system-socket (socket-domain AF_ROUTE))
(allow system-socket (require-all (socket-domain AF_SYSTEM) (socket-protocol 2))) ; SYSPROTO_CONTROL
(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))

;; FIXME: Once <rdar://problem/8900275> has been fixed, these rules can be removed.
(allow mach-lookup (global-name "com.apple.pubsub.ipc"))
(allow network-outbound (regex #"^/private/tmp/launch-[^/]+/Render"))
(allow file-read*
       (home-literal "/Library/Preferences/com.apple.Safari.RSS.plist")
       (home-literal "/Library/Preferences/com.apple.Syndication.plist"))