classApplicationController<ActionController::Base# Prevent CSRF attacks by raising an exception.# For APIs, you may want to use :null_session instead.protect_from_forgerywith::exceptionend
2. 発生現象
Rails アプリのログに以下のような出力があった。
/log/production.log
123456789101112
I, [2014-04-13T16:14:55.292117 #4798] INFO -- : Processing by JsonBlogController#index as */*
I, [2014-04-13T16:14:55.292357 #4798] INFO -- : Parameters: {"callback"=>"jQuery1102002235242399477899_1397373294976", "http_referer"=>"http://komasaru.github.io/", "_"=>"1397373294977"}
W, [2014-04-13T16:14:55.918983 #4798] WARN -- : Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.
I, [2014-04-13T16:14:55.919652 #4798] INFO -- : Completed 500 Internal Server Error in 627ms
F, [2014-04-13T16:14:55.926267 #4798] FATAL -- :
ActionController::InvalidCrossOriginRequest (Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.):
actionpack (4.1.0) lib/action_controller/metal/request_forgery_protection.rb:217:in `verify_same_origin_request'
activesupport (4.1.0) lib/active_support/callbacks.rb:424:in `block in make_lambda'
activesupport (4.1.0) lib/active_support/callbacks.rb:231:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:231:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `block in halting'