Commit 718c6a24 authored by Eloy Durán's avatar Eloy Durán

[Sandbox] No need to write the profile to disk, just use the `-p` option.

parent b832807e
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
# TODO: # TODO:
# #
# * Check if we should be importing any other default profiles. E.g. `bsd.sb`.
#
# * Use `literal` paths where possible, instead of `regex`.
#
# * How are we going to handle allowing processes like `git`, `svn`, and `hg` # * How are we going to handle allowing processes like `git`, `svn`, and `hg`
# to work when they might be somewhere in a non-standard prefix? # to work when they might be somewhere in a non-standard prefix?
# #
...@@ -38,12 +42,9 @@ xcode_app_path = File.expand_path('../..', developer_prefix) ...@@ -38,12 +42,9 @@ xcode_app_path = File.expand_path('../..', developer_prefix)
require 'erb' require 'erb'
profile = ERB.new(DATA.read).result(TOPLEVEL_BINDING) profile = ERB.new(DATA.read).result(TOPLEVEL_BINDING)
filename = '/tmp/sandbox-pod.sb'
File.open(filename, 'w') { |f| f.write(profile) }
puts profile puts profile
command = ['/usr/bin/sandbox-exec', '-f', filename, pod_bin, *ARGV] command = ['/usr/bin/sandbox-exec', '-p', profile, pod_bin, *ARGV]
exec *command exec *command
...@@ -51,9 +52,10 @@ __END__ ...@@ -51,9 +52,10 @@ __END__
(version 1) (version 1)
(debug allow) (debug allow)
(import "mDNSResponder.sb")
(allow file-ioctl) (allow file-ioctl)
(allow sysctl-read) (allow sysctl-read)
(allow file-read-metadata)
(allow mach-lookup) (allow mach-lookup)
(allow ipc-posix-shm) (allow ipc-posix-shm)
(allow process-fork) (allow process-fork)
...@@ -62,10 +64,6 @@ __END__ ...@@ -62,10 +64,6 @@ __END__
; TODO: Needed for appldoc to install a docset ; TODO: Needed for appldoc to install a docset
; (allow appleevent-send) ; (allow appleevent-send)
; TODO see if we can restrict this too
;(allow network-outbound (literal "/private/var/run/mDNSResponder"))
(allow network-outbound)
(allow process-exec (allow process-exec
(regex (regex
#"^<%= pod_bin %>" #"^<%= pod_bin %>"
...@@ -79,7 +77,7 @@ __END__ ...@@ -79,7 +77,7 @@ __END__
) )
) )
;; Allow these reads: (allow file-read-metadata)
(allow file-read* (allow file-read*
(regex (regex
; TODO see if we can restrict this more, but it's going to be hard ; TODO see if we can restrict this more, but it's going to be hard
...@@ -102,7 +100,6 @@ __END__ ...@@ -102,7 +100,6 @@ __END__
) )
) )
;; Allow these writes:
(allow file-write* (allow file-write*
(regex (regex
#"^<%= Pod::Config.instance.project_root %>" #"^<%= Pod::Config.instance.project_root %>"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment