# 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 # Application level settings for the Protect featureset. # Used for the FeatureSet TS response class ProtectServerFeature # Indicate if the protect feature set is enabled for this server or not. # # @return enabled [Boolean] def enabled? @_enabled end # Set the enabled # # @param enabled [Boolean] # @return enabled [Boolean] def enabled= enabled @_enabled = enabled end # Indicate if the bot protection feature set is enabled for this server or not. # # @return bot_blocker [Boolean] def bot_blocker @_bot_blocker end # set bot_blocker # # @param bot_blocker [Boolean] # @return bot_blocker [Boolean] def bot_blocker= bot_blocker @_bot_blocker = bot_blocker if !!bot_blocker == bot_blocker end # The IP addresses for which to disable protection. # # @return ip_allowlist [Array] # expires [Integer] The time after which the filter is no longer valid. # ip [String] The IP or range of IPs to which this message pertains. # name [String] The user defined name of the filter. # uuid [String] The identifier of the filter as defined by TeamServer. def ip_allowlist @_ip_allowlist ||= [] end # set ip_allowlist # # @param allowlist [array] of IpFilter: { # expires [Integer] The time after which the filter is no longer valid. # ip [String] The IP or range of IPs to which this message pertains. # name [String] The user defined name of the filter. # uuid [String] The identifier of the filter as defined by TeamServer. # } # @return ip_allowlist [Array] # expires [Integer] The time after which the filter is no longer valid. # ip [String] The IP or range of IPs to which this message pertains. # name [String] The user defined name of the filter. # uuid [String] The identifier of the filter as defined by TeamServer. def ip_allowlist= allowlist @_ip_allowlist = allowlist if allowlist.is_a? Array end # The IP addresses for which to disable protection. # # @return ip_denylist [Array] # expires [Integer] The time after which the filter is no longer valid. # ip [String] The IP or range of IPs to which this message pertains. # name [String] The user defined name of the filter. # uuid [String] The identifier of the filter as defined by TeamServer. def ip_denylist @_ip_denylist ||= [] end # set ip_denylist # # @param denylist [array] of IpFilter: { # expires [Integer] The time after which the filter is no longer valid. # ip [String] The IP or range of IPs to which this message pertains. # name [String] The user defined name of the filter. # uuid [String] The identifier of the filter as defined by TeamServer. # } # @return ip_denylist [Array] # expires [Integer] The time after which the filter is no longer valid. # ip [String] The IP or range of IPs to which this message pertains. # name [String] The user defined name of the filter. # uuid [String] The identifier of the filter as defined by TeamServer. def ip_denylist= denylist @_ip_denylist = denylist if denylist.is_a? Array end # All of the apis to add new logging calls to the application at runtime. # # @return log_enchancers [Array] # api [String] The method signature to instrument, as understood by the agent. # format [String] The format of the message to log. # id [Integer] The identifier of the enhancer as defined by TeamServer. # level [String] The level at which to log this message. Trace as 0 and Error as 4. # [ TRACE, DEBUG, INFO, WARN, ERROR ] # name [String] The user defined name of the enhancer. # type [String] The type of log message to tenerate. Audit as 0, Security as 2. # [ AUDIT, ERROR, SECURITY ] def log_enchancers @_log_enchancers ||= [] end # All of the apis to add new logging calls to the application at runtime. # # @param log_enchancers [Array] of LogEnchancers: { # api [String] The method signature to instrument, as understood by the agent. # format [String] The format of the message to log. # id [Integer] The identifier of the enhancer as defined by TeamServer. # level [String] The level at which to log this message. Trace as 0 and Error as 4. # [ TRACE, DEBUG, INFO, WARN, ERROR ] # name [String] The user defined name of the enhancer. # type [String] The type of log message to tenerate. Audit as 0, Security as 2. # [ AUDIT, ERROR, SECURITY ] # } # @return log_enchancers [Array] # api [String] The method signature to instrument, as understood by the agent. # format [String] The format of the message to log. # id [Integer] The identifier of the enhancer as defined by TeamServer. # level [String] The level at which to log this message. Trace as 0 and Error as 4. # [ TRACE, DEBUG, INFO, WARN, ERROR ] # name [String] The user defined name of the enhancer. # type [String] The type of log message to tenerate. Audit as 0, Security as 2. # [ AUDIT, ERROR, SECURITY ] def log_enchancers= log_enchancers @_log_enchancers = log_enchancers if log_enchancers.is_a? Array end # The keywords and patterns required for the input analysis of each rule with that capability. # # @return rule_defenition_list [Array] # keywords [Array] The words to search for in input that indicate an attack.{ # caseSensitive [Boolean] # id [String] # score [Integer] The impact of matching this entry; higher meaning more # likely to be an attack # value [String] } # name [String] AssessRuleID # patterns [Array] A word or pattern whose presence in an input represents an attack { # caseSensitive [Boolean] # id [String] # score [Integer] The impact of matching this entry; higher meaning more # likely to be an attack # value [String] } # } def rule_definition_list @_rule_definition_list ||= [] end # The keywords and patterns required for the input analysis of each rule with that capability. # # @param list [Array] Array of RuleDefinition: { # keywords [Array] The words to search for in input that indicate an attack.{ # caseSensitive [Boolean] # id [String] # score [Integer] The impact of matching this entry; higher meaning more # likely to be an attack # value [String] } # name [String] AssessRuleID # patterns [Array] A word or pattern whose presence in an input represents an attack { # caseSensitive [Boolean] # id [String] # score [Integer] The impact of matching this entry; higher meaning more # likely to be an attack # value [String] } # } # @return rule_defenition_list [Array] Array of RuleDefinition: { # keywords [Array] The words to search for in input that indicate an attack.{ # caseSensitive [Boolean] # id [String] # score [Integer] The impact of matching this entry; higher meaning more # likely to be an attack # value [String] } # name [String] AssessRuleID # patterns [Array] A word or pattern whose presence in an input represents an attack { # caseSensitive [Boolean] # id [String] # score [Integer] The impact of matching this entry; higher meaning more # likely to be an attack # value [String] } # } def rule_definition_list= list @_rule_definition_list = list if list.is_a? Array end # Controls for the syslogging feature in the agent. # # @return syslog [Hash] # syslogConnectionType [String] # syslogEnabled [Integer] # syslogFacilityCode [Integer] # syslogIpAddress [String] # syslogPortNumber [Integer] # syslogProtocol [String] # syslogSeverityExploited [String] # syslogSeverityProbed [String] # syslogSeveritySuspicous [String] def syslog @_syslog ||= {} end # Controls for the syslogging feature in the agent. # # @param log [Hash] { # syslogConnectionType [String] # syslogEnabled [Integer] # syslogFacilityCode [Integer] # syslogIpAddress [String] # syslogPortNumber [Integer] # syslogProtocol [String] # syslogSeverityExploited [String] # syslogSeverityProbed [String] # syslogSeveritySuspicous [String] # } # @return syslog [Hash] # syslogConnectionType [String] # syslogEnabled [Integer] # syslogFacilityCode [Integer] # syslogIpAddress [String] # syslogPortNumber [Integer] # syslogProtocol [String] # syslogSeverityExploited [String] # syslogSeverityProbed [String] # syslogSeveritySuspicous [String] def syslog= log @_syslog = log if log.is_a? Hash end end end end end end