Sha256: d2a93731efc9dee275c5303e93a0cafa241cf5de667b609475b884b9956b2845
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 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/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 }" # @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::Agent::DiagnosticsConfig::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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-6.11.0 | lib/contrast/components/assess_rules.rb |
contrast-agent-6.10.0 | lib/contrast/components/assess_rules.rb |
contrast-agent-6.9.0 | lib/contrast/components/assess_rules.rb |