Sha256: 1ff4ffe0131f143cbbf5664b371f255401644b3f0c74a87d8cccd3edff1e0406
Contents?: true
Size: 1.2 KB
Versions: 7
Compression:
Stored size: 1.2 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. 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
7 entries across 7 versions & 1 rubygems