Sha256: 20f8f839f4e3999c0e2001edadaf3ba66933813323dff07ecd912d7f0fe787be
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
# encoding: utf-8 # 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 module NewRelic module Agent module Datastores module Mongo module Obfuscator ALLOWLIST = [:operation].freeze def self.obfuscate_statement(source, allowlist = ALLOWLIST) if source.is_a?(Hash) obfuscated = {} source.each do |key, value| if allowlist.include?(key) obfuscated[key] = value else obfuscated[key] = obfuscate_value(value, allowlist) end end obfuscated else obfuscate_value(source, allowlist) end end QUESTION_MARK = '?'.freeze def self.obfuscate_value(value, allowlist = ALLOWLIST) if value.is_a?(Hash) obfuscate_statement(value, allowlist) elsif value.is_a?(Array) value.map { |v| obfuscate_value(v, allowlist) } else QUESTION_MARK end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
newrelic_rpm-8.10.1 | lib/new_relic/agent/datastores/mongo/obfuscator.rb |
newrelic_rpm-8.10.0 | lib/new_relic/agent/datastores/mongo/obfuscator.rb |