Skip to content

Commit 08c552f

Browse files
committed
Remove reactive engine from AppSec GraphQL instrumentation
1 parent bcaf86a commit 08c552f

File tree

4 files changed

+10
-143
lines changed

4 files changed

+10
-143
lines changed

Diff for: lib/datadog/appsec/contrib/graphql/gateway/watcher.rb

+10-12
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require 'json'
44
require_relative '../../../instrumentation/gateway'
5-
require_relative '../../../reactive/engine'
6-
require_relative '../reactive/multiplex'
75

86
module Datadog
97
module AppSec
@@ -19,30 +17,30 @@ def watch
1917
watch_multiplex(gateway)
2018
end
2119

22-
# This time we don't throw but use next
2320
def watch_multiplex(gateway = Instrumentation.gateway)
2421
gateway.watch('graphql.multiplex', :appsec) do |stack, gateway_multiplex|
25-
event = nil
2622
context = AppSec::Context.active
27-
engine = AppSec::Reactive::Engine.new
2823

2924
if context
30-
GraphQL::Reactive::Multiplex.subscribe(engine, context) do |result|
31-
event = {
25+
persistent_data = {
26+
'graphql.server.all_resolvers' => gateway_multiplex.arguments
27+
}
28+
29+
result = context.run_waf(persistent_data, {}, Datadog.configuration.appsec.waf_timeout)
30+
31+
if result.match?
32+
Datadog::AppSec::Event.tag_and_keep!(context, result)
33+
34+
context.events << {
3235
waf_result: result,
3336
trace: context.trace,
3437
span: context.span,
3538
multiplex: gateway_multiplex,
3639
actions: result.actions
3740
}
3841

39-
Datadog::AppSec::Event.tag_and_keep!(context, result)
40-
context.events << event
41-
4242
Datadog::AppSec::ActionsHandler.handle(result.actions)
4343
end
44-
45-
GraphQL::Reactive::Multiplex.publish(engine, gateway_multiplex)
4644
end
4745

4846
stack.call(gateway_multiplex.arguments)

Diff for: lib/datadog/appsec/contrib/graphql/reactive/multiplex.rb

-46
This file was deleted.

Diff for: sig/datadog/appsec/contrib/graphql/reactive/multiplex.rbs

-17
This file was deleted.

Diff for: spec/datadog/appsec/contrib/graphql/reactive/multiplex_spec.rb

-68
This file was deleted.

0 commit comments

Comments
 (0)