;;; Copyright (c) 2017 Apple Inc.  All Rights reserved.
;;;
;;; WARNING: The sandbox rules in this file currently constitute
;;; Apple System Private Interface and are subject to change at any time and
;;; without notice.
;;;
(version 1)

(deny default)
(deny file-map-executable process-info* nvram*)
(deny dynamic-code-generation)

(deny mach-priv-host-port)

(import "system.sb")
(import "com.apple.corefoundation.sb")
(corefoundation)

(import "com.apple.PerfPowerServices.sb")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; FILE OPERATIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Read/write cache access
(let ((cache-path-filter (home-subpath "/Library/Caches/com.apple.PerfPowerServicesExtended")))
  (allow file-read* file-write* cache-path-filter)
  (allow file-issue-extension
    (require-all
      (extension-class "com.apple.app-sandbox.read" "com.apple.app-sandbox.read-write")
      cache-path-filter)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MACH LOOKUP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Enlist mach lookups for global names alphabetically
(allow mach-lookup
    (global-name "com.apple.dock.server")
    (global-name "com.apple.lsd.modifydb"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; IOKIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Enlist iokit client class alphabetically
(allow iokit-open-user-client
       (iokit-user-client-class "AppleNVMeEANUC")
       (iokit-user-client-class "AppleNVMeUpdateUC"))
       
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; System and NW
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(allow system-socket)
(allow system-audit)


