Sha256: ef831d6180dd7ae081c92205b3b789e35cb8473d115104c730371c300ce5f2f7
Contents?: true
Size: 1.13 KB
Versions: 33
Compression:
Stored size: 1.13 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 module NewRelic module Agent module Datastores module NosqlObfuscator 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
Version data entries
33 entries across 33 versions & 1 rubygems