audit: whitelist pipe, redirect etc in the system check

Closes Homebrew/homebrew#37523.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-03-09 15:03:19 +08:00
parent f9ec5c5e62
commit 7d7081a18b

View File

@ -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["'])/