我将brakeman rake任务设置为通过Jenkins自动运行,但是,由于我已经解决了它发现的初始安全漏洞,Brakeman现在99%的时间都是干净运行的。我不想每次打开报告都看到没有问题。我希望它(Jenkins、Brakeman或其他自定义软件)在发现新漏洞时通过电子邮件(或其他方式)通知我。
有人能想出一种方法来做到这一点吗?
发布于 2015-12-23 01:09:31
这里有两个选项:
-z或rake brakeman:check运行Brakeman (您可能必须用brakeman --rake替换当前的Rake任务以添加此选项),如果发现任何警告,这将返回非零退出代码。这应该会使您的构建失败。在Jenkins中,添加“电子邮件通知”作为“生成后操作”,以便向您发送电子邮件。不推荐使用Rake运行Brakeman,因为它会不必要地加载整个应用程序。
发布于 2015-12-23 06:48:01
我最终增强了刹车人:如果发现任何问题,就运行任务发送电子邮件:
namespace :brakeman do
desc "Run Brakeman"
task :run, :emails do |t, args|
require 'brakeman'
file = ["tmp/brakeman_reports/brakeman_on_#{Date.today.to_s}.html"]
result = Brakeman.run :app_path => ".", :output_files => file, :print_report => true
unless result.filtered_warnings.empty?
BrakemanReportMailer.notify(args[:emails]).deliver
end结束结束
https://stackoverflow.com/questions/34409580
复制相似问题