Skip to content
Snippets Groups Projects
Commit 536c48e8 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

sandbox: tweak HOMEBREW_REPOSITORY handling.

If we have a HOMEBREW_REPOSITORY and HOMEBREW_PREFIX mismatch (now the
default) then we can block access to the whole of HOMEBREW_REPOSITORY
rather than just the HOMEBREW_LIBRARY and `.git`.
parent 5cf3838f
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ module Homebrew
sandbox.allow_write_cellar(formula)
sandbox.allow_write_xcode
sandbox.allow_write_path HOMEBREW_PREFIX
sandbox.deny_write_homebrew_library
sandbox.deny_write_homebrew_repository
sandbox.exec(*args)
else
exec(*args)
......
......@@ -84,10 +84,14 @@ class Sandbox
allow_write_path formula.logs
end
def deny_write_homebrew_library
deny_write_path HOMEBREW_LIBRARY
deny_write_path HOMEBREW_REPOSITORY/".git"
def deny_write_homebrew_repository
deny_write HOMEBREW_BREW_FILE
if HOMEBREW_PREFIX.to_s != HOMEBREW_REPOSITORY.to_s
deny_write_path HOMEBREW_REPOSITORY
else
deny_write_path HOMEBREW_LIBRARY
deny_write_path HOMEBREW_REPOSITORY/".git"
end
end
def exec(*args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment