Module: Datadog::AppSec::Contrib::RestClient::RequestSSRFDetectionPatch
- Defined in:
- lib/datadog/appsec/contrib/rest_client/request_ssrf_detection_patch.rb
Overview
Module that adds SSRF detection to RestClient::Request#execute
Instance Method Summary collapse
Instance Method Details
#execute(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/datadog/appsec/contrib/rest_client/request_ssrf_detection_patch.rb', line 12 def execute(&block) return super unless AppSec.rasp_enabled? && AppSec.active_context context = AppSec.active_context ephemeral_data = {'server.io.net.url' => 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 |