Sha256: 54883d418876913f69c9159f4bf0dc4e3d7cf83c2263d8a961881d396e3d219a

Contents?: true

Size: 682 Bytes

Versions: 39

Compression:

Stored size: 682 Bytes

Contents

# typed: ignore

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

require 'sqreen/rules/regexp_rule_cb'

module Sqreen
  module Rules
    # Look for badly behaved clients
    class UserAgentMatchesCB < RegexpRuleCB
      def pre(_inst, _args, _budget = nil, &_block)
        ua = framework.client_user_agent
        return unless ua
        found = match_regexp(ua)
        return unless found
        Sqreen.log.debug { "Found UA #{ua} - found: #{found}" }
        infos = { :found => found }
        record_event(infos)
        advise_action(:raise, :data => found)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
sqreen-1.25.1 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.25.0 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.24.3 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.24.2 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.24.1 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.24.0 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.23.2 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.23.1 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.23.0 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.22.1 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.22.0-java lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.22.0 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.21.1-java lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.21.1 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.21.0-java lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.21.0 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.20.4-java lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.20.4 lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.21.0.beta3-java lib/sqreen/rules/user_agent_matches_cb.rb
sqreen-1.21.0.beta3 lib/sqreen/rules/user_agent_matches_cb.rb