; Copyright (C) 2010-2022 Apple Inc. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; 1. Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; ; THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS ; BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ; THE POSSIBILITY OF SUCH DAMAGE. (version 1) (deny default (with partial-symbolication)) (deny nvram*) (deny system-privilege) (allow system-audit file-read-metadata) ;; We can remove the catch once we no longer need to support older macOS (catch (lambda) (import "dyld-support.sb")) ;; Silence spurious logging due to rdar://20117923 and rdar://72366475 (deny system-privilege (privilege-id PRIV_GLOBAL_PROC_INFO) (with no-report)) #include "Shared/Sandbox/preferences.sb" #if ENABLE(SYSTEM_CONTENT_PATH_SANDBOX_RULES) #include #endif ;;; ;;; The following rules were originally contained in 'system.sb'. We are duplicating them here so we can ;;; remove unneeded sandbox extensions. ;;; ;;; Allow read access to standard system paths. (allow file-read* (require-all (file-mode #o0004) (subpath "/System"))) (allow file-read* (require-all (file-mode #o0004) (require-any (subpath "/Library/Preferences/Logging") ; Logging Rethink #if __MAC_OS_X_VERSION_MIN_REQUIRED < 110000 (subpath "/private/var/db/dyld") #endif (subpath "/private/var/db/timezone") (subpath "/usr/lib") (subpath "/usr/share")))) ;;; Allow mapping of system frameworks + dylibs (allow file-map-executable (subpath "/System/Library/Frameworks") (subpath "/System/Library/PrivateFrameworks") (subpath "/usr/lib")) (allow file-read-metadata (literal "/var") (literal "/etc") (literal "/tmp") (literal "/private/etc/localtime")) ;;; Allow access to standard special files. (allow file-read* (literal "/dev/random") (literal "/private/etc/passwd")) (allow file-read* file-write-data file-ioctl (literal "/dev/dtracehelper")) ;;; Allow IPC to standard system agents. (allow ipc-posix-shm-read* (with telemetry) #if !ENABLE(CFPREFS_DIRECT_MODE) (ipc-posix-name-prefix "apple.cfprefs.") #endif (ipc-posix-name "apple.shm.notification_center")) ;;; (system-graphics) - Allow access to graphics hardware. (define (system-graphics) ;; Preferences (allow user-preference-read (preference-domain "com.apple.opengl") (preference-domain "com.nvidia.OpenGL")) ;; CVMS (allow mach-lookup (with telemetry) (global-name "com.apple.cvmsServ")) (allow file-read* (with telemetry) (prefix "/private/var/db/CVMS/cvmsCodeSignObj")) ;; OpenCL (allow iokit-open (with telemetry) (iokit-connection "IOAccelerator") (iokit-registry-entry-class "IOSurfaceRootUserClient")) (deny iokit-open (with telemetry) (iokit-registry-entry-class "IOAccelerationUserClient")) ;; CoreVideo CVCGDisplayLink (deny iokit-open (with telemetry) (iokit-registry-entry-class "IOFramebufferSharedUserClient")) ;; These are needed for Encrypted Media on some hardware (MacMini8,1 for example) (allow iokit-open (with telemetry) (iokit-registry-entry-class "AppleIntelMEUserClient") (iokit-registry-entry-class "AppleSNBFBUserClient") ) ;; QuartzCore (deny iokit-open (with telemetry) (iokit-registry-entry-class "AGPMClient") (iokit-registry-entry-class "AppleGraphicsControlClient") (iokit-registry-entry-class "AppleGraphicsPolicyClient")) ;; OpenGL (deny iokit-open (with telemetry) (iokit-registry-entry-class "AppleMGPUPowerControlClient")) ;; GPU bundles (allow file-read* (with telemetry) (subpath "/Library/GPUBundles")) ;; DisplayServices (allow iokit-set-properties (with telemetry) (require-all (iokit-connection "IODisplay") (require-any (iokit-property "brightness") (iokit-property "linear-brightness") (iokit-property "commit") (iokit-property "rgcs") (iokit-property "ggcs") (iokit-property "bgcs"))))) ;;; ;;; End rules originally copied from 'system.sb' ;;; ;;; process-info* defaults to allow; deny it and then allow operations we actually need. (deny process-info*) (allow process-info-dirtycontrol (target self)) (allow process-info-pidinfo) (allow process-info-setcontrol (target self)) (allow process-codesigning-status*) (deny sysctl* (with telemetry)) (allow sysctl-read (with telemetry) (sysctl-name "hw.activecpu" "hw.cachelinesize" "hw.cpufamily" "hw.cpusubfamily" "hw.cputhreadtype" "hw.cputype" "hw.l2cachesize" "hw.logicalcpu" "hw.logicalcpu_max" "hw.memsize" "hw.model" "hw.ncpu" "hw.physicalcpu" "hw.physicalcpu_max" "hw.product" "hw.target" "hw.vectorunit" "kern.hostname" "kern.hv_vmm_present" "kern.iossupportversion" "kern.maxfilesperproc" "kern.osproductversion" "kern.osrelease" "kern.ostype" "kern.version") (sysctl-name-prefix "hw.optional.") ;; (sysctl-name-prefix "hw.perflevel") ;; ) (deny iokit-get-properties) (allow iokit-get-properties (iokit-property "AAPL,LCD-PowerState-ON") ;; (iokit-property "AGCInfo") (iokit-property "AccelCaps") (iokit-property "AccelNativeDMARowByteAlignment") (iokit-property "AccurateMaxDigitizerPressureValue") (iokit-property "ActivationThresholds") (iokit-property "ActuationSupported") (iokit-property "AnimationThresholds") (iokit-property "AllowDisplaySleep") (iokit-property "AlwaysNeedsVelocityCalculated") (iokit-property "AppleGVAKeyDoesNotExist") (iokit-property "AppleIntelMEVABundleName") (iokit-property "AAPL,DisplayPipe") (iokit-property "AAPL,OpenCLdisabled") (iokit-property-prefix "AAPL,IOGraphics_LER") (iokit-property "AAPL,alias-policy") (iokit-property "AAPL,boot-display") (iokit-property "AAPL,display-alias") (iokit-property "AAPL,mux-switch-state") (iokit-property "AAPL,ndrv-dev") (iokit-property "AAPL,primary-display") (iokit-property "AAPL,slot-name") (iokit-property "ATY,cbits") (iokit-property "ATY,fb_linebytes") (iokit-property "ATY,fb_offset") (iokit-property "ATY,fb_size") (iokit-property "ATY,intrev") (iokit-property "ATY,DeviceName") ;; Needed by Metal compilers (iokit-property "ATY,EFIDisplay") (iokit-property "ATY,FamilyName") ;; Ditto (iokit-property "AVCSupported") (iokit-property "BacklightHandle") (iokit-property "BlockSize") (iokit-property "CEAModeID") (iokit-property "CEAPixelRepetition") (iokit-property "CFBundleIdentifier") (iokit-property "CFBundleIdentifierKernel") ;; (iokit-property "CapsLockDelay") (iokit-property "CaseSensitive") (iokit-property "ConfigState") (iokit-property "DPLanes") (iokit-property "DPLinkBit") (iokit-property "DPLinkRate") (iokit-property "Description") (iokit-property "Development") (iokit-property "Device Characteristics") (iokit-property "DeviceEqID") (iokit-property "DiskImageURL") (iokit-property "DisplayRouting") (iokit-property "Driver is Ready") (iokit-property "Ejectable") (iokit-property "EnableLPVP") (iokit-property "Encrypted") (iokit-property "Endianness") (iokit-property "ExtendedMaxDigitizerPressureValue") (iokit-property "Family ID") (iokit-property "ForceSupported") (iokit-property "Formats") (iokit-property "FramebufferEnabled") (iokit-property "FramebufferStarted") (iokit-property "GPUConfigurationVariable") (iokit-property "GPUDCCDisplayable") (iokit-property "GPUDebugNullClientMask") (iokit-property "GpuDebugPolicy") (iokit-property "GPURawCounterBundleName") (iokit-property "GPURawCounterPluginClassName") (iokit-property "HEVCSupported") (iokit-property "HIDPointerAccelerationType") (iokit-property "HwCtxCacheUpdate") (iokit-property "IOAccelDisplayPipeCapabilities") (iokit-property "IOAccelIndex") (iokit-property "IOAccelTypes") (iokit-property "IOAccelRevision") (iokit-property-prefix "IOAudioControl") (iokit-property "IOAudioDeviceCanBeDefaults") (iokit-property "IOAudioDeviceTransportType") (iokit-property-prefix "IOAudioEngine") (iokit-property "IOAudioSampleRate") (iokit-property "IOAudioStreamSampleFormatByteOrder") (iokit-property-prefix "IOAV") (iokit-property "IOBacklightHandlerID") (iokit-property "IOBusyInterest") (iokit-property "IOCFPlugInTypes") (iokit-property "IOChildIndex") (iokit-property "IOClass") (iokit-property "IOClassNameOverride") (iokit-property "IOConsoleUsers") (iokit-property "IODVDBundleName") (iokit-property "IODeviceMemory") (iokit-property "IODisplayParameters") (iokit-property-prefix "IOFB") (iokit-property "IOFramebufferOpenGLIndex") (iokit-property "IOGeneralInterest") (iokit-property "IOGLBundleName") (iokit-property-prefix "IOGVA") (iokit-property "IOHibernateState") (iokit-property "IOI2CTransactionTypes") (iokit-property "IOInterruptControllers") (iokit-property "IOInterruptSpecifiers") (iokit-property "IOKitDebug") (iokit-property "IOMatchCategory") (iokit-property "IOMediaIcon") (iokit-property "IONDRVFramebufferGeneration") (iokit-property "IONVRAMProperty") (iokit-property "IOName") (iokit-property "IONameMatch") (iokit-property "IONameMatched") (iokit-property "IOOCDBundleName") (iokit-property "IOPCITunnelled") (iokit-property "IOPCITunnelCompatible") (iokit-property "IOPMStrictTreeOrder") (iokit-property "IOParentMatch") (iokit-property-prefix "IOPCI") (iokit-property "IOPMIsPowerManaged") (iokit-property "IOPersonalityPublisher") (iokit-property "IOPlatformSerialNumber") (iokit-property "IOPlatformUUID") (iokit-property "IOPowerManagement") (iokit-property "IOProbeScore") (iokit-property "IOPropertyMatch") (iokit-property "IOProviderClass") (iokit-property "IOReportLures") (iokit-property "IOReportLegend") (iokit-property "IOReportLegendPublic") (iokit-property "IOScreenRestoreState") (iokit-property "IOSourceVersion") (iokit-property "IOVABundleName") (iokit-property "IOVARendererID") (iokit-property "IOVARendererSubID") (iokit-property "InternalStatistics") (iokit-property "InternalStatisticsAccm") (iokit-property "MetalPluginClassName") (iokit-property "MetalPluginName") (iokit-property "MetalStatisticsName") (iokit-property "MTHIDDevice") (iokit-property "MT Built-In") (iokit-property "MaintainPowerInUILock") (iokit-property "Max Packet Size") (iokit-property "MaximumBootBeepVolume") (iokit-property "MinDigitizerPressureValue") (iokit-property "Multitouch ID") (iokit-property "Multitouch Serial Number") (iokit-property "Multitouch Subdevice ID") (iokit-property "NVArch") (iokit-property "NVCAP") (iokit-property "NVCLASS") (iokit-property "NVDA,Enable-A2R10G10B10Format") (iokit-property "NVDA,Features") (iokit-property "NVDA,NVPresentment-version") (iokit-property "NVDA,accel-loaded") (iokit-property "NVDA,invalid-config") (iokit-property "NVDA,mm-version") (iokit-property "NVDAType") (iokit-property "NVDAinitgl_created") (iokit-property "NVRAMProperty") (iokit-property "NXSystemInfo") (iokit-property "VRAM,memvendorID") (iokit-property "VRAM,totalsize") (iokit-property "NoAutoRoute") (iokit-property "NumBlocks") (iokit-property "NumStreams") (iokit-property "PerformanceStatistics") (iokit-property "PerformanceStatisticsAccum") (iokit-property "PinConfigurations") (iokit-property "Protocol Characteristics") (iokit-property "Removable") (iokit-property "ResetOnLockMs") (iokit-property "ResetOnUnlockMs") (iokit-property "SWIP_properties") (iokit-property "SafeEjectRequested") (iokit-property "SampleRates") (iokit-property "Sensor Columns") (iokit-property "Sensor Rows") (iokit-property "Sensor Region Descriptor") (iokit-property "Sensor Region Param") (iokit-property "Sensor Region Rows") (iokit-property "Sensor Surface Descriptor") (iokit-property "Sensor Surface Height") (iokit-property "Sensor Surface Width") (iokit-property "Serial Number") (iokit-property "StartupDisplay") (iokit-property "SurfaceList") (iokit-property "SupportAudioAUUC") (iokit-property "SupportsSilentClick") (iokit-property "SupportTapToWake") (iokit-property "TimeStampFiltering") (iokit-property "Transport") (iokit-property "USBADC") ;; Needed for Audio support on older hardware (iokit-property "UserClientEnabled") (iokit-property "VRAM,totalMB") (iokit-property "WANTS_FRAMES_IGNORED") (iokit-property "ane-type") (iokit-property "acpi-device") (iokit-property "acpi-path") (iokit-property "assigned-addresses") (iokit-property "attached-gpu-control-path") (iokit-property "audio-codec-info") (iokit-property "audio-device-mvalue") (iokit-property "audio-device-nvalue") (iokit-property "audio-selector") (iokit-property "av-signal-type") (iokit-property "backlight-PWM-freq") (iokit-property "bcdVersion") (iokit-property "board-id") (iokit-property "boot-gamma-restored") (iokit-property "built-in") (iokit-property "cail_properties") (iokit-property "canvas-height") (iokit-property "canvas-width") (iokit-property "class-code") (iokit-property "color-accuracy-index") (iokit-property "compatible") (iokit-property "connector-type") (iokit-property "device-id") (iokit-property "device_type") (iokit-property "display-bpc") (iokit-property "display-connect-flags") (iokit-property "display-link-component-bits") (iokit-property "display-pixel-component-bits") (iokit-property "display-type") (iokit-property "dpm") (iokit-property "errordb") ;; Needed for OpenGL on older hardware (iokit-property "filevault-image") ;; Needed by LaunchServices (iokit-property "graphic-options") (iokit-property "hda-gfx") (iokit-property "housing-color") (iokit-property "idProduct") (iokit-property "idVendor") (iokit-property "iofb_version") (iokit-property "image-encrypted") (iokit-property "image-path") ;; Needed by LaunchServices (iokit-property "layout-id") (iokit-property "locationID") ;; Needed for Audio support on older hardware (iokit-property "model") (iokit-property "mt-device-id") (iokit-property "name") (iokit-property "nv-stats") #if __MAC_OS_X_VERSION_MIN_REQUIRED < 110000 (iokit-property "od-server-name") ;; Needed by LaunchServices #endif (iokit-property "parser-options") (iokit-property "parser-type") (iokit-property "pci-aspm-default") (iokit-property "pcidebug") (iokit-property "port-number") (iokit-property "reg") (iokit-property "revision-id") (iokit-property "rm_board_number") (iokit-property "rom-revision") (iokit-property "saved-config") (iokit-property "startup-timing") (iokit-property "subsystem-id") (iokit-property "subsystem-vendor-id") (iokit-property "touch-size-id") (iokit-property "vendor-id") (iokit-property "vbios-revision") (iokit-property "CompactVRAM") (iokit-property "EnableBlitLib") (iokit-property "ForceDisableEDRAM") (iokit-property "IOPCIMatch") (iokit-property "MetalStatisticsScriptName") (iokit-property "MetalCoalesce") (iokit-property "PanicOnGPUHang") (iokit-property "TelemetryDisable") (iokit-property "IOGVAH264EncodeCapabilities") ;; #if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED > 101500 (iokit-property "IOAVDHEVCDecodeCapabilities") ;; #endif ) ;; (if (equal? (param "CPU") "arm64") (allow iokit-get-properties (iokit-property "ADSSupported") (iokit-property "IOAVDHEVCDecodeCapabilities") (iokit-property "IOGLESBundleName") ;; (iokit-property "MetalPluginClassName") ;; (iokit-property "MetalPluginName") ;; (iokit-property "IOSurfaceAcceleratorCapabilitiesDict") ;; (iokit-property "acoustic-id") ;; )) (if (equal? (param "CPU") "arm64") (with-filter (iokit-registry-entry-class "IOService") (allow iokit-get-properties (iokit-property "IORegistryEntryPropertyKeys")))) (if (equal? (param "CPU") "arm64") (with-filter (iokit-registry-entry-class "IOMobileFramebuffer") (allow iokit-get-properties (iokit-property "AppleTV" "DisplayPipePlaneBaseAlignment" "DisplayPipeStrideRequirements" "dfr" "external" "hdcp-hoover-protocol")))) (if (equal? (param "CPU") "arm64") (with-filter (iokit-registry-entry-class "IOPlatformDevice") (allow iokit-get-properties (iokit-property "soc-generation")))) (if (equal? (param "CPU") "arm64") (with-filter (iokit-registry-entry-class "IOService") (allow iokit-get-properties (iokit-property "chip-id" "display-rotation" "display-scale")))) (deny mach-lookup (xpc-service-name-prefix "")) (allow mach-lookup (with telemetry) (xpc-service-name "com.apple.audio.SandboxHelper") (xpc-service-name "com.apple.coremedia.videodecoder") (xpc-service-name "com.apple.coremedia.videoencoder") ) (allow mach-lookup (with telemetry) (global-name "com.apple.accessibility.mediaaccessibilityd") ) ;; 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))) (define (allow-read-directory-and-issue-read-extensions path) (if path (begin (allow file-read* (subpath path)) (allow file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read") (subpath path)))))) (define (allow-read-write-directory-and-issue-read-write-extensions path) (if path (begin (allow file-read* file-write* (with telemetry) (subpath path)) (allow file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read") (subpath path))) (allow file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read-write") (subpath path)))))) ;; Remove when is fixed. (define (HEX-pattern-match-generator pattern-descriptor) (letrec ((pattern-string "")) (for-each (lambda (repeat-count) (if (zero? repeat-count) (set! pattern-string (string-append pattern-string "-")) (let appender ((count repeat-count)) (if (> count 0) (begin (set! pattern-string (string-append pattern-string "[0-9A-F]")) (appender (- count 1))))))) pattern-descriptor) pattern-string)) ;; return a regex pattern matching string for 8-4-4-4-12 UUIDs: (define (uuid-HEX-pattern-match-string) (HEX-pattern-match-generator '(8 0 4 0 4 0 4 0 12))) ;; global to hold the computed UUID matching pattern. (define *uuid-pattern* "") (define (uuid-regex-string) (if (zero? (string-length *uuid-pattern*)) (set! *uuid-pattern* (uuid-HEX-pattern-match-string))) *uuid-pattern*) ;; Read-only preferences and data (allow file-read* ;; Basic system paths (subpath "/Library/Audio/Plug-Ins/HAL") (subpath "/Library/Fonts") (subpath "/Library/Managed Preferences") ;; FIXME: This should be removed when is fixed. (home-subpath "/Library/Fonts")) (allow file-read-data (literal "/usr/local/lib/log")) ; ;; Preferences support (shared-preferences-read "com.apple.Accessibility" "com.apple.ATS" "com.apple.CoreGraphics" "com.apple.DownloadAssessment" "com.apple.HIToolbox" "com.apple.LaunchServices" "com.apple.MultitouchSupport" ;; FIXME: Remove when is fixed. "com.apple.ServicesMenu.Services" ;; Needed for NSAttributedString "com.apple.ViewBridge" ;; Needed for Input elements. "com.apple.WebFoundation" "com.apple.WebKit" "com.apple.avfoundation" "com.apple.avfoundation.frecents" ;; "com.apple.avfoundation.videoperformancehud" ;; "com.apple.coremedia" "com.apple.crypto" "com.apple.driver.AppleBluetoothMultitouch.mouse" "com.apple.driver.AppleBluetoothMultitouch.trackpad" "com.apple.driver.AppleHIDMouse" "com.apple.lookup.shared" "com.apple.mediaaccessibility" ;; Needed for custom caption styles "com.apple.networkConnect" "com.apple.security" "com.apple.speech.voice.prefs" "com.apple.systemsound" "com.apple.universalaccess" "edu.mit.Kerberos" "pbs") ;; Needed for NSAttributedString (allow-reading-global-preferences) ;; On-disk WebKit2 framework location, to account for debug installations outside of /System/Library/Frameworks, ;; and to allow issuing extensions. (allow-read-directory-and-issue-read-extensions (param "WEBKIT2_FRAMEWORK_DIR")) ;; Sandbox extensions (define (apply-read-and-issue-extension op path-filter) (op file-read* (with telemetry) path-filter) (op file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read") path-filter))) (define (apply-write-and-issue-extension op path-filter) (op file-write* (with telemetry) path-filter) (op file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read-write") path-filter))) (define (read-only-and-issue-extensions path-filter) (apply-read-and-issue-extension allow path-filter)) (define (read-write-and-issue-extensions path-filter) (apply-read-and-issue-extension allow path-filter) (apply-write-and-issue-extension allow path-filter)) (read-only-and-issue-extensions (extension "com.apple.app-sandbox.read")) (read-write-and-issue-extensions (extension "com.apple.app-sandbox.read-write")) ;; Allow the OpenGL Profiler to attach. (with-filter (system-attribute apple-internal) (allow mach-register (with telemetry) (global-name-regex #"^_oglprof_attach_<[0-9]+>$"))) (if (positive? (string-length (param "DARWIN_USER_CACHE_DIR"))) (allow-read-write-directory-and-issue-read-write-extensions (param "DARWIN_USER_CACHE_DIR"))) (if (positive? (string-length (param "DARWIN_USER_TEMP_DIR"))) (allow-read-write-directory-and-issue-read-write-extensions (param "DARWIN_USER_TEMP_DIR"))) ;; IOKit user clients (allow iokit-open (with telemetry) (iokit-user-client-class "AppleUpstreamUserClient") (iokit-user-client-class "RootDomainUserClient") (iokit-user-client-class "IOAudioControlUserClient") (iokit-user-client-class "IOAudioEngineUserClient") ;; Following is needed due to && (iokit-user-client-class "AudioAUUC")) (deny iokit-open (with telemetry) (iokit-user-client-class "AppleMultitouchDeviceUserClient") (iokit-user-client-class "IOHIDParamUserClient")) ;; Audio (allow ipc-posix-shm-read* ipc-posix-shm-write-data (ipc-posix-name-prefix "AudioIO")) #if HAVE(AUDIO_COMPONENT_SERVER_REGISTRATIONS) (deny mach-lookup (with telemetry) (global-name "com.apple.audio.AudioComponentRegistrar")) #else (allow mach-lookup (global-name "com.apple.audio.AudioComponentRegistrar")) #endif #if !ENABLE(CFPREFS_DIRECT_MODE) (allow mach-lookup (with telemetry) (global-name "com.apple.cfprefsd.agent") ) #endif (allow mach-lookup (require-all (extension "com.apple.webkit.extension.mach") (global-name "com.apple.powerlog.plxpclogger.xpc"))) (with-filter (system-attribute apple-internal) (allow mach-lookup (global-name "com.apple.powerlog.plxpclogger.xpc"))) (with-filter (uid 0) (allow mach-lookup (global-name "com.apple.system.logger"))) (with-filter (system-attribute apple-internal) (allow mach-lookup (global-name "com.apple.analyticsd") (global-name "com.apple.diagnosticd"))) ;; Various services required by AppKit and other frameworks (allow mach-lookup (global-name "com.apple.audio.audiohald") (global-name "com.apple.CARenderServer") ; Needed for [CAContext remoteContextWithOptions] #if __MAC_OS_X_VERSION_MIN_REQUIRED < 120000 (global-name "com.apple.lsd.mapdb") #endif (global-name "com.apple.fonts") (global-name "com.apple.PowerManagement.control") (global-name "com.apple.trustd.agent") (global-name "com.apple.logd.events")) (allow mach-lookup (with telemetry) #if !ENABLE(CFPREFS_DIRECT_MODE) (global-name "com.apple.cfprefsd.daemon") #endif (global-name "com.apple.mediaremoted.xpc") (global-name "com.apple.logd") (global-name "com.apple.lskdd") ;; (global-name "com.apple.tccd")) ;; (allow mach-lookup (with telemetry) (xpc-service-name "com.apple.MTLCompilerService")) (deny mach-lookup (with no-log) (global-name "com.apple.CoreServices.coreservicesd") (global-name "com.apple.DiskArbitration.diskarbitrationd") (global-name "com.apple.ViewBridgeAuxiliary") (global-name "com.apple.windowserver.active")) ;; Needed to support encrypted media playback (allow mach-lookup (with telemetry) (global-name "com.apple.SecurityServer")) (allow file-read* (subpath "/private/var/db/mds/system")) ;; FIXME: This should be removed when is fixed. (with-filter (uid 0) (allow file-write* (with telemetry) (subpath "/private/var/db/mds/system")) ;; FIXME: This should be removed when is fixed. ) (allow file-read* (subpath "/private/var/db/mds")) (allow ipc-posix-shm-read* ipc-posix-shm-write-data ipc-posix-shm-write-create (ipc-posix-name "com.apple.AppleDatabaseChanged")) ;; CoreFoundation. We don't import com.apple.corefoundation.sb, because it allows unnecessary access to pasteboard. #if !HAVE(CSCHECKFIXDISABLE) (allow mach-lookup (with telemetry) (global-name "com.apple.CoreServices.coreservicesd")) #endif (allow system-fsctl (with telemetry) (fsctl-command (_IO "h" 47))) ;; Graphics (system-graphics) ;; Networking (allow network-outbound (with telemetry) #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 101500 ;; Local mDNSResponder for DNS, arbitrary outbound TCP ;; Note: This is needed for some media playback features. ;; Remove this permission when is fixed. (literal "/private/var/run/mDNSResponder") #endif ;; ObjC map_images needs to send logging data to syslog. (literal "/private/var/run/syslog") #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 101500 (remote tcp) #endif ) ;; CFNetwork (allow file-read-data (path "/private/var/db/nsurlstoraged/dafsaData.bin")) #if PLATFORM(MAC) (allow mach-lookup (with telemetry) (global-name "com.apple.system.notification_center")) #endif (deny file-write-create (vnode-type SYMLINK)) ;; Reserve a namespace for additional protected extended attributes. (deny file-read-xattr file-write-xattr (xattr-prefix "com.apple.security.private.")) (deny file-read* file-write* (with no-log) ;; FIXME: Should be removed after 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 is fixed. (deny file-read* (with no-log) (subpath "/Library/InputManagers") (home-subpath "/Library/InputManagers")) (deny user-preference-read (with no-log) (preference-domain "com.apple.speech.recognition.AppleSpeechRecognition.prefs")) (deny mach-lookup (with no-log) (global-name "com.apple.coreservices.appleevents") (global-name "com.apple.pasteboard.1") (global-name "com.apple.speech.recognitionserver")) ;; AirPlay (allow mach-lookup (global-name "com.apple.coremedia.routingcontext.xpc")) (allow mach-lookup (with telemetry) (global-name "com.apple.coremedia.endpoint.xpc") (global-name "com.apple.coremedia.endpointstream.xpc") (global-name "com.apple.coremedia.endpointstreamaudioengine.xpc") ;; (global-name "com.apple.coremedia.endpointplaybacksession.xpc") ; (global-name "com.apple.coremedia.endpointremotecontrolsession.xpc") (global-name "com.apple.coremedia.routediscoverer.xpc") #if __MAC_OS_X_VERSION_MIN_REQUIRED > 120000 (global-name "com.apple.coremedia.samplebufferconsumer.xpc") #endif (global-name "com.apple.coremedia.volumecontroller.xpc") ) #if PLATFORM(MAC) ;; Media capture, utilities (if (not (defined? 'sbpl-filter?)) (define (sbpl-filter? x) (and (list? x) (eq? (car x) 'filter)))) (macro (with-filter form) (let* ((ps (cdr form)) (extra-filter (car ps)) (rules (cdr ps))) `(letrec ((collect (lambda (l filters non-filters) (if (null? l) (list filters non-filters) (let* ((x (car l)) (rest (cdr l))) (if (sbpl-filter? x) (collect rest (cons x filters) non-filters) (collect rest filters (cons x non-filters))))))) (inject-filter (lambda args (let* ((collected (collect args '() '())) (filters (car collected)) (non-filters (cadr collected))) (if (null? filters) (cons ,extra-filter non-filters) (cons (require-all (apply require-any filters) ,extra-filter) non-filters))))) (orig-allow allow) (orig-deny deny) (wrapper (lambda (action) (lambda args (apply action (apply inject-filter args)))))) (set! allow (wrapper orig-allow)) (set! deny (wrapper orig-deny)) ,@rules (set! deny orig-deny) (set! allow orig-allow)))) ;; Media capture, microphone access (with-filter (extension "com.apple.webkit.microphone") (allow device-microphone)) ;; Media capture, camera access (with-filter (extension "com.apple.webkit.camera") (shared-preferences-read "com.apple.cmio") (shared-preferences-read "com.apple.coremedia") (allow file-read* (subpath "/Library/CoreMediaIO/Plug-Ins/DAL")) (allow mach-lookup (with telemetry) (global-name "com.apple.cmio.AppleCameraAssistant") (global-name "com.apple.cmio.registerassistantservice") (global-name "com.apple.cmio.registerassistantservice.system-extensions") ;; Apple DAL assistants (global-name "com.apple.cmio.VDCAssistant") (global-name "com.apple.cmio.AVCAssistant") (global-name "com.apple.cmio.IIDCVideoAssistant") ;; QuickTimeIIDCDigitizer assistant (global-name "com.apple.IIDCAssistant") ;; applecamerad (require-all (extension "com.apple.webkit.extension.mach") (global-name "com.apple.applecamerad") ) #if HAVE(ADDITIONAL_APPLE_CAMERA_SERVICE) (require-all (extension "com.apple.webkit.extension.mach") (global-name "com.apple.appleh13camerad") ) #endif ) (deny iokit-open (with telemetry) ;; QuickTimeUSBVDCDigitizer (iokit-user-client-class "IOUSBDeviceUserClientV2") (iokit-user-client-class "IOUSBInterfaceUserClientV2")) (allow device-camera)) #endif // PLATFORM(MAC) #if HAVE(SC_CONTENT_SHARING_SESSION) (allow mach-lookup (require-all (extension "com.apple.webkit.extension.mach") (global-name "com.apple.replaykit.sharingsession.notification" "com.apple.replaykit.sharingsession" "com.apple.tccd.system" "com.apple.replayd" ) ) ) #endif (allow mach-lookup (require-all (extension "com.apple.webkit.extension.mach") (global-name "com.apple.system.opendirectoryd.libinfo"))) (allow mach-lookup (with telemetry) (global-name "com.apple.relatived.tempest") ) (allow iokit-open (with telemetry) (iokit-user-client-class "AppleAVDUserClient") ) (when (equal? (param "CPU") "arm64") (allow iokit-open (with telemetry) (iokit-user-client-class "IOMobileFramebufferUserClient") ;; VideoToolbox VTImageRotationSession (iokit-user-client-class "IOSurfaceAcceleratorClient") ) ) #if HAVE(SANDBOX_MESSAGE_FILTERING) (when (and (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES") (defined? 'mach-kernel-endpoint)) (allow mach-kernel-endpoint (apply-message-filter (allow mach-message-send (with telemetry))))) (when (and (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES") (defined? 'syscall-mach)) (deny syscall-mach (with telemetry)) (allow syscall-mach (machtrap-number MSC__kernelrpc_mach_port_allocate_trap MSC__kernelrpc_mach_port_construct_trap MSC__kernelrpc_mach_port_deallocate_trap MSC__kernelrpc_mach_port_destruct_trap MSC__kernelrpc_mach_port_extract_member_trap MSC__kernelrpc_mach_port_get_attributes_trap MSC__kernelrpc_mach_port_guard_trap MSC__kernelrpc_mach_port_insert_member_trap MSC__kernelrpc_mach_port_insert_right_trap MSC__kernelrpc_mach_port_mod_refs_trap MSC__kernelrpc_mach_port_request_notification_trap MSC__kernelrpc_mach_port_type_trap MSC__kernelrpc_mach_port_unguard_trap MSC__kernelrpc_mach_vm_allocate_trap MSC__kernelrpc_mach_vm_deallocate_trap MSC__kernelrpc_mach_vm_map_trap MSC__kernelrpc_mach_vm_protect_trap MSC__kernelrpc_mach_vm_purgable_control_trap MSC_host_create_mach_voucher_trap MSC_host_self_trap MSC_iokit_user_client_trap MSC_mach_generate_activity_id MSC_mach_msg_trap MSC_mach_reply_port MSC_mach_voucher_extract_attr_recipe_trap MSC_mk_timer_arm MSC_mk_timer_cancel MSC_mk_timer_create MSC_mk_timer_destroy MSC_pid_for_task MSC_semaphore_signal_trap MSC_semaphore_timedwait_trap MSC_semaphore_wait_trap MSC_swtch_pri MSC_syscall_thread_switch MSC_task_name_for_pid MSC_task_self_trap MSC_thread_get_special_reply_port)) (when (defined? 'MSC_mach_msg2_trap) (allow syscall-mach (machtrap-number MSC_mach_msg2_trap)))) #endif // HAVE(SANDBOX_MESSAGE_FILTERING) (when (defined? 'syscall-unix) (deny syscall-unix (with telemetry)) (allow syscall-unix (syscall-number SYS___channel_open SYS___disable_threadsignal SYS___mac_syscall SYS___pthread_canceled SYS___pthread_kill SYS___pthread_sigmask SYS___semwait_signal SYS___semwait_signal_nocancel SYS_access SYS_bsdthread_create SYS_bsdthread_ctl SYS_bsdthread_terminate SYS_change_fdguard_np SYS_close_nocancel SYS_csrctl SYS_dup SYS_exit SYS_faccessat SYS_fcntl SYS_fcntl_nocancel SYS_fgetxattr SYS_flock SYS_fsgetpath SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs SYS_fstatfs64 SYS_ftruncate SYS_getattrlist SYS_getattrlistbulk SYS_getaudit_addr SYS_getdirentries SYS_getdirentries64 SYS_getentropy SYS_geteuid SYS_getfsstat SYS_getfsstat64 SYS_getgid SYS_getpriority SYS_getrlimit SYS_getrusage SYS_gettimeofday SYS_getuid SYS_getxattr SYS_guarded_open_np SYS_issetugid SYS_kdebug_trace SYS_kdebug_trace64 SYS_kdebug_trace_string SYS_kdebug_typefilter SYS_kevent_id SYS_kevent_qos SYS_kqueue_workloop_ctl SYS_listxattr SYS_lseek SYS_lstat SYS_lstat64 SYS_madvise SYS_memorystatus_control SYS_mincore SYS_mkdir SYS_mkdirat SYS_mlock SYS_mmap SYS_mprotect SYS_msync SYS_munlock SYS_munmap SYS_necp_client_action SYS_necp_open SYS_open_nocancel SYS_pathconf SYS_pread SYS_proc_rlimit_control SYS_psynch_cvbroad SYS_psynch_cvclrprepost SYS_psynch_cvsignal SYS_psynch_cvwait SYS_psynch_mutexdrop SYS_psynch_mutexwait SYS_psynch_rw_rdlock SYS_psynch_rw_unlock SYS_psynch_rw_wrlock SYS_read SYS_read_nocancel SYS_readlink SYS_rename SYS_sendto SYS_setrlimit SYS_setsockopt SYS_sigaltstack SYS_sigprocmask SYS_socket SYS_stat SYS_stat64 SYS_statfs SYS_statfs64 SYS_thread_selfid SYS_ulock_wait SYS_ulock_wake SYS_work_interval_ctl SYS_workq_kernreturn))) (when (defined? 'SYS_map_with_linking_np) (allow syscall-unix (syscall-number SYS_map_with_linking_np)))