Padrino Commit Mar 12, 2013

skade Make jruby optional until travis fixes rubygems

skade Fix a configuration bug that excluded jruby completely

skade Travis fixed their issues, jruby is mandatory again

TravisJRuby の設定をいじって、結果、特に何も変更されませんでした。

skade Move rake initialization into CLI

#1109でレポートのあった Rake タスク用の初期化処理が2重で呼び出されてしまったり、余計な警告が表示される問題が解消されました。

skade Merge pull request #1100 from skade/authenticity_token

#1100のマージコミットです。

skade Add csrf token handling
skade Add a csrf_token_field helper for forms
skade Use the master version of rack-protection
skade Port rack/protection#46 temporarily
skade Revert "Port rack/protection#46 temporarily"
skade Remove rack-protection from Gemfile
skade Add minimum rack-protection version

#893で議論されていた、クロスサイトリクエストフォージェリ(CSRF)対策の実装がされました。

プロジェクト生成時、config/apps.rb にデフォルト設定として

set :protection, true
set :protect_form_csrf, true

が追加され、rack-protection がデフォルトで使用されるようになりました。

また、protect_form_csrf で Rack::Protection::AuthenticityToken の使用を個別に切り替える事ができるようになりました。
合わせて allow_disabled_csrf を有効にすることで、明示的にルートのオプションで

csrf_protection => false

としないと 403 にする ということができるようになりました。

さらに、ヘルパーとして csrf_token_field が追加され、form_for で生成されるフォーム内に、自動的にトークンを格納した非表示のフィールドが追加されるようになりました。