Class: Datadog::AppSec::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/appsec/processor.rb,
lib/datadog/appsec/processor/actions.rb,
lib/datadog/appsec/processor/context.rb,
lib/datadog/appsec/processor/rule_loader.rb,
lib/datadog/appsec/processor/rule_merger.rb

Overview

Processor integrates libddwaf into datadog/appsec

Defined Under Namespace

Modules: Actions, RuleLoader, RuleMerger Classes: Context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruleset:, telemetry:) ⇒ Processor

Returns a new instance of Processor.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/datadog/appsec/processor.rb', line 11

def initialize(ruleset:, telemetry:)
  @telemetry = telemetry
  @diagnostics = nil
  @addresses = []

  settings = Datadog.configuration.appsec

  # TODO: Refactor to make it easier to test
  unless require_libddwaf && libddwaf_provides_waf? && create_waf_handle(settings, ruleset)
    Datadog.logger.warn('AppSec is disabled, see logged errors above')
  end
end

Instance Attribute Details

#addressesObject (readonly)

Returns the value of attribute addresses.



9
10
11
# File 'lib/datadog/appsec/processor.rb', line 9

def addresses
  @addresses
end

#diagnosticsObject (readonly)

Returns the value of attribute diagnostics.



9
10
11
# File 'lib/datadog/appsec/processor.rb', line 9

def diagnostics
  @diagnostics
end

Instance Method Details

#finalizeObject



28
29
30
# File 'lib/datadog/appsec/processor.rb', line 28

def finalize
  @handle.finalize
end

#new_contextObject



32
33
34
# File 'lib/datadog/appsec/processor.rb', line 32

def new_context
  Context.new(@handle, telemetry: @telemetry)
end

#ready?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/datadog/appsec/processor.rb', line 24

def ready?
  !@handle.nil?
end