Sha256: 8235a0d5b3e30d2e8be93ba6ba13a66c73a261510cb26a20d72c4077e2e70132

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

cs__scoped_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
      # rubocop:disable Style/SymbolArray, Layout/SpaceBeforeComma, Layout/SpaceInsideArrayLiteralBrackets:
      BLOCKING_RULES   = ::Set.new([:BLOCK , :BLOCK_AT_PERIMETER                  ]).cs__freeze
      PREFILTER_RULES  = ::Set.new([         :BLOCK_AT_PERIMETER                  ]).cs__freeze
      POSTFILTER_RULES = ::Set.new([:BLOCK , :PERMIT, :MONITOR]).cs__freeze
      # rubocop:enable Style/SymbolArray, Layout/SpaceBeforeComma, Layout/SpaceInsideArrayLiteralBrackets:

      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

      def off?
        mode == 'off'
      end

      def on?
        !off?
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
contrast-agent-3.10.2 lib/contrast/config/protect_rule_configuration.rb
contrast-agent-3.10.1 lib/contrast/config/protect_rule_configuration.rb
contrast-agent-3.10.0 lib/contrast/config/protect_rule_configuration.rb
contrast-agent-3.9.1 lib/contrast/config/protect_rule_configuration.rb
contrast-agent-3.9.0 lib/contrast/config/protect_rule_configuration.rb
contrast-agent-3.8.5 lib/contrast/config/protect_rule_configuration.rb
contrast-agent-3.8.4 lib/contrast/config/protect_rule_configuration.rb