4bd77bf5fcf394dc9dfba2393f8dcfcf9aa67172
[WebKit-https.git] / Source / WebKit2 / WebProcess / com.apple.WebProcess.sb
1 (version 1)
2 (deny default (with partial-symbolication))
3 (allow ipc-posix-shm system-audit system-socket file-read-metadata)
4
5 (import "system.sb")
6 (import "com.apple.corefoundation.sb")
7
8 ;; Distributed notifications, local pasteboard client
9 (corefoundation)
10
11 ;; Utility functions for home directory relative path filters
12 (define (home-regex home-relative-regex)
13   (regex (string-append "^" (regex-quote (param "HOME_DIR")) home-relative-regex)))
14
15 (define (home-subpath home-relative-subpath)
16   (subpath (string-append (param "HOME_DIR") home-relative-subpath)))
17
18 (define (home-literal home-relative-literal)
19   (literal (string-append (param "HOME_DIR") home-relative-literal)))
20
21 ;; Read-only preferences and data
22 (allow file-read*
23        ;; Basic system paths
24        (subpath "/Library/Dictionaries")
25        (subpath "/Library/Fonts")
26        (subpath "/Library/Frameworks")
27        (subpath "/Library/Keychains")
28        (subpath "/private/var/db/mds")
29        (subpath "/private/var/db/DetachedSignatures")
30        (regex #"^/private/etc/(hosts|group|passwd)$")
31
32        ;; System and user preferences
33        (literal "/Library/Preferences/.GlobalPreferences.plist")
34        (literal "/Library/Preferences/com.apple.crypto.plist")
35        (literal "/Library/Preferences/com.apple.security.plist")
36        (literal "/Library/Preferences/com.apple.security.common.plist")
37        (literal "/Library/Preferences/com.apple.security.revocation.plist")
38        (regex #"^/Library/Managed Preferences/[^/]+/com\.apple\.networkConnect\.plist$")
39        (home-literal "/Library/Preferences/.GlobalPreferences.plist")
40        (home-regex "/Library/Preferences/ByHost/\.GlobalPreferences\.")
41        (home-regex "/Library/Preferences/ByHost/com\.apple\.networkConnect\.")
42        (home-literal "/Library/Preferences/com.apple.ATS.plist")
43        (home-literal "/Library/Preferences/com.apple.DownloadAssessment.plist")
44        (home-literal "/Library/Preferences/com.apple.HIToolbox.plist")
45        (home-literal "/Library/Preferences/com.apple.LaunchServices.plist")
46        (home-literal "/Library/Preferences/com.apple.WebFoundation.plist")
47        (home-literal "/Library/Preferences/com.apple.security.plist")
48        (home-literal "/Library/Preferences/com.apple.security.revocation.plist")
49        (home-literal "/Library/Application Support/SyncServices/Local/ClientsWithChanges/com.apple.Keychain")
50        (home-regex "/Library/Preferences/com\.apple\.driver\.(AppleBluetoothMultitouch\.mouse|AppleBluetoothMultitouch\.trackpad|AppleHIDMouse)\.plist$")
51
52        ;; On-disk WebKit2 framework location, to account for debug installations
53        ;; outside of /System/Library/Frameworks
54        (subpath (param "WEBKIT2_FRAMEWORK_DIR"))
55
56        ;; FIXME: This should be removed when <rdar://problem/8957845> is fixed.
57        (home-subpath "/Library/Fonts")
58
59        ;; FIXME: These should be removed when <rdar://problem/9217757> is fixed.
60        (home-subpath "/Library/Audio/Plug-Ins/Components")
61        (home-subpath "/Library/Preferences/QuickTime Preferences")
62        (home-literal "/Library/Caches/com.apple.coreaudio.components.plist")
63        (subpath "/Library/Audio/Plug-Ins/Components")
64        (subpath "/Library/Audio/Plug-Ins/HAL")
65        (subpath "/Library/Video/Plug-Ins")
66        (subpath "/Library/QuickTime")
67
68        ;; FIXME: This should be removed when <rdar://problem/9276253> is fixed.
69        (home-subpath "/Library/Keyboard Layouts")
70
71        ;; FIXME: This should be removed when <rdar://problem/9276268> is fixed.
72        (home-subpath "/Library/Input Methods")
73
74        (home-subpath "/Library/Dictionaries"))
75
76 ;; This should be updated when <rdar://problem/9355830> is fixed.
77 ;; Read-only extensions from UIProcess
78 (if (defined? 'extension-class)
79     (allow file-read* (extension "com.apple.app-sandbox.read")))
80
81 ;; Read-write extensions from UIProcess
82 (allow file-read* file-write* (extension))
83
84 ;; Writable preferences and temporary files
85 (allow file*
86        (home-subpath "/Library/Caches/com.apple.WebProcess")
87        (home-regex "/Library/Preferences/ByHost/com\.apple\.HIToolbox\.")
88        (home-regex "/Library/Preferences/com\.apple\.WebProcess\.")
89        (home-subpath "/Library/Keychains")
90
91        ;; FIXME: This should be removed when <rdar://problem/9276430> is fixed.
92        (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2")
93        (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2-journal"))
94
95 (allow file-read-data
96        ;; FIXME: This should be removed when <rdar://problem/9276430> is fixed.
97        (home-literal "/Library/Preferences"))
98
99 ;; Non-user Security mds caches
100 (allow file*
101     (subpath "/private/var/db/mds/system"))
102
103 ;; Darwin temporary files and Security mds caches, if present
104 (if (positive? (string-length (param "DARWIN_USER_CACHE_DIR")))
105     (allow file* (subpath (string-append (param "DARWIN_USER_CACHE_DIR") "/mds"))))
106 (if (positive? (string-length (param "DARWIN_USER_TEMP_DIR")))
107     (allow file* (subpath (param "DARWIN_USER_TEMP_DIR"))))
108
109 ;; Database directory.
110 (if (positive? (string-length (param "WEBKIT_DATABASE_DIR")))
111     (allow file* (subpath (param "WEBKIT_DATABASE_DIR"))))
112
113 ;; LocalStorage directory.
114 (if (positive? (string-length (param "WEBKIT_LOCALSTORAGE_DIR")))
115     (allow file* (subpath (param "WEBKIT_LOCALSTORAGE_DIR"))))
116
117 ;; ApplicationCache directory.
118 (if (positive? (string-length (param "WEBKIT_APPLICATION_CACHE_DIR")))
119     (allow file* (subpath (param "WEBKIT_APPLICATION_CACHE_DIR"))))
120
121 ;; The Web Inspector directory.
122 (if (positive? (string-length (param "WEBKIT_WEB_INSPECTOR_DIR")))
123     (allow file-read* (subpath (param "WEBKIT_WEB_INSPECTOR_DIR"))))
124
125 ;; The NSURLCache directory.
126 (if (positive? (string-length (param "NSURL_CACHE_DIR")))
127     (allow file* (subpath (param "NSURL_CACHE_DIR"))))
128
129 ;; The bundle resource path of the UI process.
130 (if (positive? (string-length (param "UI_PROCESS_BUNDLE_RESOURCE_DIR")))
131     (allow file-read* (subpath (param "UI_PROCESS_BUNDLE_RESOURCE_DIR"))))
132
133 ;; IOKit user clients
134 (allow iokit-open
135        (iokit-connection "IOAccelerator")
136        (iokit-user-client-class "IOAccelerationUserClient")
137        (iokit-user-client-class "IOFramebufferSharedUserClient")
138        (iokit-user-client-class "AppleGraphicsControlClient")
139        (iokit-user-client-class "AGPMClient")
140        (iokit-user-client-class "IOHIDParamUserClient")
141        (iokit-user-client-class "RootDomainUserClient")
142        (iokit-user-client-class "IOSurfaceRootUserClient")
143        (iokit-user-client-class "IOSurfaceSendRight")
144        (iokit-user-client-class "IOAudioControlUserClient")
145        (iokit-user-client-class "IOAudioEngineUserClient"))
146
147 ;; Various services required by AppKit and other frameworks
148 (allow mach-lookup
149        (global-name "com.apple.CoreServices.coreservicesd")
150        (global-name "com.apple.DiskArbitration.diskarbitrationd")
151        (global-name "com.apple.FileCoordination")
152        (global-name "com.apple.FontObjectsServer")
153        (global-name "com.apple.FontServer")
154        (global-name "com.apple.SecurityServer")
155        (global-name "com.apple.SystemConfiguration.configd")
156        (global-name "com.apple.SystemConfiguration.PPPController")
157        (global-name "com.apple.audio.VDCAssistant")
158        (global-name "com.apple.audio.audiohald")
159        (global-name "com.apple.audio.coreaudiod")
160        (global-name "com.apple.cookied")
161        (global-name "com.apple.cvmsServ")
162        (global-name "com.apple.networkd")
163        (global-name "com.apple.dock.server")
164        (global-name "com.apple.ocspd")
165        (global-name "com.apple.pasteboard.1")
166        (global-name "com.apple.system.opendirectoryd.api")
167        (global-name "com.apple.window_proxies")
168        (global-name "com.apple.windowserver.active")
169
170         ;; FIXME: This will be superfluous once <rdar://problem/10420555> is fixed.
171        (global-name "com.apple.cfnetwork.AuthBrokerAgent")
172
173        ;; FIXME: This should be removed when <rdar://problem/9276393> is fixed.
174        (global-name "com.apple.metadata.mds"))
175
176 (allow system-socket (socket-domain AF_ROUTE))
177 (allow system-socket (require-all (socket-domain AF_SYSTEM) (socket-protocol 2))) ; SYSPROTO_CONTROL
178 (allow network-outbound
179        ;; Kernel controls
180        (control-name "com.apple.network.statistics")
181        (control-name "com.apple.netsrc")
182
183        ;; Local mDNSResponder for DNS, arbitrary outbound TCP
184        (literal "/private/var/run/mDNSResponder")
185        (remote tcp))
186
187 ;; FIXME: Once <rdar://problem/8900275> has been fixed, these rules can be removed.
188 (allow mach-lookup (global-name "com.apple.pubsub.ipc"))
189 (allow network-outbound (regex #"^/private/tmp/launch-[^/]+/Render"))
190 (allow file-read*
191        (home-literal "/Library/Preferences/com.apple.Safari.RSS.plist")
192        (home-literal "/Library/Preferences/com.apple.Syndication.plist"))
193
194 ;; FIXME should be removed when <rdar://problem/9347205> + related radar in Safari is fixed
195 (allow mach-lookup
196        (global-name "org.h5l.kcm")
197        (global-name "com.apple.system.logger")
198        (global-name "com.apple.system.notification_center"))
199 (allow network-outbound
200        (remote udp))
201 (allow file-read*
202         (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.Kerberos.plist"))
203         (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.GSS.plist"))
204         (literal (string-append (param "HOME_DIR") "/Library/Preferences/edu.mit.Kerberos"))
205         (literal "/Library/Preferences/com.apple.Kerberos.plist")
206         (literal "/Library/Preferences/com.apple.GSS.plist")
207         (literal "/Library/Preferences/edu.mit.Kerberos")
208         (literal "/private/etc/krb5.conf")
209         (literal "/private/etc/services")
210         (literal "/private/etc/host"))
211
212 ;; FIXME: Should be removed after <rdar://problem/9422957> is fixed
213 (deny file-read* file-write* (with no-log)
214       (home-literal "/Library/Caches/Cache.db"))