Sha256: c964d8f6919da335aade1ab296bd06ccebb8ea2b32362bb7936dc0729f1d3c80

Contents?: true

Size: 1.81 KB

Versions: 18

Compression:

Stored size: 1.81 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
      # This module will hold all the settings from the TS responce
      module Settings
        # Protect level settings for the sensitive_data_masking_policy Rule entry.
        class SensitiveDataMaskingRule
          # Id for this rule.
          #
          # @return rule_id [String] Name of parameter to mask.
          def rule_id
            @_rule_id ||= Contrast::Utils::ObjectShare::EMPTY_STRING
          end

          # Set the rule name.
          #
          # @param id [String] Name of parameter to mask.
          # @return rule_id [String]
          def rule_id= id
            @_rule_id = id.to_s
          end

          # Array of keywords to mask values for the rule_id.
          #
          # @return keywords [Array<String>] set of keywords
          def keywords
            @_keywords ||= []
          end

          # Set keywords array.
          #
          # @param words_array [Array<String>]
          # @return keywords [Array<String>] set of keywords
          def keywords= words_array
            @_keywords = words_array if string_array?(words_array)
          end

          def to_controlled_hash
            {
                id: rule_id,
                keywords: keywords
            }
          end

          private

          # Determine if a array is array of strings.
          #
          # @param array [Array<String] Array of keywords.
          # @return true | false
          def string_array? array
            return false unless array.is_a?(Array) && array.any?

            array.all?(String)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contrast-agent-7.6.1 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.6.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.5.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.4.1 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.4.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.3.2 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.3.1 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.3.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.2.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.1.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-7.0.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.15.3 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.15.2 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.15.1 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.15.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.14.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.13.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.12.0 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb