From 7d7081a18bb2419fc961d9bfbf32adc6e0e319ba Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Mon, 9 Mar 2015 15:03:19 +0800 Subject: [PATCH] audit: whitelist pipe, redirect etc in the system check Closes Homebrew/homebrew#37523. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/audit.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index dd41d9284c..9eac644adc 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["'])/