Class: Sqreen::Rules::UserAgentMatchesCB
- Inherits:
-
RegexpRuleCB
- Object
- CB
- FrameworkCB
- RuleCB
- RegexpRuleCB
- Sqreen::Rules::UserAgentMatchesCB
- Defined in:
- lib/sqreen/rules/user_agent_matches_cb.rb
Overview
Look for badly behaved clients
Constant Summary
Constants inherited from RuleCB
Constants included from CallCountable
CallCountable::COUNT_CALLS, CallCountable::FAILING, CallCountable::POST, CallCountable::PRE
Constants inherited from CB
Instance Attribute Summary
Attributes inherited from RuleCB
Attributes included from CallCountable
#call_count_interval, #call_counts
Attributes inherited from FrameworkCB
Attributes inherited from CB
#klass, #method, #overtimeable
Instance Method Summary collapse
Methods inherited from RegexpRuleCB
#initialize, #match_regexp, #prepare
Methods inherited from RuleCB
#advise_action, #initialize, #overtime!, #priority, #record_event, #record_exception, #rule_name, #rulespack_id
Methods included from CallCountable
#count_callback_calls, #failing_with_count, #post_with_count, #pre_with_count
Methods included from Conditionable
#condition_callbacks, #failing_with_conditions, #post_with_conditions, #pre_with_conditions
Methods inherited from FrameworkCB
#record_observation, #whitelisted?
Methods inherited from CB
#failing?, #framework, #initialize, #overtime!, #post?, #pre?, #priority, #to_s, #whitelisted?
Constructor Details
This class inherits a constructor from Sqreen::Rules::RegexpRuleCB
Instance Method Details
#pre(_inst, _args, _budget = nil, &_block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sqreen/rules/user_agent_matches_cb.rb', line 12 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 |