diff options
| author | Xu Cheng | 2015-03-09 15:03:19 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-03-10 00:57:21 +0800 |
| commit | 7d7081a18bb2419fc961d9bfbf32adc6e0e319ba (patch) | |
| tree | 45e1fb08cdb3f1ae0c3423772b7f164499276917 /Library | |
| parent | f9ec5c5e629afd93cd95f00eb41c4f707e037d5c (diff) | |
| download | brew-7d7081a18bb2419fc961d9bfbf32adc6e0e319ba.tar.bz2 | |
audit: whitelist pipe, redirect etc in the system check
Closes Homebrew/homebrew#37523.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index dd41d9284..9eac644ad 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -714,8 +714,10 @@ class FormulaAuditor if @strict if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/ bad_system = $1 - good_system = bad_system.gsub(" ", "\", \"") - problem "Use `system #{good_system}` instead of `system #{bad_system}` " + unless %w[| < > & ;].any? { |c| bad_system.include? c } + good_system = bad_system.gsub(" ", "\", \"") + problem "Use `system #{good_system}` instead of `system #{bad_system}` " + end end if line =~ /(require ["']formula["'])/ |
