Sha256: 1cdbb20655b8a5682c908afbda5146e332f14db9dbe82d471aa18d454a05f5ea
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'set' module Contrast module Config # Common Configuration settings. Those in this section pertain to the rule mode of a single protect rule in the # Agent. class ProtectRuleConfiguration include Contrast::Config::BaseConfiguration # @return [Boolean, nil] attr_accessor :enable # @return [String, nil] attr_accessor :mode # @return [Boolean, nil] attr_accessor :disable_system_commands attr_writer :detect_custom_code_accessing_system_files def initialize hsh = {} return unless hsh @enable = hsh[:enable] @mode = hsh[:mode] @disable_system_commands = hsh[:disable_system_commands] @detect_custom_code_accessing_system_files = hsh[:detect_custom_code_accessing_system_files] end # @return [Boolean, true] def detect_custom_code_accessing_system_files @detect_custom_code_accessing_system_files.nil? ? true : @detect_custom_code_accessing_system_files end # To convert the user input mode from config to a standard format used by TS & SR, we need to convert the given # String to its recognized symbol equivalent. If a nonsense value is provided, it'll # be treated the same as disabling the rule. # # @return [Symbol, nil] def applicable_mode return unless mode case mode.downcase when 'permit' :PERMIT when 'block_at_perimeter' :BLOCK_AT_PERIMETER when 'block' :BLOCK when 'monitor' :MONITOR else :NO_ACTION end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-6.11.0 | lib/contrast/config/protect_rule_configuration.rb |
contrast-agent-6.10.0 | lib/contrast/config/protect_rule_configuration.rb |