Module: Datadog::AppSec::Contrib::Rails::Patcher::ProcessActionPatch
- Defined in:
- lib/datadog/appsec/contrib/rails/patcher.rb
Overview
Hook into ActionController::Instrumentation#process_action, which encompasses action filters
Instance Method Summary collapse
Instance Method Details
#process_action(*args) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/datadog/appsec/contrib/rails/patcher.rb', line 73 def process_action(*args) env = request.env context = env[Datadog::AppSec::Ext::SCOPE_KEY] return super unless context # TODO: handle exceptions, except for super gateway_request = Gateway::Request.new(request) request_return, request_response = Instrumentation.gateway.push('rails.request.action', gateway_request) do super end if request_response blocked_event = request_response.find { |action, | action == :block } if blocked_event @_response = AppSec::Response.negotiate( env, blocked_event.last[:actions] ).to_action_dispatch_response request_return = @_response.body end end request_return end |