Sha256: 45ca6be3c9a8d6413f9061bb3a6f9ff92f344f773995a2d0a8d73541356cf4f0
Contents?: true
Size: 1.07 KB
Versions: 8
Compression:
Stored size: 1.07 KB
Contents
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/utils/object_share' module Contrast module Agent module Reporting # helper methods used for masking module MaskerUtils include Contrast::Utils::ObjectShare # Mask raw query as it comes from the env. # exp: # 'ssn=1234567&id=%272%20or%202%20=%202%27' => # 'ssn=contrast-redacted-ssn&id=contrast-redacted-id' # # @param query [String] # @param results [Array<Contrast::Agent::Reporting::ApplicationDefendAttackActivitys>] # results to match against. def mask_raw_query query, results masked = EMPTY_STRING hash = URI.decode_www_form(query).to_h mask_with_dictionary(results, hash) # Restore to string form. hash.each { |k, v| masked += "#{ k }#{ EQUALS }#{ v }#{ AMPERSAND }" } query = masked query.chomp!(masked[-1]) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems