Sha256: 6c20d73b2ae2a6cb84a78f6b3c635fdd796f65f434126ecf77617d614e6efeae

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/agent/reporting/settings/url_exclusion'
require 'contrast/utils/object_share'

module Contrast
  module Agent
    module Reporting
      module Settings
        # InputExclusions class
        class InputExclusion < UrlExclusion
          ATTRIBUTES = UrlExclusion::ATTRIBUTES.dup << :type
          ATTRIBUTES.cs__freeze
          VALID_INPUT_TYPES = %w[COOKIE PARAMETER HEADER BODY QUERYSTRING].cs__freeze

          # @return [String] the name of the input to match
          attr_accessor :input_name

          # @return [String] the type of the input to match
          attr_accessor :input_type

          # @return type [String] The type of the input
          def type
            @_type ||= Contrast::Utils::ObjectShare::EMPTY_STRING
          end

          # @param new_type [String] Set new input type.
          # @return type [String] The type of the input.
          def type= new_type
            @_type = new_type if VALID_INPUT_TYPES.include?(new_type)
          end

          def to_controlled_hash
            hash = super
            hash[:type] = type
            hash
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contrast-agent-6.11.0 lib/contrast/agent/reporting/settings/input_exclusion.rb
contrast-agent-6.10.0 lib/contrast/agent/reporting/settings/input_exclusion.rb
contrast-agent-6.9.0 lib/contrast/agent/reporting/settings/input_exclusion.rb
contrast-agent-6.8.0 lib/contrast/agent/reporting/settings/input_exclusion.rb