;;; Copyright (c) 2017 Apple Inc. All Rights reserved. ;;; ;;; WARNING: The sandbox rules in this file currently constitute ;;; Apple System Private Interface and are subject to change at any time and ;;; without notice. ;;; (version 1) (deny default) (deny file-map-executable iokit-get-properties process-info* nvram*) (deny dynamic-code-generation) (deny mach-priv-host-port) (import "system.sb") (import "com.apple.corefoundation.sb") (corefoundation) ;;; Homedir-relative path filters (define (home-regex home-relative-regex) (regex (string-append "^" (regex-quote (param "HOME")) home-relative-regex))) (define (home-subpath home-relative-subpath) (subpath (string-append (param "HOME") home-relative-subpath))) (define (home-prefix home-relative-prefix) (prefix (string-append (param "HOME") home-relative-prefix))) (define (home-literal home-relative-literal) (literal (string-append (param "HOME") home-relative-literal))) (allow process-info* (target self)) ;; For resolving symlinks, realpath(3), and equivalents. (allow file-read-metadata) ;; For validating the entitlements of clients. (allow process-info-codesignature) ;; Your preference domain (allow user-preference-read user-preference-write (preference-domain "com.apple.AdLib") (preference-domain "com.apple.AdPlatforms") (preference-domain "com.apple.AppStore") (preference-domain "com.apple.ap.adprivacyd")) (allow user-preference-read (preference-domain "com.apple.security.plist") (preference-domain "com.apple.CloudKit") (preference-domain "com.apple.AppleMediaServices") (preference-domain "com.apple.itunesstored") (preference-domain "com.apple.CFNetwork") (preference-domain "com.apple.nsurlcache") (preference-domain "com.apple.amsengagementd") (preference-domain "kCFPreferencesAnyApplication")) ;; Allow to read /usr/libexec and /usr/libexec/adprivacyd (allow file-read-data (literal "/usr/libexec") (literal "/usr/libexec/adprivacyd")) ;; Read/write access to a temporary directory. (allow file-read* file-write* (subpath (param "DARWIN_USER_TEMP")) (subpath (param "DARWIN_CACHE_DIR"))) ;; Read/write cache access (let ((cache-path-filter (home-subpath "/Library/Caches/com.apple.ap.adprivacyd"))) (allow file-read* file-write* cache-path-filter) (allow file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read" "com.apple.app-sandbox.read-write") cache-path-filter))) (let ((cache-path-filter (home-subpath "/Library/Caches/com.apple.AppleMediaServices"))) (allow file-read* file-write* cache-path-filter) (allow file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read" "com.apple.app-sandbox.read-write") cache-path-filter))) ;; Mach Lookup (allow mach-lookup (global-name "com.apple.securityd.xpc") (global-name "com.apple.cookied") (global-name "com.apple.apsd") (global-name "com.apple.accountsd.accountmanager") (global-name "com.apple.lsd.mapdb") (global-name "com.apple.bird.token") (global-name "com.apple.cloudd") (global-name "com.apple.ak.anisette.xpc") (global-name "com.apple.SystemConfiguration.configd") (global-name "com.apple.xpc.amsaccountsd") (global-name "com.apple.ap.promotedcontent.supportinterface")) ;; Security.framework ; mds: mds.lock, mdsDirectory.db, mdsObject.db ; 1. extension "mds" ; uid == 0: r+w /private/var/db/mds/system ; uid > 0: r+w <_DARWIN_USER_CACHE_DIR>/mds ; 2. /private/var/db/mds/system/{mdsDirectory.db,mdsObject.db} ; uid == 0: r+w (already covered by (extension "adprivacyd:mds")) ; uid > 0: r (allow file-read* file-write* (extension "adprivacyd:mds")) (allow file-read* (literal "/private/var/db/mds/system/mdsDirectory.db") (literal "/private/var/db/mds/system/mdsObject.db")) ; 3. se_SecurityMessages (allow file-read* (literal (param "SECURITY_MESSAGES"))) ;; Write access to private/var/folders (allow file-write-create (regex #"^/private/var/folders/[^/]+/[^/]+/T/\com\.apple\.adprivacyd/.*")) ;; Networking (system-network) (allow network-outbound) ;; mDNSResponder (allow network-outbound (path "/private/var/run/mDNSResponder") (remote ip) (control-name "com.apple.net.netagent")) ;; IOKit read access (allow iokit-get-properties)