Sha256: c995da249aad2f1798d3a316655c0a2f60a4c805881b2d3ecdd14f760f82f4d1
Contents?: true
Size: 1.57 KB
Versions: 11
Compression:
Stored size: 1.57 KB
Contents
# Copyright (c) 2021 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 < BaseConfiguration KEYS = { enable: EMPTY_VALUE, mode: EMPTY_VALUE, disable_system_commands: EMPTY_VALUE, detect_custom_code_accessing_system_files: Contrast::Config::DefaultValue.new('true') }.cs__freeze def initialize hsh super(hsh, KEYS) 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 Contrast::Api::Settings::ProtectionRule::Mode equivalent. If a nonsense value is provided, it'll # be treated the same as disabling the rule. # # @return [Contrast::Api::Settings::ProtectionRule::Mode, nil] def applicable_mode return unless mode case mode when 'permit' Contrast::Api::Settings::ProtectionRule::Mode::PERMIT when 'block_at_perimeter' Contrast::Api::Settings::ProtectionRule::Mode::BLOCK_AT_PERIMETER when 'block' Contrast::Api::Settings::ProtectionRule::Mode::BLOCK when 'monitor' Contrast::Api::Settings::ProtectionRule::Mode::MONITOR else Contrast::Api::Settings::ProtectionRule::Mode::NO_ACTION end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems