Class: OneApm::Configuration::HighSecuritySource

Inherits:
Support::DottedHash show all
Defined in:
lib/one_apm/configuration/high_security_source.rb

Constant Summary collapse

OA_OFF =
"off".freeze
OA_RAW =
"raw".freeze
OA_OBFUSCATED =
"obfuscated".freeze
OA_SET_TO_OBFUSCATED =
[OA_RAW, OA_OBFUSCATED]

Instance Method Summary collapse

Methods inherited from Support::DottedHash

#inspect, symbolize, #to_hash

Constructor Details

#initialize(local_settings) ⇒ HighSecuritySource

Returns a new instance of HighSecuritySource.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/one_apm/configuration/high_security_source.rb', line 15

def initialize(local_settings)
  super({
    :ssl => true,

    :capture_params           => false,
    :'resque.capture_params'  => false,
    :'sidekiq.capture_params' => false,

    # These aren't strictly necessary as add_custom_parameters is
    # directly responsible for ignoring incoming param, but we disallow
    # attributes by these settings just to be safe
    :'transaction_tracer.capture_attributes' => false,
    :'error_collector.capture_attributes'    => false,
    :'browser_monitoring.capture_attributes' => false,
    :'analytics_events.capture_attributes'   => false,

    :'transaction_tracer.record_sql' => record_sql_setting(local_settings, :'transaction_tracer.record_sql'),
    :'slow_sql.record_sql'           => record_sql_setting(local_settings, :'slow_sql.record_sql'),
    :'mongo.obfuscate_queries'       => true,

    :'custom_insights_events.enabled'   => false,
    :'strip_exception_messages.enabled' => true
  })
end

Instance Method Details

#record_sql_setting(local_settings, key) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/one_apm/configuration/high_security_source.rb', line 40

def record_sql_setting(local_settings, key)
  original_value  = local_settings[key]
  result = if OA_SET_TO_OBFUSCATED.include?(original_value)
    OA_OBFUSCATED
  else
    OA_OFF
  end

  if result != original_value
    OneApm::Manager.logger.info("Disabling setting #{key}='#{original_value}' because high security mode is enabled. Value will be '#{result}'")
  end

  result
end