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`.
This commit is contained in:
parent
5cf3838f42
commit
536c48e804
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user