Sha256: 1ea59f9aae85881aaa0f23bbbdca31e0d5b88636b34bb8058cb2552e0282694f

Contents?: true

Size: 1.65 KB

Versions: 11

Compression:

Stored size: 1.65 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

require 'new_relic/agent/configuration/dotted_hash'

module NewRelic
  module Agent
    module Configuration
      class HighSecuritySource < DottedHash
        def initialize(local_settings)
          super({
            :capture_params => false,
            :'attributes.include' => [],

            :'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,
            :'elasticsearch.obfuscate_queries' => true,
            :'transaction_tracer.record_redis_arguments' => false,

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

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

        SET_TO_OBFUSCATED = [RAW, OBFUSCATED]

        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
            NewRelic::Agent.logger.info("Disabling setting #{key}='#{original_value}' because high security mode is enabled. Value will be '#{result}'")
          end

          result
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
newrelic_rpm-9.16.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.15.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.14.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.13.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.12.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.11.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.10.2 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.10.1 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.10.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.9.0 lib/new_relic/agent/configuration/high_security_source.rb
newrelic_rpm-9.8.0 lib/new_relic/agent/configuration/high_security_source.rb