Sha256: 0de698adb9c21ba7b3ade0d6572a7f1b315d04349356aae36898c3be92faca51

Contents?: true

Size: 1.06 KB

Versions: 42

Compression:

Stored size: 1.06 KB

Contents

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.io/terms.html

require 'sqreen/rule_callback'
require 'sqreen/instrumentation'

module Sqreen
  module Rules
    # Save request context for handling further down
    class RecordRequestContext < RuleCB
      def whitelisted?
        false
      end

      def pre(_inst, *args, &_block)
        framework.store_request(args[0])
        wh = framework.whitelisted_match
        if wh
          unless Sqreen.features.key?('whitelisted_metric') &&
                 !Sqreen.features['whitelisted_metric']
            record_observation(Instrumentation::WHITELISTED_METRIC, wh, 1)
          end
          Sqreen.log.debug { "Request was whitelisted because of #{wh}" }
        end
        advise_action(nil)
      end

      def post(_rv, _inst, *_args, &_block)
        framework.clean_request
        advise_action(nil)
      end

      def failing(_exception, _inst, *_args, &_block)
        framework.clean_request
        advise_action(nil)
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
sqreen-1.10.5-java lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-alt-1.10.5 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.5 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.4-java lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-alt-1.10.4 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.4 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.3-java lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-alt-1.10.3 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.3 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.2-java lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-alt-1.10.2 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.2 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.1-java lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-alt-1.10.1 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.1 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.0-java lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-alt-1.10.0 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.10.0 lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.9.2-java lib/sqreen/rules_callbacks/record_request_context.rb
sqreen-1.9.2 lib/sqreen/rules_callbacks/record_request_context.rb