Sha256: 3889a2d828d9ea51d5ccccad38112532fb11d9fc59067795ae9d9ae22d531d85
Contents?: true
Size: 983 Bytes
Versions: 6
Compression:
Stored size: 983 Bytes
Contents
# frozen_string_literal: true module FinAppsCore module Utils module ParameterFilter using StringExtensions PROTECTED_KEYS = %w(login login1 username password password1 password_confirm token x-tenant-token authorization routing_no account_no tpr_id).freeze def skip_sensitive_data(hash) if hash.is_a? String hash = hash.json_to_hash end if hash.is_a? Hash filtered_hash = hash.clone filtered_hash.each do |key, value| if PROTECTED_KEYS.include? key.to_s.downcase filtered_hash[key] = '[REDACTED]' elsif value.is_a?(Hash) filtered_hash[key] = skip_sensitive_data(value) elsif value.is_a?(Array) filtered_hash[key] = value.map {|v| v.is_a?(Hash) ? skip_sensitive_data(v) : v } end end filtered_hash else hash end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems