Skip to content

Instantly share code, notes, and snippets.

@fkorotkov
Created April 10, 2018 19:06
Show Gist options
  • Save fkorotkov/531dd517ccae0a0a22cdd47898cb6dfe to your computer and use it in GitHub Desktop.
Save fkorotkov/531dd517ccae0a0a22cdd47898cb6dfe to your computer and use it in GitHub Desktop.
Base security profile for sandboxing applications on Mac OS
(version 1)
(debug deny)
;; by default deny everything
(deny default)
;; allow sending signals to itself and processes in the same group
(allow signal (target same-sandbox))
;; allow outbound internet
(allow network-outbound)
;; lookup of IPC communications/messages like PowerManagement
(allow mach-lookup)
;; allow execution of programs
(allow process*)
(allow process-exec (subpath "/bin"))
(allow process-exec (subpath "/usr"))
;; packages installed via Nix
(allow process-exec (subpath "/nix/store"))
;; Xcode, etc.
(allow process-exec (subpath "/Applications"))
; Allow reading system information like #CPUs, etc.
(allow sysctl-read)
;; make FS read only
(allow file-read* (subpath "/"))
; allow writes to standard devices like /dev/null
(allow file* (subpath "/dev"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment