Sha256: 89974e206f27ab9977313e530fb1ad76c3669dbcbe9f62584191d09a06835df9

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

Stored size: 1.67 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/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

          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

2 entries across 2 versions & 1 rubygems

Version Path
contrast-agent-6.1.2 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb
contrast-agent-6.1.1 lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb