# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true module Contrast module Config # Common Configuration settings. Those in this section pertain to the # assess functionality of the Agent. class AssessConfiguration < BaseConfiguration # @return [String, nil] attr_accessor :tags # @return [Boolean, nil] attr_accessor :enable attr_writer :enable_scan_response, :enable_dynamic_sources, :sampling, :rules, :stacktraces DEFAULT_STACKTRACES = 'ALL' def initialize hsh = {} @enable = traverse_config(hsh, :enable) @tags = traverse_config(hsh, :tags) @enable_scan_response = traverse_config(hsh, :enable_scan_response) @enable_dynamic_sources = traverse_config(hsh, :enable_dynamic_sources) @enable_original_object = traverse_config(hsh, :enable_original_object) @sampling = Contrast::Config::SamplingConfiguration.new(traverse_config(hsh, :sampling)) @rules = Contrast::Config::AssessRulesConfiguration.new(traverse_config(hsh, :rules)) @stacktraces = traverse_config(hsh, :stacktraces) end # @return [Boolean, true] def enable_scan_response @enable_scan_response.nil? ? true : @enable_scan_response end # @return [Boolean, true] def enable_dynamic_sources @enable_dynamic_sources.nil? ? true : @enable_dynamic_sources end # @return [Boolean, true] def enable_original_object @enable_original_object.nil? ? true : @enable_original_object end # @return [Contrast::Config::SamplingConfiguration] def sampling @sampling ||= Contrast::Config::SamplingConfiguration.new end # @return [Contrast::Config::AssessRulesConfiguration] def rules @rules ||= Contrast::Config::AssessRulesConfiguration.new end # @return [String] stacktrace level def stacktraces @stacktraces ||= DEFAULT_STACKTRACES end end end end