Brakemanメモ

Rails用の脆弱性チェックツール。Brakeman 5.0.0で確認。

以下のGemをインストールする。

group :development do
  gem 'brakeman'
end

bundle exec brakemanで実行すると以下のような結果が表示される。

== Overview ==

Controllers: 3
Models: 3
Templates: 9
Errors: 0
Security Warnings: 1

== Warning Types ==

SQL Injection: 1

== Warnings ==

-- press enter/return to continue or q to stop --

Confidence: Medium
Category: SQL Injection
Check: SQL
Message: Possible SQL injection
Code: User.where(("id = " + params[:id]))
File: app/controllers/users_controller.rb
Line: 12

bundle exec brakeman -o file.htmlのようにするとHTMLで保存される。JSONで保存したければ-o file.jsonのようにすれば良い。それ以外の拡張子はtextで保存される模様。