;;; 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 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.TextUnderstanding")) ;; Read/write access to a temporary directory. (allow file-read* file-write* (subpath (param "TMPDIR")) (subpath (param "DARWIN_CACHE_DIR"))) ;; Read/write cache access (let ((cache-path-filter (home-subpath "/Library/Caches/com.apple.textunderstandingd"))) (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))) ;; GMS rules for LLM inference, accessing OTA assets, putting asset download request via spellchecker (allow mach-lookup (global-name "com.apple.modelmanager") (global-name "com.apple.biome.access.user") (global-name "com.apple.modelcatalog.catalog") (global-name "com.apple.siri.uaf.service") (global-name "com.apple.linkd.registry") (global-name "com.apple.mobileasset.autoasset") (global-name "com.apple.mobileassetd.v2") (global-name "mul-xpc (Apple)_OpenStep") (global-name "com.apple.reversetemplated") (global-name "com.apple.calaccessd") (global-name "com.apple.biome.compute.source") (global-name "com.apple.biome.compute.source.user") (global-name "com.apple.spotlight.SearchAgent") (global-name "com.apple.spotlight.IndexAgent") (global-name "com.apple.lsd.mapdb") (global-name "com.apple.lsd.modifydb") (global-name "com.apple.SetStoreUpdateService") (global-name "com.apple.proactive.PersonalizationPortrait.TextUnderstanding") (global-name "com.apple.tccd.system") (global-name "com.apple.windowserver.active") (global-name "com.apple.CalendarAgent") (global-name "com.apple.CalendarAgent.database") (global-name "com.apple.CalendarAgent.proxy") ) (allow user-preference-read (preference-domain "com.apple.GenerativeFunctions.GenerativeFunctionsInstrumentation") (preference-domain "kCFPreferencesAnyApplication") (preference-domain "com.apple.UnifiedAssetFramework") (preference-domain "com.apple.modelcatalog.ajax") ) ;; Allow read and write access to textunderstanding suite in user preferences (allow user-preference-read user-preference-write (preference-domain "com.apple.textunderstanding.runtime") ) (allow file-read* (subpath "/private/var/db/com.apple.modelcatalog/sideload/") (subpath "/System/Library/AssetsV2/locks/com.apple.UnifiedAssetFramework/") (subpath "/System/Library/AssetsV2/com_apple_MobileAsset_UAF_FM_GenerativeModels/purpose_auto/") (subpath "/System/Library/AssetsV2/com_apple_MobileAsset_UAF_FM_Overrides/purpose_auto/") (subpath "/System/Library/PreinstalledAssetsV2/RequiredByOs/com_apple_MobileAsset_UAF_FM_GenerativeModels/") (subpath "/System/Library/PreinstalledAssetsV2/RequiredByOs/com_apple_MobileAsset_UAF_FM_Overrides/") ) ;; Consume sandbox extensions (with-filter (extension "com.apple.app-sandbox.read") (allow file-read*) (allow file-issue-extension (extension-class "com.apple.app-sandbox.read"))) (with-filter (extension "com.apple.app-sandbox.read-write") (allow file-read* file-write*) (allow file-issue-extension (extension-class "com.apple.app-sandbox.read" "com.apple.app-sandbox.read-write"))) ;; Access IOKit user clients (allow iokit-open-user-client (iokit-user-client-class "IOSurfaceRootUserClient")) ;; Read access to additional relevant files and directories (allow file-read* (literal "/usr/libexec") (literal "/usr/libexec/textunderstandingd")) ;; Suggestions/Portrait work in Pipeline (allow file-read* file-write* (home-subpath "/Library/Suggestions") (home-subpath "/Library/PersonalizationPortrait")) (allow user-preference-read (preference-domain "com.apple.suggestions") ) ;; Allow read-only access to $HOME/Library/Trial (allow file-read* (home-subpath "/Library/Trial")) ;; Needed for GeoServices APIs which textunderstandingd uses for geocoding (allow file-read* (home-subpath "/Library/Caches/GeoServices")) ;; Access Mail and Messages attachments (allow file-read* (home-subpath "/Library/Mail/") ;; Mail attachments (home-subpath "/Library/Messages/Attachments/") ;; Messages attachments ) (allow iokit-open (iokit-user-client-class "AppleKeyStoreUserClient") (iokit-user-client-class "AppleVirtIONeuralEngineDeviceUserClient") (iokit-user-client-class "AppleParavirtDeviceUserClient") )