Class: Datadog::AppSec::Contrib::Excon::SSRFDetectionMiddleware
- Inherits:
-
Excon::Middleware::Base
- Object
- Excon::Middleware::Base
- Datadog::AppSec::Contrib::Excon::SSRFDetectionMiddleware
- Defined in:
- lib/datadog/appsec/contrib/excon/ssrf_detection_middleware.rb
Overview
AppSec Middleware for Excon
Instance Method Summary collapse
Instance Method Details
permalink #request_call(data) ⇒ Object
[View source]
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datadog/appsec/contrib/excon/ssrf_detection_middleware.rb', line 15 def request_call(data) return super unless AppSec.rasp_enabled? && AppSec.active_context context = AppSec.active_context request_url = URI.join("#{data[:scheme]}://#{data[:host]}", data[:path]).to_s ephemeral_data = {'server.io.net.url' => request_url} result = context.run_rasp(Ext::RASP_SSRF, {}, ephemeral_data, Datadog.configuration.appsec.waf_timeout) if result.match? AppSec::Event.tag_and_keep!(context, result) context.events.push( AppSec::SecurityEvent.new(result, trace: context.trace, span: context.span) ) AppSec::ActionsHandler.handle(result.actions) end super end |