class Sqreen::Rules::URLMatchesCB

FIXME: Tune this as Rack capable callback? If:

- we have a 404
- the path is a typical bot scanning request

Then we deny the ressource and record the attack.

Public Instance Methods

post(rv, _inst, args, _budget = nil, &_block) click to toggle source
# File lib/sqreen/rules/url_matches_cb.rb, line 16
def post(rv, _inst, args, _budget = nil, &_block)
  return unless rv.is_a?(Array) && rv.size > 0 && rv[0] == 404
  env = args[0]
  path = env['SCRIPT_NAME'].to_s + env['PATH_INFO'].to_s
  found = match_regexp(path)
  infos = { :path => path, :found => found }
  record_event(infos) if found
  advise_action(nil)
end