提交 625f655f 编写于 作者: J Justin Collins

Merge branch 'master' of github.com:presidentbeef/brakeman

......@@ -12,6 +12,8 @@ trap("INT") do
exit!
end
Brakeman::Warnings_Found_Exit_Code = 3
#Parse command line options
options = {}
......@@ -147,6 +149,10 @@ OptionParser.new do |opts|
end
end
opts.on( "-z", "--exit-on-warn", "Exit code is non-zero if warnings found.") do |s|
options[:exit_on_warn] = s
end
opts.separator ""
opts.on "-k", "--checks", "List all available vulnerability checks" do
......@@ -164,4 +170,9 @@ OptionParser.new do |opts|
end
end.parse!(ARGV)
Brakeman.run options
clean = Brakeman.run options
if options[:exit_on_warn] && !clean
exit Brakeman::Warnings_Found_Exit_Code
end
......@@ -184,5 +184,14 @@ module Brakeman
else
puts tracker.report.send(options[:output_format])
end
if options[:exit_on_warn]
tracker.checks.all_warnings.each do |warning|
next if warning.confidence > options[:min_confidence]
return false
end
end
return true
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册