
; Copyright (C) 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.
; Copyright (C) 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 3)
(deny default)
(deny nvram*)
(deny system-privilege)
(allow system-audit file-read-metadata)
;; Silence spurious logging due to rdar:
(deny system-privilege (privilege-id PRIV_GLOBAL_PROC_INFO) (with no-report))
(allow mach-bootstrap)
(if (defined? 'syscall-mig)
    (allow syscall-mig)
    ;; else
    (allow mach-kernel-endpoint))
(allow file-test-existence)
(allow syscall-mach)
(allow system-memorystatus-control)
;; Sandbox extensions
(define (apply-read-and-issue-extension op path-filter)
    (op file-read* 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* 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))
(define (webcontent-process-launched) (state-flag "local:WebContentProcessLaunched"))
(define (notify-blocking) (require-entitlement "com.apple.developer.web-browser-engine.restrict.notifyd"))
(define (logd-blocking) (require-entitlement "com.apple.private.disable-log-mach-ports"))
(define (debug-features-blocking) (state-flag "local:BlockDebuggingFeaturesInSandbox"))
(define (log-streaming)
    (with-filter
        (require-any
            (system-attribute apple-internal)
            (require-not (process-attribute is-apple-signed-executable)))
        (allow mach-lookup (global-name "com.apple.diagnosticd"))))
;; Launch Services is issuing a file sandbox extension to the WebKit framework bundle in _LSApplicationCheckin.
(allow file-issue-extension
    (require-all
        (extension-class "com.apple.app-sandbox.read")
        (subpath
            "/System/Cryptexes/OS/System/Library/Frameworks/WebKit.framework"
            "/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/WebKit.framework"
            "/System/Volumes/Preboot/Cryptexes/Incoming/OS/System/Library/Frameworks/WebKit.framework")))
(allow file-read* file-test-existence
       (subpath "/System/Volumes/Preboot/Cryptexes/App")
       (subpath "/System/Volumes/Preboot/Cryptexes/OS")
       (subpath "/System/Volumes/Preboot/Cryptexes/Incoming/OS")
       (subpath "/System/Cryptexes/OS")
       (subpath "/System/Cryptexes/App"))
(allow file-map-executable
       (subpath "/System/Volumes/Preboot/Cryptexes/App/System/Library/Frameworks")
       (subpath "/System/Volumes/Preboot/Cryptexes/App/System/Library/PrivateFrameworks")
       (subpath "/System/Volumes/Preboot/Cryptexes/App/usr/lib")
       (subpath "/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks")
       (subpath "/System/Volumes/Preboot/Cryptexes/OS/System/Library/PrivateFrameworks")
       (subpath "/System/Volumes/Preboot/Cryptexes/OS/usr/lib")
       (subpath "/System/Volumes/Preboot/Cryptexes/Incoming/OS/System/Library/Frameworks")
       (subpath "/System/Volumes/Preboot/Cryptexes/Incoming/OS/System/Library/PrivateFrameworks")
       (subpath "/System/Volumes/Preboot/Cryptexes/Incoming/OS/usr/lib")
       (subpath "/System/Cryptexes/OS/System/Library/Frameworks")
       (subpath "/System/Cryptexes/OS/System/Library/PrivateFrameworks")
       (subpath "/System/Cryptexes/OS/usr/lib")
       (subpath "/System/Cryptexes/App/System/Library/Frameworks")
       (subpath "/System/Cryptexes/App/System/Library/PrivateFrameworks")
       (subpath "/System/Cryptexes/App/usr/lib"))
(define read-directory-and-issue-read-extension-secondary-paths
    (list "/System/Cryptexes/OS/System/Library/PrivateFrameworks/WebInspectorUI.framework"
          "/System/Volumes/Preboot/Cryptexes/OS/System/Library/PrivateFrameworks/WebInspectorUI.framework"
          "/System/Volumes/Preboot/Cryptexes/Incoming/OS/System/Library/PrivateFrameworks/WebInspectorUI.framework"))
(with-filter (mac-policy-name "Sandbox")
    (allow system-mac-syscall (mac-syscall-number 2 4 6 7)))
(with-filter (mac-policy-name "Quarantine")
    (allow system-mac-syscall (mac-syscall-number 84 87)))
;; 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)))
; Copyright (C) 2021 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.
(define (home-library-preferences-regex home-library-preferences-relative-regex)
    (regex (string-append "^" (regex-quote (param "HOME_LIBRARY_PREFERENCES_DIR")) home-library-preferences-relative-regex)))
(define (home-library-preferences-literal home-library-preferences-relative-literal)
    (literal (string-append (param "HOME_LIBRARY_PREFERENCES_DIR") home-library-preferences-relative-literal)))
(define (shared-preferences-read . domains)
    (for-each (lambda (domain)
        (begin
            (allow user-preference-read (with telemetry) (preference-domain domain))
            (allow file-read*
                (literal (string-append "/Library/Preferences/" domain ".plist"))
                (home-library-preferences-literal (string-append "/" domain ".plist"))
                (home-library-preferences-regex (string-append #"/ByHost/" (regex-quote domain) #"\..*\.plist$")))))
        domains))
(define (allow-reading-global-preferences)
    (allow user-preference-read (preference-domain "kCFPreferencesAnyApplication"))
    (allow file-read*
        (literal "/Library/Preferences/.GlobalPreferences.plist")
        (home-subpath "/Library/Preferences/.GlobalPreferences.plist")
        (home-subpath "/Library/Preferences/.GlobalPreferences_m.plist")
        (home-regex #"/Library/Preferences/ByHost/\.GlobalPreferences\..*\.plist$")
    )
)
(define (enhanced-security)
    (equal? (param "WEBCONTENT_IS_ENHANCED_SECURITY") "YES"))
(define (lockdown-mode)
    (equal? (param "WEBCONTENT_IS_LOCKDOWN_MODE") "YES"))
(define (webcontent_gpu_sandbox_extensions_blocking)
    (and (equal? (param "CPU") "arm64") (not (uid 0)))
)
(allow dynamic-code-generation)
(when (lockdown-mode)
    (deny dynamic-code-generation))
(when (enhanced-security)
    (deny dynamic-code-generation))
(with-filter (mac-policy-name "Sandbox")
    (allow system-mac-syscall (mac-syscall-number 5 65)))
(with-filter (mac-policy-name "Quarantine")
    (allow system-mac-syscall (mac-syscall-number 180)))
(with-filter (mac-policy-name "AMFI")
    (allow system-mac-syscall (mac-syscall-number 95)))
(allow process-info-rusage (target self))
(when (not (webcontent_gpu_sandbox_extensions_blocking))
    (allow iokit-open-service (iokit-user-client-class "IOSurfaceRoot"))
    (allow iokit-open-service (iokit-registry-entry-class
        "AGPM"
        "AppleAPFSContainer"
        "AppleM2ScalerCSCDriver"
        "AppleVideoToolboxParavirtualizationDriver"
        "IOAccelerator")))
(deny iokit-open-service (with no-report) (iokit-registry-entry-class "AppleJPEGDriver"))
(allow fs-quota-get)
(with-filter (require-not (webcontent-process-launched))
    (allow file-map-executable))
(allow file-map-executable
    (subpath
        "/System/Library/Accessibility/BundlesBase"
        "/System/Library/Components"
        "/System/Library/CoreServices"
        "/System/Library/Extensions"
        "/System/Library/Video/Plug-Ins"))
(allow mach-register
    (local-name
        "com.apple.axserver"
        "com.apple.tsm.portname"))
(allow file-read*
    (require-all (file-mode #o0004)
    (require-any (subpath "/Library/Filesystems/NetFSPlugins")
    (subpath "/Library/Apple/System")
    (subpath "/Library/Preferences/Logging")
    (subpath "/System")
    (subpath "/private/var/db/timezone")
    (subpath "/usr/lib")
    (subpath "/usr/share"))))
(allow file-read*
    (require-all (file-mode #o0004)
    (subpath "/AppleInternal/Library/Preferences/Logging")
    (system-attribute apple-internal)))
(allow file-map-executable
    (subpath "/Library/Apple/System/Library/Frameworks")
    (subpath "/Library/Apple/System/Library/PrivateFrameworks")
    (subpath "/System/Library/Frameworks")
    (subpath "/System/Library/PrivateFrameworks")
    (subpath "/usr/lib")
    (subpath "/usr/local/lib/sanitizers")
    (subpath "/usr/appleinternal/lib")
)
(allow file-read-metadata
    (literal "/etc")
    (literal "/tmp")
    (literal "/var")
    (literal "/private/etc/localtime"))
(allow file-read*
    (literal "/dev/autofs_nowait")
    (literal "/dev/random")
    (literal "/dev/urandom")
    (literal "/private/etc/master.passwd")
    (literal "/private/etc/passwd")
)
(allow file-read*
    (literal "/dev/null")
    (literal "/dev/zero"))
(allow file-write-data (with report) (with telemetry)
    (literal "/dev/null"))
(allow file-read*
       file-write-data
       file-ioctl
    (require-all
        (literal "/dev/dtracehelper")
        (require-any
            (csr CSR_ALLOW_APPLE_INTERNAL)
            (csr CSR_ALLOW_UNRESTRICTED_DTRACE))))
(define (IOAcceleratorMessageFilter)
    (apply-message-filter
        (deny (with message "IOAccelerator")
            iokit-async-external-method
            iokit-external-method)
        (allow iokit-async-external-method)
        (allow iokit-external-method)
        (allow iokit-external-trap)
    ))
(define (IOSurfaceRootUserClientMessageFilter)
    (apply-message-filter
        (deny (with message "IOSurfaceRootUserClient")
            iokit-async-external-method
            iokit-external-method)
        (allow iokit-async-external-method)
        (allow iokit-external-method)
        (allow iokit-external-trap)
    ))
(define (AppleAVDUserClientMessageFilter)
    (apply-message-filter
        (deny (with message "AppleAVDUserClient")
            iokit-async-external-method
            iokit-external-method
            iokit-external-trap)))
(define (IOSurfaceAcceleratorClientMessageFilter)
    (apply-message-filter
        (deny (with message "IOSurfaceAcceleratorClient")
            iokit-async-external-method
            iokit-external-trap)
        (allow iokit-external-method
            (iokit-method-number 1))))
(define (IOMobileFramebufferUserClientMessageFilter)
    (apply-message-filter
        (deny (with message "IOMobileFramebufferUserClient")
            iokit-async-external-method
            iokit-external-trap)
        (allow iokit-external-method
            (iokit-method-number 8 28))))
(define (system-graphics)
    (allow user-preference-read
        (preference-domain "com.apple.opengl")
        (preference-domain "com.nvidia.OpenGL"))
    (deny mach-lookup (with telemetry-backtrace)
        (global-name "com.apple.cvmsServ"))
    (deny file-read*
        (prefix "/private/var/db/CVMS/cvmsCodeSignObj"))
    (when (not (webcontent_gpu_sandbox_extensions_blocking))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "IOAccelerator"))
            (IOAcceleratorMessageFilter))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "IOAccelerator"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "IOAccelerationUserClient"))
            (apply-message-filter
                (deny
                    iokit-async-external-method
                    iokit-external-trap
                    iokit-external-method)))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "IOAccelerationUserClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "IOSurfaceRootUserClient"))
            (IOSurfaceRootUserClientMessageFilter))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "IOSurfaceRootUserClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleIntelMEUserClient"))
            (apply-message-filter
                (deny (with message "AppleIntelMEUserClient") iokit-external-method)
                (allow iokit-external-method
                    (iokit-method-number 120))
                (deny
                    iokit-async-external-method
                    iokit-external-trap)))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleIntelMEUserClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleSNBFBUserClient"))
            (apply-message-filter
                (deny (with message "AppleSNBFBUserClient") iokit-external-method)
                (allow iokit-external-method
                    (iokit-method-number 120))
                (deny
                    iokit-async-external-method
                    iokit-external-trap)))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleSNBFBUserClient")))))
    (deny iokit-open-user-client (with no-report)
        (iokit-registry-entry-class "AGPMClient"))
    (when (not (webcontent_gpu_sandbox_extensions_blocking))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleGraphicsControlClient"))
            (apply-message-filter
                (deny (with message "AppleGraphicsControlClient")
                    iokit-async-external-method
                    iokit-external-method)
                (allow iokit-external-method
                    (iokit-method-number 0 1 3 11))
                (deny iokit-external-trap)))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleGraphicsControlClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleGraphicsPolicyClient"))
            (apply-message-filter
                (deny
                    iokit-async-external-method
                    iokit-external-trap
                    iokit-external-method)))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleGraphicsPolicyClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleMGPUPowerControlClient"))
            (apply-message-filter
                (deny (with message "AppleMGPUPowerControlClient") iokit-external-method)
                (allow iokit-external-method
                    (iokit-method-number 0 1 3))
                (deny
                    iokit-async-external-method
                    iokit-external-trap)))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-registry-entry-class "AppleMGPUPowerControlClient")))))
    (allow file-read*
        (subpath "/Library/GPUBundles")))
(deny process-info*)
(allow process-info-pidinfo (target self))
(allow process-info-setcontrol (target self))
(allow process-info-dirtycontrol (target self))
(allow process-codesigning-status* (target self))
(deny sysctl*)
(allow sysctl-read
    (sysctl-name
        "hw.activecpu"
        "hw.availcpu"
        "hw.byteorder"
        "hw.busfrequency"
        "hw.busfrequency_max"
        "hw.cacheconfig"
        "hw.cachelinesize"
        "hw.cachesize"
        "hw.cpufamily"
        "hw.cpufrequency"
        "hw.cpufrequency_max"
        "hw.cpusubfamily"
        "hw.cputhreadtype"
        "hw.cputype"
        "hw.l1dcachesize"
        "hw.l1icachesize"
        "hw.l2cachesize"
        "hw.l3cachesize"
        "hw.logicalcpu"
        "hw.logicalcpu_max"
        "hw.machine"
        "hw.memsize"
        "hw.model"
        "hw.ncpu"
        "hw.nperflevels"
        "hw.pagesize"
        "hw.pagesize_compat"
        "hw.physicalcpu"
        "hw.physicalcpu_max"
        "hw.tbfrequency"
        "hw.tbfrequency_compat"
        "hw.vectorunit"
        "kern.bootargs"
        "kern.hostname"
        "kern.hv_vmm_present"
        "kern.maxfilesperproc"
        "kern.memorystatus_level"
        "kern.osproductversion"
        "kern.osrelease"
        "kern.ostype"
        "kern.osvariant_status"
        "kern.osversion"
        "kern.safeboot"
        "kern.version"
        "kern.willshutdown"
        "machdep.cpu.brand_string"
        "security.mac.sandbox.sentinel"
        "sysctl.name2oid"
        "kern.tcsm_enable"
        "kern.tcsm_available"
        "vm.footprint_suspend")
    (sysctl-name-prefix "net.routetable")
    (sysctl-name-prefix "hw.optional.")
    (sysctl-name-prefix "hw.perflevel")
)
(with-filter (require-not (webcontent-process-launched))
    (allow sysctl-read (sysctl-name "kern.boottime")))
(deny sysctl-read (with no-report)
    (sysctl-name
        "security.mac.lockdown_mode_state"
        "sysctl.proc_translated"
        "vm.task_no_footprint_for_debug"))
(with-filter (require-not (webcontent-process-launched))
    (allow sysctl-read (sysctl-name "vm.malloc_ranges")))
(allow sysctl-write
    (sysctl-name
        "kern.tcsm_enable"))
(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")
    (iokit-property "ATY,EFIDisplay")
    (iokit-property "ATY,FamilyName")
    (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 "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")
    (iokit-property "UserClientEnabled")
    (iokit-property "VRAM,totalMB")
    (iokit-property "WANTS_FRAMES_IGNORED")
    (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")
    (iokit-property "filevault-image")
    (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")
    (iokit-property "layout-id")
    (iokit-property "locationID")
    (iokit-property "model")
    (iokit-property "mt-device-id")
    (iokit-property "name")
    (iokit-property "nv-stats")
    (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")
    (iokit-property "IOAVDHEVCDecodeCapabilities")
)
(deny iokit-get-properties
    (iokit-property "AppleDiagnosticDataSysCfg")
    (iokit-property "als-colorCfg")
    (iokit-property "ean-storage-present")
    (iokit-property "noMultiColorSupport")
    (iokit-property "syscfg-v2-data")
    (with no-report))
(with-filter (iokit-registry-entry-class "IOPlatformDevice")
    (deny iokit-get-properties (with no-report)
        (iokit-property
            "artwork-display-gamut"
            "product-id")))
(with-filter (iokit-registry-entry-class "AppleMobileADBE0")
    (deny iokit-get-properties (with no-report)
        (iokit-property "APTDevice")))
(if (equal? (param "CPU") "arm64")
    (with-filter (iokit-registry-entry-class "AppleARMIODevice")
        (deny iokit-get-properties (with no-report)
            (iokit-property "supports-apt"))))
(if (equal? (param "CPU") "arm64")
    (with-filter (iokit-registry-entry-class "AppleJPEGDriver")
        (deny iokit-get-properties (with no-report)
            (iokit-property "AppleJPEGNumCores"))))
(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 ""))
(deny mach-lookup (with no-report)
    (xpc-service-name "com.apple.audio.SandboxHelper"))
(deny mach-lookup (with no-report)
    (global-name "com.apple.windowmanager.server"))
(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* (subpath path))
            (allow file-write* (with report) (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))))))
(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))
(define (uuid-HEX-pattern-match-string)
    (HEX-pattern-match-generator '(8 0 4 0 4 0 4 0 12)))
(define *uuid-pattern* "")
(define (uuid-regex-string)
    (if (zero? (string-length *uuid-pattern*))
        (set! *uuid-pattern* (uuid-HEX-pattern-match-string)))
    *uuid-pattern*)
(allow file-read*
    (subpath "/Library/Dictionaries")
    (subpath "/Library/Fonts")
    (subpath "/Library/Frameworks")
    (subpath "/Library/Managed Preferences")
    (subpath "/Library/Speech/Synthesizers")
    (regex #"^/private/etc/(hosts|group|passwd)$")
    (home-literal "/.CFUserTextEncoding")
    (home-subpath "/Library/Fonts")
    (subpath "/Library/Audio/Plug-Ins/HAL")
    (home-subpath "/Library/Dictionaries"))
(with-filter (require-not (state-flag "BlockUserInstalledFonts"))
    (allow file-read* (home-regex #".+\.(otf|ttf|ttc)$")))
(allow file-read-data
    (literal "/usr/local/lib/log")
    (subpath "/Library/Audio/Plug-Ins/Components"))
(shared-preferences-read
    "com.apple.Accessibility"
    "com.apple.ATS"
    "com.apple.CoreGraphics"
    "com.apple.DownloadAssessment"
    "com.apple.HIToolbox"
    "com.apple.LaunchServices"
    "com.apple.MultitouchSupport"
    "com.apple.ServicesMenu.Services"
    "com.apple.ViewBridge"
    "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"
    "com.apple.networkConnect"
    "com.apple.security"
    "com.apple.speech.voice.prefs"
    "com.apple.systemsound"
    "com.apple.universalaccess"
    "edu.mit.Kerberos"
    "pbs")
(allow-reading-global-preferences)
(allow-read-directory-and-issue-read-extensions (param "WEBKIT2_FRAMEWORK_DIR"))
(allow-read-directory-and-issue-read-extensions "/System/Library/PrivateFrameworks/WebInspectorUI.framework")
(map allow-read-directory-and-issue-read-extensions
    read-directory-and-issue-read-extension-secondary-paths)
(read-only-and-issue-extensions (extension "com.apple.app-sandbox.read"))
(define (read-write-extension-with-telemetry) (with report) (with telemetry) (extension "com.apple.app-sandbox.read-write"))
(read-write-and-issue-extensions (read-write-extension-with-telemetry))
(allow mach-lookup
    (require-all
        (require-not (state-flag "WebProcessDidNotInjectStoreBundle"))
        (extension "com.apple.app-sandbox.mach")
        (extension "com.apple.webkit.mach-bootstrap")
        (global-name "com.apple.commerce")))
(with-filter (system-attribute apple-internal)
    (allow mach-register
        (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")))
(deny iokit-open-user-client (with no-report)
    (iokit-user-client-class "AppleJPEGDriverUserClient"))
(when (not (webcontent_gpu_sandbox_extensions_blocking))
(if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "AppleUpstreamUserClient"))
        (apply-message-filter
            (deny (with message "AppleUpstreamUserClient")
                iokit-external-method)
            (allow iokit-external-method
                (iokit-method-number 0 1 3 4 5))
            (deny
                iokit-async-external-method
                iokit-external-trap)))
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "AppleUpstreamUserClient"))))
(if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "AudioAUUC"))
        (apply-message-filter
            (deny (with message "AudioAUUC")
                iokit-external-method)
            (allow iokit-external-method
                (iokit-method-number 0 1 3 4 5))
            (deny
                iokit-async-external-method
                iokit-external-trap)))
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "AudioAUUC"))))
(if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "IOAudioControlUserClient"))
        (apply-message-filter
            (deny
                iokit-async-external-method
                iokit-external-trap
                iokit-external-method)))
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "IOAudioControlUserClient"))))
(if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "IOAudioEngineUserClient"))
        (apply-message-filter
            (deny
                iokit-async-external-method
                iokit-external-trap
                iokit-external-method)))
    (allow iokit-open-user-client
        (require-all
            (extension "com.apple.webkit.extension.iokit")
            (iokit-user-client-class "IOAudioEngineUserClient")))))
(when (not (webcontent_gpu_sandbox_extensions_blocking))
(when (equal? (param "CPU") "arm64")
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-user-client-class
                    "AppleAVDUserClient"))
            (AppleAVDUserClientMessageFilter))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-user-client-class "AppleAVDUserClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-user-client-class "IOMobileFramebufferUserClient"))
            (IOMobileFramebufferUserClientMessageFilter))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-user-client-class "IOMobileFramebufferUserClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-user-client-class "IOSurfaceAcceleratorClient"))
            (IOSurfaceAcceleratorClientMessageFilter))
        (allow iokit-open-user-client
            (require-all
                (extension "com.apple.webkit.extension.iokit")
                (iokit-user-client-class
                    "IOSurfaceAcceleratorClient"))))))
(allow ipc-posix-shm-read* ipc-posix-shm-write-data
    (ipc-posix-name-prefix "AudioIO"))
(deny mach-lookup (with no-report)
    (global-name "com.apple.tccd.system"))
(deny mach-lookup (with telemetry-backtrace)
    (global-name "com.apple.mobileassetd.v2"))
(with-filter (require-not (state-flag "BlockMobileAssetInWebContentSandbox"))
    (allow mach-lookup
        (require-all
            (extension "com.apple.webkit.extension.mach")
            (global-name "com.apple.mobileassetd.v2"))))
(with-filter (require-not (logd-blocking))
    (allow mach-lookup (global-name
        "com.apple.logd"
        "com.apple.logd.events")))
(when (not (lockdown-mode))
    (with-filter
        (require-any
            (require-not (state-flag "UnifiedPDFEnabled"))
            (require-not (state-flag "BlockIOKitInWebContentSandbox")))
        (allow mach-lookup
            (require-all
                (extension "com.apple.webkit.extension.mach")
                (global-name "com.apple.CARenderServer")))))
(deny mach-lookup (with no-report)
    (global-name "com.apple.PowerManagement.control"))
(deny mach-lookup (with telemetry-backtrace)
    (global-name "com.apple.fonts"))
(with-filter (require-not (state-flag "BlockFontServiceInWebContentSandbox"))
    (allow mach-lookup (with telemetry-backtrace)
        (require-all
            (extension "com.apple.webkit.extension.mach")
            (global-name "com.apple.fonts"))))
(deny mach-lookup (with no-report)
    (global-name "com.apple.lsd.mapdb")
    (global-name "com.apple.lsd.modifydb"))
(when (not (webcontent_gpu_sandbox_extensions_blocking))
(allow mach-lookup
    (require-all
        (extension "com.apple.webkit.extension.mach")
        (xpc-service-name "com.apple.MTLCompilerService"))))
(deny mach-lookup (with no-report)
    (global-name "com.apple.CoreServices.coreservicesd")
    (global-name "com.apple.DiskArbitration.diskarbitrationd")
    (global-name "com.apple.ViewBridgeAuxiliary")
    (global-name "com.apple.windowserver.active"))
(deny mach-lookup (with no-report)
    (global-name "com.apple.CoreDisplay.Notification"))
(allow file-read* (subpath "/private/var/db/mds/system"))
(with-filter (uid 0)
    (allow file-write*
        (subpath "/private/var/db/mds/system"))
    (allow mach-lookup
       (global-name "com.apple.system.opendirectoryd.libinfo")
       (global-name "com.apple.system.opendirectoryd.membership"))
)
(with-filter (require-not (state-flag "BlockOpenDirectoryInWebContentSandbox"))
    (allow mach-lookup (with telemetry-backtrace)
        (require-all
            (extension "com.apple.webkit.extension.mach")
            (global-name "com.apple.system.opendirectoryd.libinfo"))))
(with-filter (state-flag "BlockOpenDirectoryInWebContentSandbox")
    (deny mach-lookup (with telemetry-backtrace)
        (global-name "com.apple.system.opendirectoryd.libinfo")))
(allow file-read*
       (subpath "/private/var/db/mds")
       (literal "/private/var/db/DetachedSignatures"))
(deny mach-lookup (with no-report)
    (global-name-prefix "com.apple.distributed_notifications"))
(allow file-read-data
    (literal "/dev/autofs_nowait"))
(system-graphics)
(with-filter (system-attribute apple-internal)
    (allow network-outbound
       (literal "/private/var/run/syslog")
    )
)
(allow file-read-data (path "/private/var/db/nsurlstoraged/dafsaData.bin"))
(define (notifyd-message-numbers) (message-number 1002 1010 1011 1012 1016 1017 1018 1021 1022 1025 1026 1028 1029 1030 1031 1032))
(define (allow-notifyd)
    (allow ipc-posix-shm-read* (ipc-posix-name "apple.shm.notification_center"))
    (when (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "NO")
        (allow mach-lookup (global-name "com.apple.system.notification_center")))
    (when (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow mach-lookup (global-name "com.apple.system.notification_center")
            (apply-message-filter
                (deny mach-message-send)
                (deny mach-message-send (with no-report) (message-number 1023))
                (allow mach-message-send (notifyd-message-numbers))))))
(with-filter (require-not (notify-blocking))
    (allow-notifyd))
(deny mach-lookup
    (global-name "com.apple.system.logger")
    (with no-report))
(with-filter (uid 0)
    (allow mach-lookup
        (global-name "com.apple.system.logger"))
)
(deny file-write-create (vnode-type SYMLINK))
(deny file-read-xattr file-write-xattr (xattr-prefix "com.apple.security.private."))
(deny file-read* file-write* (with no-report)
       (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2")
       (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2-journal"))
(deny file-read* (with no-report)
       (subpath "/Library/InputManagers")
       (home-subpath "/Library/InputManagers"))
(deny user-preference-read (with no-report)
    (preference-domain "com.apple.speech.recognition.AppleSpeechRecognition.prefs"))
(deny mach-lookup (with no-report)
       (global-name "com.apple.coreservices.appleevents")
       (global-name "com.apple.pasteboard.1")
       (global-name "com.apple.speech.recognitionserver"))
(allow file-read*
       (subpath "/Library/Components")
       (subpath "/Library/Keyboard Layouts")
       (subpath "/Library/Input Methods")
       (home-subpath "/Library/Components")
       (home-subpath "/Library/Keyboard Layouts")
       (home-subpath "/Library/Input Methods"))
(allow file-read* (subpath "/private/var/db/datadetectors/sys"))
(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))))
(deny file-write*
    (home-subpath "/Library/Preferences/")
    (with no-report))
(deny mach-lookup (with no-report)
    (xpc-service-name "com.apple.audio.toolbox.reporting.service")
)
(deny mach-lookup (with no-report)
    (global-name "com.apple.audio.SystemSoundServer-OSX")
    (global-name "com.apple.containermanagerd")
    (global-name "com.apple.cookied")
    (global-name "com.apple.coreservices.launchservicesd")
    (global-name "com.apple.linkd.autoShortcut"))
(with-filter (system-attribute apple-internal)
    (allow mach-lookup
        (global-name "com.apple.analyticsd")
        (global-name "com.apple.diagnosticd")))
(deny mach-lookup (with telemetry-backtrace)
    (global-name "com.apple.webinspector"))
(deny mach-lookup (with telemetry-backtrace)
    (global-name
        "com.apple.iconservices"
        "com.apple.iconservices.store"))
(with-filter (require-not (state-flag "BlockIconServicesInWebContentSandbox"))
    (allow mach-lookup (with telemetry-backtrace)
        (require-all
            (extension "com.apple.webkit.extension.mach")
            (global-name
                "com.apple.iconservices"
                "com.apple.iconservices.store"))))
(with-filter (state-flag "BlockIconServicesInWebContentSandbox")
    (deny mach-lookup (with telemetry-backtrace)
        (global-name
            "com.apple.iconservices"
            "com.apple.iconservices.store")))
(deny mach-lookup (with no-report)
    (global-name "com.apple.audio.AudioComponentRegistrar"))
(allow system-fsctl
    (fsctl-command (_IO "h" 47)))
(deny file-ioctl)
(allow file-ioctl (literal "/dev/dtracehelper"))
(deny socket-ioctl)
(when (defined? 'system-fcntl)
    (deny system-fcntl)
    (allow system-fcntl
       (fcntl-command
            F_ADDFILESIGS_RETURN
            F_BARRIERFSYNC
            F_CHECK_LV
            F_GETCONFINED
            F_GETFL
            F_GETPATH
            F_GETPROTECTIONCLASS
            F_GETSIGSINFO
            F_NOCACHE
            F_RDADVISE
            F_SETCONFINED
            F_SETFD
            F_SETPROTECTIONCLASS))
)
(when (defined? 'process-codesigning*)
    (deny process-codesigning-text-offset-get)
    (deny process-codesigning-cdhash-get)
    (deny process-codesigning-blob-get)
    (deny process-codesigning-teamid-get)
    (allow process-codesigning-identity-get)
    (allow process-codesigning-entitlements-blob-get)
    (allow process-codesigning-status-get)
    (allow process-codesigning-status-set (target self))
    (deny process-info-codesignature (with no-report))
)
(when (defined? 'socket-option-get)
    (deny socket-option-get)
)
(when (defined? 'socket-option-set)
    (deny socket-option-set)
)
(disable-syscall-inference)
(define (syscall-unix-only-in-use-before-launch)
    (syscall-number
        SYS_getaudit_addr
        SYS_kdebug_trace
        SYS_pathconf))
(define (syscall-unix-in-use-after-launch)
    (syscall-number
        SYS_ftruncate
        SYS_fsync
        SYS___disable_threadsignal
        SYS___mac_syscall
        SYS_access
        SYS_bsdthread_create
        SYS_bsdthread_ctl
        SYS_bsdthread_terminate
        SYS_close
        SYS_close_nocancel
        SYS_csops
        SYS_csops_audittoken
        SYS_csrctl
        SYS_dup
        SYS_exit
        SYS_fcntl
        SYS_fcntl_nocancel
        SYS_fgetxattr
        SYS_fsgetpath
        SYS_fstat64
        SYS_fstatfs64
        SYS_getattrlist
        SYS_getattrlistbulk
        SYS_getdirentries64
        SYS_getentropy
        SYS_geteuid
        SYS_getfsstat64
        SYS_getgid
        SYS_getrlimit
        SYS_getrusage
        SYS_gettimeofday
        SYS_getuid
        SYS_getxattr
        SYS_ioctl
        SYS_issetugid
        SYS_kdebug_trace64
        SYS_kdebug_trace_string
        SYS_kdebug_typefilter
        SYS_kevent_id
        SYS_kevent_qos
        SYS_lseek
        SYS_lstat64
        SYS_madvise
        SYS_mincore
        SYS_mkdir
        SYS_mmap
        SYS_mprotect
        SYS_munmap
        SYS_open
        SYS_open_nocancel
        SYS_openat
        SYS_pread
        SYS_proc_info
        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_sendto
        SYS_stat64
        SYS_statfs64
        SYS_sysctl
        SYS_thread_selfid
        SYS_ulock_wait
        SYS_ulock_wait2
        SYS_ulock_wake
        SYS_workq_kernreturn
        SYS_write_nocancel
        SYS_write
        SYS_writev))
(define (syscall-unix-apple-silicon)
    (syscall-number
        SYS_guarded_open_dprotected_np
        SYS_mremap_encrypted))
(define (syscalls-rarely-used)
    (syscall-number
        SYS_getegid
        SYS___semwait_signal))
(define (syscalls-rarely-used-blocked-in-lockdown-mode)
    (syscall-number
        SYS___pthread_kill
        SYS_openat_nocancel
))
(define (syscall-unix-blocked-in-lockdown-mode) (syscall-number
    SYS___pthread_sigmask
    SYS_faccessat
    SYS_fileport_makefd
    SYS_fstatat64
    SYS_gethostuuid
    SYS_kqueue
    SYS_kqueue_workloop_ctl
    SYS_listxattr
    SYS_sigprocmask
    SYS_sysctlbyname
    SYS_umask
    SYS_work_interval_ctl))
(define (syscall-unix-downlevels)
    (syscall-number
        SYS_flock
        SYS_fsetxattr
        SYS_msync
        SYS_rename))
(define (syscall-unix-downlevels-blocked-in-lockdown-mode)
    (syscall-number
        SYS___semwait_signal_nocancel
        SYS_change_fdguard_np
        SYS_chmod
        SYS_fchmod
        SYS_getpriority
        SYS_guarded_close_np
        SYS_guarded_open_np
        SYS_guarded_pwrite_np
        SYS_kevent
        SYS_mlock
        SYS_munlock
        SYS_openat_nocancel
        SYS_proc_rlimit_control
        SYS_shm_open
        SYS_sigaction
        SYS_unlink))
(deny syscall-unix)
(when (defined? 'SYS_crossarch_trap)
    (deny syscall-unix (with no-report) (syscall-number
        SYS_crossarch_trap)))
(with-filter (require-not (webcontent-process-launched))
    (allow syscall-unix (syscall-unix-only-in-use-before-launch)))
(with-filter (webcontent-process-launched)
    (deny syscall-unix (with telemetry) (with message "Syscall unexpectedly used after launch") (syscall-unix-only-in-use-before-launch)))
(allow syscall-unix (syscall-unix-in-use-after-launch))
(with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
    (allow syscall-unix (syscall-unix-downlevels)))
(when (not (lockdown-mode))
    (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
        (allow syscall-unix (syscall-unix-downlevels-blocked-in-lockdown-mode))))
(allow syscall-unix (with report) (with telemetry) (syscalls-rarely-used))
(when (not (lockdown-mode))
    (allow syscall-unix (syscall-unix-blocked-in-lockdown-mode))
    (when (equal? (param "CPU") "arm64")
        (allow syscall-unix (syscall-unix-apple-silicon)))
    (allow syscall-unix (with report) (with telemetry) (syscalls-rarely-used-blocked-in-lockdown-mode)))
(when (defined? 'SYS_objc_bp_assist_cfg_np)
    (allow syscall-unix (syscall-number SYS_objc_bp_assist_cfg_np)))
(when (defined? 'SYS_map_with_linking_np)
    (allow syscall-unix (syscall-number SYS_map_with_linking_np)))
(with-filter (uid 0)
    (allow syscall-unix (syscall-number SYS_gettid)))
(with-filter (require-not (webcontent-process-launched))
    (allow syscall-unix (syscall-number SYS_quotactl)))
(when (lockdown-mode)
    (deny syscall-unix (with telemetry) (syscall-unix-blocked-in-lockdown-mode))
    (deny syscall-unix (with telemetry) (syscalls-rarely-used-blocked-in-lockdown-mode))
    (when (equal? (param "CPU") "arm64")
        (deny syscall-unix (with telemetry) (syscall-unix-apple-silicon))))
(define (mach-bootstrap-message-numbers)
    (message-number 204 207 301 711 800 804))
(define (mach-bootstrap-message-numbers-post-launch)
    (message-number 204 207 301 800 804))
(define (allow-mach-bootstrap-with-filter)
    (allow mach-bootstrap
        (apply-message-filter
            (deny mach-message-send)
            (allow mach-message-send
                (mach-bootstrap-message-numbers)))))
(if (and (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES") (defined? 'mach-bootstrap))
(allow mach-bootstrap
    (apply-message-filter
        (deny mach-message-send (with no-report))
        (with-filter (extension "com.apple.webkit.mach-bootstrap")
            (allow mach-message-send (mach-bootstrap-message-numbers-post-launch)))
        (with-filter (require-not (webcontent-process-launched))
            (allow mach-message-send (mach-bootstrap-message-numbers))))))
(define (kernel-mig-routines-in-use) (kernel-mig-routine
    _mach_make_memory_entry
    host_get_io_master
    host_info
    io_iterator_is_valid
    io_iterator_next
    io_object_conforms_to
    io_registry_entry_create_iterator
    io_registry_entry_from_path
    io_registry_entry_get_parent_iterator
    io_registry_entry_get_property_bin_buf
    io_registry_entry_get_registry_entry_id
    io_server_version
    io_service_add_interest_notification_64
    io_service_add_notification_bin_64
    io_service_open_extended
    mach_exception_raise
    mach_memory_entry_ownership
    mach_port_extract_right
    mach_port_get_context_from_user
    mach_port_get_refs
    mach_port_request_notification
    mach_port_set_attributes
    mach_vm_copy
    mach_vm_map_external
    mach_vm_region
    mach_vm_region_recurse
    mach_vm_remap_external
    semaphore_create
    semaphore_destroy
    task_create_identity_token
    task_get_special_port_from_user
    task_info_from_user
    task_policy_set
    task_restartable_ranges_register
    task_restartable_ranges_synchronize
    thread_get_state_to_user
    thread_resume
    thread_suspend))
(define (kernel-mig-routines-downlevels) (kernel-mig-routine
    io_registry_entry_get_property_bytes))
(define (kernel-mig-routines-iokit) (kernel-mig-routine
    io_connect_add_client
    io_connect_async_method
    io_connect_method
    io_connect_method_var_output
    io_connect_set_notification_port_64))
(define (kernel-mig-routines-iokit-service) (kernel-mig-routine
    io_service_get_matching_service_bin
    io_service_get_matching_services_bin))
(define (kernel-mig-routines-blocked-in-lockdown-mode) (kernel-mig-routine
    task_threads_from_user
    thread_info
    thread_policy
    thread_policy_set))
(define (kernel-mig-routines-downlevels-blocked-in-lockdown-mode) (kernel-mig-routine
    clock_get_time
    host_request_notification
    io_connect_map_memory_into_task
    io_registry_create_iterator
    io_registry_entry_get_child_iterator
    io_registry_entry_get_name
    io_registry_entry_get_name_in_plane
    io_registry_entry_get_properties_bin_buf
    io_registry_get_root_entry
    io_service_close))
(define (allow-mach-exceptions operation)
    (when (equal? (param "CPU") "arm64")
        (with-filter (require-not (webcontent-process-launched))
            (allow operation (kernel-mig-routine task_register_hardened_exception_handler)))
        (allow operation (kernel-mig-routine thread_adopt_exception_handler)))
    (when (not (equal? (param "CPU") "arm64"))
        (allow operation (kernel-mig-routine thread_set_exception_ports))))
(when (defined? 'syscall-mig)
    (deny syscall-mig)
    (when (not (lockdown-mode))
        (allow-mach-exceptions syscall-mig)
        (allow syscall-mig (kernel-mig-routines-blocked-in-lockdown-mode)))
    (when (lockdown-mode)
        (deny syscall-mig (with telemetry) (kernel-mig-routines-blocked-in-lockdown-mode)))
    (allow syscall-mig (kernel-mig-routines-in-use))
    (with-filter (require-not (webcontent-process-launched))
        (when (defined? 'mach_vm_range_create)
            (allow syscall-mig (kernel-mig-routine mach_vm_range_create))))
    (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
        (allow syscall-mig (kernel-mig-routines-downlevels))
        (allow syscall-mig (kernel-mig-routines-iokit))
        (allow syscall-mig (kernel-mig-routines-iokit-service)))
    (with-filter (state-flag "BlockIOKitInWebContentSandbox")
        (deny syscall-mig (with no-report) (kernel-mig-routines-iokit-service)))
    (when (not (lockdown-mode))
        (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
            (allow syscall-mig (kernel-mig-routines-downlevels-blocked-in-lockdown-mode)))))
(if (and (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES") (and (defined? 'mach-kernel-endpoint) (not (defined? 'syscall-mig))))
    (allow mach-kernel-endpoint
        (apply-message-filter
            (deny mach-message-send)
            (when (not (lockdown-mode))
                (allow mach-message-send (kernel-mig-routines-blocked-in-lockdown-mode)))
            (when (lockdown-mode)
                (deny mach-message-send (with telemetry) (kernel-mig-routines-blocked-in-lockdown-mode)))
            (when (not (lockdown-mode))
                (allow-mach-exceptions mach-message-send))
            (allow mach-message-send (kernel-mig-routines-in-use))
            (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
                (allow mach-message-send (kernel-mig-routines-iokit-service)))
            (with-filter (state-flag "BlockIOKitInWebContentSandbox")
                (deny mach-message-send (with no-report) (kernel-mig-routines-iokit-service)))
            (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
                (allow mach-message-send (kernel-mig-routines-downlevels))
                (allow mach-message-send (kernel-mig-routines-iokit)))
            (when (not (lockdown-mode))
                (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
                    (allow mach-message-send (kernel-mig-routines-downlevels-blocked-in-lockdown-mode))))
            (with-filter (require-not (webcontent-process-launched))
                (when (defined? 'mach_vm_range_create)
                    (allow mach-message-send (kernel-mig-routine mach_vm_range_create))))
        )))
(define (syscall-mach-in-use) (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_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_self_trap
    MSC_mach_generate_activity_id
    MSC_mk_timer_arm
    MSC_mk_timer_cancel
    MSC_mk_timer_create
    MSC_mk_timer_destroy
    MSC_semaphore_signal_trap
    MSC_semaphore_timedwait_trap
    MSC_semaphore_wait_trap
    MSC_syscall_thread_switch
    MSC_task_name_for_pid
    MSC_thread_get_special_reply_port))
(define (syscall-mach-downlevels) (machtrap-number
    MSC__kernelrpc_mach_port_get_attributes_trap
    MSC_iokit_user_client_trap
    MSC_pid_for_task))
(define (syscall-mach-blocked-in-lockdown-mode) (machtrap-number
    MSC_thread_self_trap))
(define (syscall-mach-downlevels-blocked-in-lockdown-mode) (machtrap-number
    MSC_host_create_mach_voucher_trap
    MSC_mach_msg_trap
    MSC_mach_reply_port
    MSC_mach_voucher_extract_attr_recipe_trap
    MSC_swtch_pri))
(when (and (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES") (defined? 'syscall-mach))
    (deny syscall-mach)
    (allow syscall-mach (syscall-mach-in-use))
    (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
        (allow syscall-mach (syscall-mach-downlevels)))
    (when (not (lockdown-mode))
        (with-filter (require-not (state-flag "BlockIOKitInWebContentSandbox"))
            (allow syscall-mach (syscall-mach-downlevels-blocked-in-lockdown-mode))))
    (when (not (lockdown-mode))
        (allow syscall-mach (syscall-mach-blocked-in-lockdown-mode)))
    (when (lockdown-mode)
        (deny syscall-mach (with telemetry) (syscall-mach-blocked-in-lockdown-mode)))
    (when (defined? 'MSC_mach_msg2_trap)
        (allow syscall-mach (machtrap-number MSC_mach_msg2_trap))))
(when (not (webcontent_gpu_sandbox_extensions_blocking))
(if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
    (allow iokit-open-user-client
        (require-all
            (require-not (extension "com.apple.webkit.extension.iokit"))
            (iokit-registry-entry-class "IOSurfaceRootUserClient"))
        (IOSurfaceRootUserClientMessageFilter))
    (allow iokit-open-user-client
        (require-all
            (require-not (extension "com.apple.webkit.extension.iokit"))
            (iokit-registry-entry-class "IOSurfaceRootUserClient"))))
(when (equal? (param "CPU") "arm64")
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (require-not (extension "com.apple.webkit.extension.iokit"))
                (iokit-user-client-class "AppleAVDUserClient"))
            (AppleAVDUserClientMessageFilter))
        (allow iokit-open-user-client
            (require-all
                (require-not (extension "com.apple.webkit.extension.iokit"))
                (iokit-user-client-class "AppleAVDUserClient"))))
    (if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
        (allow iokit-open-user-client
            (require-all
                (require-not (extension "com.apple.webkit.extension.iokit"))
                (iokit-user-client-class "IOSurfaceAcceleratorClient"))
            (IOSurfaceAcceleratorClientMessageFilter))
        (allow iokit-open-user-client
            (require-all
                (require-not (extension "com.apple.webkit.extension.iokit"))
                (iokit-user-client-class "IOSurfaceAcceleratorClient")))))
(if (equal? (param "ENABLE_SANDBOX_MESSAGE_FILTER") "YES")
    (allow iokit-open-user-client
        (require-all
            (require-not (extension "com.apple.webkit.extension.iokit"))
            (iokit-connection "IOAccelerator"))
        (IOAcceleratorMessageFilter))
    (allow iokit-open-user-client
        (require-all
            (require-not (extension "com.apple.webkit.extension.iokit"))
            (iokit-connection "IOAccelerator")))))
(deny iokit-open-user-client
    (require-all
        (require-not (extension "com.apple.webkit.extension.iokit"))
        (iokit-user-client-class
            "AudioAUUC"
            "IOAudioControlUserClient"
            "IOAudioEngineUserClient")))
(deny iokit-open-user-client
    (require-all
        (require-not (extension "com.apple.webkit.extension.iokit"))
        (iokit-registry-entry-class
            "AGPMClient"
            "AppleGraphicsControlClient"
            "AppleGraphicsPolicyClient"
            "AppleIntelMEUserClient"
            "AppleMGPUPowerControlClient"
            "AppleSNBFBUserClient"
            "IOAccelerationUserClient")))
(deny iokit-open-user-client
    (require-all
        (require-not (extension "com.apple.webkit.extension.iokit"))
        (iokit-user-client-class "RootDomainUserClient")))
(when (webcontent_gpu_sandbox_extensions_blocking)
    (deny iokit-open-service (with telemetry))
    (deny iokit-open-user-client (with telemetry)))
(with-filter (state-flag "BlockIOKitInWebContentSandbox")
    (deny iokit-open-service (with telemetry))
    (deny iokit-open-user-client (with telemetry))
    (deny mach-lookup (with telemetry)
        (require-all
            (require-not (extension "com.apple.webkit.extension.mach"))
            (xpc-service-name "com.apple.MTLCompilerService"))))
(deny darwin-notification-post)
(allow darwin-notification-post
    (notification-name
"__ABDataBaseChangedByOtherProcessNotification"
"_AXNotification_AXSAppValidatingTestingPreference"
"_AXNotification_IsAXValidationRunnerCollectingValidations"
"_AXNotification_UseNewAXBundleLoader"
"_AXNotification_shouldPerformValidationsAtRuntime"
"_NS_ctasd"
"AppleCarPlayPreferredContentSizeCategoryChangedNotification"
"AppleDatePreferencesChangedNotification"
"AppleKeyboardsContinuousPathSettingsChangedNotification"
"AppleKeyboardsInputModeChangedNotification"
"AppleKeyboardsInternalSettingsChangedNotification"
"AppleKeyboardsPreferencesChangedNotification"
"AppleKeyboardsSettingsChangedNotification"
"AppleLanguagePreferencesChangedNotification"
"AppleMeasurementSystemPreferencesChangedNotification"
"AppleNumberPreferencesChangedNotification"
"ApplePreferredContentSizeCategoryChangedNotification"
"AppleTemperatureUnitPreferencesChangedNotification"
"AppleTextBehaviorPreferencesChangedNotification"
"AppleTimePreferencesChangedNotification"
"CPHomeCountryCodeChanged.Internal"
"GSEventHardwareKeyboardAttached"
"LetterFeedbackEnabled.notification"
"PhoneticFeedbackEnabled.notification"
"QuickTypePredictionFeedbackEnabled.notification"
"WordFeedbackEnabled.notification"
"com.apple.AddressBook.PreferenceChanged"
"com.apple.CFNetwork.har-capture-update"
"com.apple.CFPreferences._domainsChangedExternally"
"com.apple.LaunchServices.database"
"com.apple.TTS.synthProviderVoicesDidUpdate"
"com.apple.UIKit.LoggingPreferences"
"com.apple.WebKit.LibraryPathDiagnostics"
"com.apple.WebKit.deleteAllCode"
"com.apple.WebKit.dumpGCHeap"
"com.apple.WebKit.dumpUntrackedMallocs"
"com.apple.WebKit.fullGC"
"com.apple.WebKit.logMemStats"
"com.apple.WebKit.logPageState"
"com.apple.WebKit.showAllDocuments"
"com.apple.WebKit.showBackForwardCache"
"com.apple.WebKit.dumpAccessibilityTreeToStderr"
"com.apple.WebKit.showGraphicsLayerTree"
"com.apple.WebKit.showLayerTree"
"com.apple.WebKit.showLayoutTree"
"com.apple.WebKit.showLegacyFlexReasons"
"com.apple.WebKit.showLegacyGridReasons"
"com.apple.WebKit.showMemoryCache"
"com.apple.WebKit.showPaintOrderTree"
"com.apple.WebKit.showRenderTree"
"com.apple.accessibility.api"
"com.apple.accessibility.defaultrouteforcall"
"com.apple.accessibility.wob.status"
"com.apple.analyticsd.running"
"com.apple.asl.remote"
"com.apple.caulk.alloc.audiodump"
"com.apple.caulk.alloc.rtdump"
"com.apple.coreaudio.list_components"
"com.apple.coreui.statistics"
"com.apple.distnote.locale_changed"
"com.apple.language.changed"
"com.apple.mediaaccessibility.audibleMediaSettingsChanged"
"com.apple.mediaaccessibility.captionAppearanceSettingsChanged"
"com.apple.powerlog.state_changed"
"com.apple.preferences.sounds.keyboard-audio.changed"
"com.apple.runningboard.daemonstartup"
"com.apple.system.logging.prefschanged"
"com.apple.system.lowpowermode"
"com.apple.system.networkd.settings"
"com.apple.system.syslog.master"
"com.apple.system.timezone"
"com.apple.system.timezone./var/db/timezone/zoneinfo/UTC"
"com.apple.webinspectord.automatic_inspection_enabled"
"com.apple.webinspectord.available"
"com.apple.zoomwindow"
"kAFPreferencesDidChangeDarwinNotification"
"org.WebKit.lowMemory"
"org.WebKit.lowMemory.begin"
"org.WebKit.lowMemory.end"
"org.WebKit.memoryWarning"
"org.WebKit.memoryWarning.begin"
"org.WebKit.memoryWarning.end"
"org.WebKit.testNotification"
"com.apple.sessionagent.screenLockUIIsHidden"
"com.apple.sessionagent.screenLockUIIsShowing"
"com.apple.sessionagent.screenLockUIIsShown"
"com.apple.sessionagent.shieldWindowIsShowing"
"com.apple.sessionagent.shieldWindowLowered"
"com.apple.sessionagent.shieldWindowRaised"
"com.apple.accessibility.cache.app.ax"
"com.apple.accessibility.cache.ast"
"com.apple.accessibility.cache.automation.localized.lookup"
"com.apple.accessibility.cache.ax"
"com.apple.accessibility.cache.captioning"
"com.apple.accessibility.cache.differentiate.without.color"
"com.apple.accessibility.cache.enhance.background.contrast"
"com.apple.accessibility.cache.enhance.text.legibility"
"com.apple.accessibility.cache.enhance.text.legibilitycom.apple.WebKit.WebContent"
"com.apple.accessibility.cache.guided.access"
"com.apple.accessibility.cache.guided.access.via.mdm"
"com.apple.accessibility.cache.hearing.aid.paired"
"com.apple.accessibility.cache.internal.reportvalidationerrors"
"com.apple.accessibility.cache.invert.colors"
"com.apple.accessibility.cache.invert.colorscom.apple.WebKit.WebContent"
"com.apple.accessibility.cache.loc.caption.mode.enabled"
"com.apple.accessibility.cache.mono.audio"
"com.apple.accessibility.cache.quick.speak"
"com.apple.accessibility.cache.reduce.motion"
"com.apple.accessibility.cache.reduce.motion.reduce.slide.transitions"
"com.apple.accessibility.cache.reduce.motioncom.apple.WebKit.WebContent"
"com.apple.accessibility.cache.speak.this"
"com.apple.accessibility.cache.speech.settings.disabled.by.mc"
"com.apple.accessibility.cache.switch.control"
"com.apple.accessibility.cache.vot"
"com.apple.accessibility.cache.zoom"
"com.apple.accessibility.cache.*"
"com.apple.system.DirectoryService.InvalidateCache*"
"com.apple.coreservices.launchservices.session.*"
"user.uid.501.syslog.*"
 "com.apple.accessibility.AirPodsSpatialAudioLockToDeviceChanged"
        "com.apple.webinspectord.availability_check"))
(deny file-read* (with no-report)
    (home-literal "/Library/Preferences/com.apple.CFNetwork.plist")
    (home-literal "/Library/Preferences/com.apple.networkd.plist")
    (literal "/Library/Preferences/com.apple.networkd.plist")
)
(with-filter (webcontent-process-launched)
    (deny mach-task-special-port-get (with telemetry))
    (deny mach-task-special-port-set (with telemetry)))
