aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/diagnostic.rb
diff options
context:
space:
mode:
authorMike McQuaid2017-04-22 16:31:19 +0100
committerMike McQuaid2017-04-22 16:31:19 +0100
commitd02b4f321d01fbd4cd2b4c1bd76d1f06d1612126 (patch)
treec7c3945f258f8b33278b120f788b8c6c82a21688 /Library/Homebrew/diagnostic.rb
parent206d6de845c9041bbbd4d955e56befb338295e96 (diff)
downloadbrew-d02b4f321d01fbd4cd2b4c1bd76d1f06d1612126.tar.bz2
Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them over the network. Also, support using these tokens with environment filtering and clear `HOMEBREW_PATH` from subprocesses to stop them sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrew’s user’s PATH for e.g. `brew doctor` etc.
Diffstat (limited to 'Library/Homebrew/diagnostic.rb')
-rw-r--r--Library/Homebrew/diagnostic.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb
index 61cdf2f1a..28b57579b 100644
--- a/Library/Homebrew/diagnostic.rb
+++ b/Library/Homebrew/diagnostic.rb
@@ -439,7 +439,7 @@ module Homebrew
message = ""
- paths.each do |p|
+ paths(ENV["HOMEBREW_PATH"]).each do |p|
case p
when "/usr/bin"
unless $seen_prefix_bin
@@ -609,7 +609,7 @@ module Homebrew
/Applications/Server.app/Contents/ServerRoot/usr/sbin
].map(&:downcase)
- paths.each do |p|
+ paths(ENV["HOMEBREW_PATH"]).each do |p|
next if whitelist.include?(p.downcase) || !File.directory?(p)
realpath = Pathname.new(p).realpath.to_s