Skip to content
Snippets Groups Projects
Commit 7d7081a1 authored by Xu Cheng's avatar Xu Cheng
Browse files

audit: whitelist pipe, redirect etc in the system check


Closes Homebrew/homebrew#37523.

Signed-off-by: default avatarXu Cheng <xucheng@me.com>
parent f9ec5c5e
No related branches found
No related tags found
No related merge requests found
...@@ -714,8 +714,10 @@ class FormulaAuditor ...@@ -714,8 +714,10 @@ class FormulaAuditor
if @strict if @strict
if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/ if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/
bad_system = $1 bad_system = $1
good_system = bad_system.gsub(" ", "\", \"") unless %w[| < > & ;].any? { |c| bad_system.include? c }
problem "Use `system #{good_system}` instead of `system #{bad_system}` " good_system = bad_system.gsub(" ", "\", \"")
problem "Use `system #{good_system}` instead of `system #{bad_system}` "
end
end end
if line =~ /(require ["']formula["'])/ if line =~ /(require ["']formula["'])/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment