Sha256: bdee8049da426da068a551f4359f1e030f87b0f1082c6602c18327438e744bd6
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true module Datadog module AppSec module Contrib module GraphQL module Reactive # Dispatch data from a GraphQL resolve query to the WAF context module Multiplex ADDRESSES = [ 'graphql.server.all_resolvers' ].freeze private_constant :ADDRESSES def self.publish(op, gateway_multiplex) catch(:block) do op.publish('graphql.server.all_resolvers', gateway_multiplex.arguments) nil end end def self.subscribe(op, waf_context) op.subscribe(*ADDRESSES) do |*values| Datadog.logger.debug { "reacted to #{ADDRESSES.inspect}: #{values.inspect}" } arguments = values[0] persistent_data = { 'graphql.server.all_resolvers' => arguments } 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 end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems