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
#request_call(data) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/datadog/appsec/contrib/excon/ssrf_detection_middleware.rb', line 15 def request_call(data) context = AppSec.active_context return super unless context && AppSec.rasp_enabled? timeout = Datadog.configuration.appsec.waf_timeout ephemeral_data = { 'server.io.net.url' => request_url(data), 'server.io.net.request.method' => data[:method].to_s.upcase, 'server.io.net.request.headers' => normalize_headers(data[:headers]) } result = context.run_rasp(Ext::RASP_SSRF, {}, ephemeral_data, timeout, phase: Ext::RASP_REQUEST_PHASE) handle(result, context: context) if result.match? super end |
#response_call(data) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/datadog/appsec/contrib/excon/ssrf_detection_middleware.rb', line 32 def response_call(data) context = AppSec.active_context return super unless context && AppSec.rasp_enabled? timeout = Datadog.configuration.appsec.waf_timeout ephemeral_data = { 'server.io.net.response.status' => data.dig(:response, :status).to_s, 'server.io.net.response.headers' => normalize_headers(data.dig(:response, :headers)) } result = context.run_rasp(Ext::RASP_SSRF, {}, ephemeral_data, timeout, phase: Ext::RASP_RESPONSE_PHASE) handle(result, context: context) if result.match? super end |