LoginSignup
40
41

More than 5 years have passed since last update.

RailsアプリケーションのセキュリティチェックするRails Brakemanを試してみる

Posted at

Moongiftの記事で紹介のあったRailsアプリケーションのセキュリティをチェックするアプリケーション「Rails Brakeman」を使ってみたので簡単に使い方をまとめます。

インストール

gemでインストールします。

$ gem install brakeman

Railsプロジェクトを作成する

セキュリティーの問題を表示したいのでRailsの3.1.0を使用します。

$ rails -v
Rails 3.1.0
$ rails new demo
$ cd demo

rails generate用に下記をGemfileに追加します。

Gemfile
gem 'therubyracer'

bundleコマンドを実行してgemを追加します。

$ bundle

scaffoldを追加します。

$ rails generate scaffold User name:string password:string admin:boolean

検査

コマンドライン

まず、コマンドラインで実行してその結果を表示します。

$ brakeman

HTML

次に検査の結果をHTMLに出力します。

$ brakeman -o report.html

report.htmlをブラウザで表示します。

おわりに

セキュリティチェックのツールはいろいろありまずが、Railsプロジェクトに絞っている分シンプルで使いやすいと思います。あと、テストと一緒にCIツールとかと自動化できるようにしたいですね。

40
41
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
40
41