Sha256: 3f29584c6b44e987f2efe574cc21cad7c79139c4ecc09ec6a1abaa5e5bb3ca34

Contents?: true

Size: 1.78 KB

Versions: 34

Compression:

Stored size: 1.78 KB

Contents

# encoding: utf-8

require 'one_apm/configuration'

module OneApm
  module Configuration
    class HighSecuritySource < OneApm::Support::DottedHash

      OFF = "off".freeze
      RAW = "raw".freeze
      OBFUSCATED = "obfuscated".freeze

      SET_TO_OBFUSCATED = [RAW, OBFUSCATED]

      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

      def record_sql_setting(local_settings, key)
        original_value  = local_settings[key]
        result = if SET_TO_OBFUSCATED.include?(original_value)
          OBFUSCATED
        else
          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
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
oneapm_rpm-1.2.6 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.6.rc1 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.5 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.5.rc1 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.4 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.4.rc1 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.3 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.3.rc2 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.2 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.2.rc lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.1 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.1.rc lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.2.0 lib/one_apm/configuration/high_security_source.rb
oneapm_rpm-1.1.3 lib/one_apm/configuration/high_security_source.rb