Sha256: 8dc087d32ceafeea8547cf67480284567ee23c8296b2297239383a5e42ca068e
Contents?: true
Size: 1.76 KB
Versions: 5
Compression:
Stored size: 1.76 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/config/base_configuration' require 'contrast/utils/object_share' require 'contrast/components/base' module Contrast module Components # Common Configuration settings. Those in this section pertain to the # disabled assess rule functionality of the Agent. module AssessRules class Interface # :nodoc: include Contrast::Config::BaseConfiguration include Contrast::Components::ComponentBase SPEC_KEY = :disabled_rules.cs__freeze CANON_NAME = 'assess.rules' NAME_PREFIX = "#{ CONTRAST }.#{ CANON_NAME }".cs__freeze # @return [Array, nil] list of disabled assess rules attr_accessor :disabled_rules # @return [String] attr_reader :canon_name def initialize hsh = {} @canon_name = CANON_NAME @disabled_rules = [] return unless hsh @disabled_rules = cast_disabled_rules(hsh) end # Converts current configuration to effective config values class and appends them to # EffectiveConfig class. # # @param effective_config [Contrast::Config::Diagnostics::EffectiveConfig] def to_effective_config effective_config add_single_effective_value(effective_config, SPEC_KEY.to_s, disabled_rules, canon_name, NAME_PREFIX) end private def cast_disabled_rules hsh return unless hsh return unless hsh.key?(SPEC_KEY) return hsh[SPEC_KEY] if hsh[SPEC_KEY].cs__is_a?(Array) hsh[SPEC_KEY].split(',').map(&:strip) if hsh[SPEC_KEY].cs__is_a?(String) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems