33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/datadog/appsec/contrib/rack/reactive/request.rb', line 33
def self.subscribe(op, waf_context)
op.subscribe(*ADDRESSES) do |*values|
Datadog.logger.debug { "reacted to #{ADDRESSES.inspect}: #{values.inspect}" }
= values[0]
= .dup.tap { |h| h.delete('cookie') }
uri_raw = values[1]
query = values[2]
cookies = values[3]
client_ip = values[4]
request_method = values[5]
persistent_data = {
'server.request.cookies' => cookies,
'server.request.query' => query,
'server.request.uri.raw' => uri_raw,
'server.request.headers' => ,
'server.request.headers.no_cookies' => ,
'http.client_ip' => client_ip,
'server.request.method' => request_method,
}
waf_timeout = Datadog.configuration.appsec.waf_timeout
result = waf_context.run(persistent_data, {}, waf_timeout)
next if result.status != :match
yield result
throw(:block, true) unless result.actions.empty?
end
end
|